Find the maximum value of $f(z)=|z^3-z+2|$ on the unit circle $|z|=1$ 
Let $f:\mathbb{C} \rightarrow \mathbb{R}$ be defined by $$f(z)=|z^3-z+2|\,.$$ What is the maximum value on the unit circle $|z|=1$ ?

My approach is as follows:
$z=e^{i\theta}$ as it is mentioned that the point lie on the unit circle.
$$f(z)=|1+\cos3\theta+i\sin3\theta +1-\cos\theta-i\sin\theta|\,.$$
Therefore, $f(z)=|t|$, where
$$t=2\cos^2\frac{3\theta}{2}+2i\sin\frac{3\theta}{2}\cos\frac{3\theta}{2}+
2\sin^2 \frac{\theta}{2}-2i\sin\frac{\theta}{2}\cos\frac{\theta}{2}\,.$$
$$t=2\cos\frac{3\theta}{2}\left(\cos\frac{3\theta}{2}+i\sin\frac{3\theta}{2}\right)-2i\sin \frac{\theta}{2}\left(\cos\frac{\theta}{2}+i\sin\frac{\theta}{2}\right)\,.$$
$$t=2\cos\frac{3\theta}{2}\,e^\frac{i3\theta}{2}-
2i\sin \frac{\theta}{2}\,e^\frac{i\theta}{2}\,.$$
I am not able to proceed from here.
Note: Please don't mark it as duplicate because the question in the website is same but my approach is different.
 A: Let $z:=\exp(\text{i}\theta)$ and $t:=\cos(\theta)$.  Then,
$$\begin{align}|z^3-z+2|^2&=\Big|\big(\cos(3\theta)-\cos(\theta)+2\big)^2+\text{i}\big(\sin(3\theta)-\sin(\theta)\big)\Big|^2
\\&=4\cos(3\theta)-2\cos(2\theta)-4\cos(\theta)+6
\\&=4(4t^3-3t)-2(2t^2-1)-4t+6
\\&=16t^3-4t^2-16t+8=:g(t)\,.
\end{align}$$
Thus, we want to maximize $g(t)$ subject to $t\in[-1,+1]$.  Note that
$$g'(t)=48t^2-8t-16=8(6t^2-t-2)=8(2t+1)(3t-2)\,.$$
That is, optimizing points of $g(t)$ in $[-1,+1]$ are $t=-\dfrac12$, $t=\dfrac23$, and the boundary points $t\in\{-1,+1\}$.
Note that $g(-1)=4$, $g(+1)=4$, $g\left(-\dfrac12\right)=13$, and $g\left(\dfrac23\right)=\dfrac{8}{27}$.  We conclude that the minimum of $g(t)$ on $[-1,+1]$ is $\dfrac{8}{27}$, which is attained when $t=\dfrac23$, whereas the maximum of $g(t)$ on $[-1,+1]$ is $13$, which is attained when $t=-\dfrac12$.  Translating this back to $\theta$, we see that $\theta=\dfrac{2\pi}{3}$ and $\theta=\dfrac{4\pi}{3}$ satisfy $\cos(\theta)=-\dfrac12$.  Thus,
$$z=\exp\left(\frac{2\pi\text{i}}{3}\right)=\dfrac{-1+\sqrt{3}\text{i}}{2}\text{ and }z=\exp\left(\frac{4\pi\text{i}}{3}\right)=\dfrac{-1-\sqrt{3}\text{i}}{2}$$
maximize $|z^3-z+2|$ for $z\in\mathbb{C}$ with $|z|=1$.  The maximum value of $|z^3-z+2|$ for $z\in\mathbb{C}$ with $|z|=1$ is $\sqrt{13}$.
Similarly, the minimum value of $|z^3-z+2|$ for $z\in\mathbb{C}$ with $|z|=1$ is $\sqrt{\dfrac{8}{27}}=\dfrac{2\sqrt{2}}{3\sqrt{3}}$.  The minimum is attained when
$$z=\frac{2+\sqrt{5}\text{i}}{3}\text{ and }z=\frac{2-\sqrt{5}\text{i}}{3}\,.$$
(This happens when $\theta=\text{arccos}\left(\dfrac23\right)$ and when $\theta=2\pi-\text{arccos}\left(\dfrac{2}{3}\right)$.)
