# Calculating the max and min of $\sin(x)+\sin(y)+\sin(z)$

I took the partial derivatives of $\sin(x)+\sin(y)+\sin(z)$ and it didn’t work out, so I am trying to use Lagrange’s method (with the constraint: $x+y+z=\pi$)… I am not sure how to set this up.

EDIT: while I appreciate other approaches, if someone could direct me towards using the Lagrange’s method it would help me learn how to use that method as well ðŸ™‚

#### Solutions Collecting From Web of "Calculating the max and min of $\sin(x)+\sin(y)+\sin(z)$"

Using Lagrange multipliers, and setting up the initial function:

$$\Lambda(x, y, z, \lambda)=\sin(x)+\sin(y)+\sin(z)+\lambda(x+y+z-\pi)$$

Setting the gradient $\nabla\Lambda=0$, we can write:

$$\frac{\partial\Lambda}{\partial x}=\cos(x)+\lambda=0$$
$$\frac{\partial\Lambda}{\partial y}=\cos(y)+\lambda=0$$
$$\frac{\partial\Lambda}{\partial z}=\cos(z)+\lambda=0$$
$$\frac{\partial\Lambda}{\partial \lambda}=x+y+z-\pi=0$$

The original equations give us $x=\arccos(-\lambda), y=\arccos(-\lambda),z=\arccos(-\lambda)$, substituting into the final partial derivative gives us:

$$3\arccos(-\lambda)-\pi=0\implies-\lambda=\cos(\frac{\pi}{3})$$

We can then use this to find the critical points, which are when $x=y=z=\frac{\pi}{3}$.

Plugging this value into our initial equation gives us the maximum value: $3\sin(\frac{\pi}{3})=\frac{3\sqrt{3}}{2}$.

In order to find the minimum, we note that any of the infinite number of $\cos^{-1}(-\lambda)$ are critical points, providing $x+y+x=\pi$. As we are looking to now minimize our solution, it makes sense to maximize one solution and minimize two others.

We can do this by observing that $\cos^{-1}(-\frac{1}{2})=2\pi-\frac{\pi}{3}$, and $\cos^{-1}(-\frac{1}{2})=-\frac{\pi}{3}$, plugging these values into our equation gives us:

$$\sin(2\pi-\frac{\pi}{3})+2\sin(-\frac{\pi}{3})=-\frac{3\sqrt{3}}{2}$$

Minimizing our objective function.

Note that $\sin(x)$ is a concave function. For any concave function $f(x)$, we have that $$\dfrac{\displaystyle \sum_{k=1}^{n} f(x_k)}{n} \leq f \left( \dfrac{\sum_{k=1}^{n} x_k}{n} \right)$$

One intuitive way to think about this is that the center of mass of a $n$ body system lying on a concave curve always lies below the curve. Taking $f(x)$ to be $\sin(x)$ and $n=3$, we get that
$$\dfrac{\sin(x) + \sin(y) + \sin(z)}{3} \leq \sin \left( \dfrac{x+y+z}{3} \right) = \sin(\pi/3) = \dfrac{\sqrt{3}}{2}$$
Hence, $$\sin(x) + \sin(y) + \sin(z) \leq \dfrac{3 \sqrt{3}}{2}$$
Note that the equality holds when $x = y= z = \pi/3$.

Below is a figure for the explanation. I have drawn the curve $y=sin(x)$ but you can draw this for any concave curve $y=f(x)$.

The image was made using grapher.

For another approach, the constraint gives us $z = \pi – x -y$, so you can solve the problem by finding the minimum and maximum value of the function $$f(x,y) = \sin(x) + \sin(y) + \sin(\pi – x -y).$$