I've seen the following problem: find the maximum of $|z^3-z+2|$ such that $|z|=1$.
My try was the following: using two times the triangle inequality, it follows that $|z^3-z+2| \leq |z|^3+|z|+2$, but $|z|=1$ and so $|z^3-z+2| \leq 4$.
I believe that this isn't enough to conclude that the maximum is $4$ because I have to show that the value $4$ is attained by some $z \in \mathbb{C}$, right? Moreover, even if the maximum is attained for some $w\in\mathbb{C}$, I must check that $|w|=1$ as well, right?
So, in general, if I have a problem that requires to find a maximum with some constraints on the variables, if I have a bound from above I must check if there are values of the function that both attain that bound and satisfy the constraints as well, is this correct?