How to maximize $f(x,y) = 3\sin x + 4\cos y$? Hello for an linear algebra course I have the question as seen below


*Among all the unit vectors
$$
u=\left(\begin{array}{l}
u_{1} \\
u_{2} \\
u_{3} \\
u_{4}
\end{array}\right) \in \mathbb{R}^{4}
$$
find the one for which the sum
$$
3 u_{1}-2 u_{2}+4 u_{3}-u_{4}
$$
is maximal.

To maximize the sum of the unit vector I have set $u_2$ and $u_4$ to $0$ since they do not contribute to the sum. Then we are left with $2$ variables that squared have to add up to $1$. Thats when I thought of the unit circle since that always adds up to one. But trigonometry is not my strongest point and I am now trying to figure out how to maximize $3\sin x + 4\cos y$ since this would be a valid unit vector and maximize the sum in the question. Or is there another way to answer this questions. Any help or suggestions are much appreciated.
Thanks in advance,
Thomas

$u$ is a unit vector means $||u|| = \sqrt{u_1^2 +u_2^2 + u_3^2 + u_4^2} = 1$. Consider it as a constraint on the vector you seek $u$ in the form
$$
g(u_1,u_2,u_3,u_4) = 0\qquad {\rm i.e. } \qquad \sqrt{u_1^2 +u_2^2 + u_3^2 + u_4^2} - 1 =0
$$
the function you have $f(u_1,u_2,u_3,u_4) = 3u_1 - 2u_2 + 4u_3-u_4$ must be maximized subject to the cnstraint above.
using Lagrange multipliers methode you get the system
$$
\nabla f(u_1,u_2,u_3,u_4)\ - \lambda \nabla g(u_1,u_2,u_3,u_4) = \vec{0} \\
g(u_1,u_2,u_3,u_4) = 0
$$
Solve for $u_1,u_2,u_3,u_4$ and $\lambda$ you get two solutions.
