# Minimum value of $\cos x+\cos y+\cos(x-y)$

What is the minimum value of $$\cos x+\cos y+\cos(x-y).$$ Here $x,y$ are arbitrary real numbers. Mathematica gives (with NMinimize) $-3/2$. But I don't know if this is correct and if so, how to prove it.

• $\sin x=-\sin(x-y)=-\sin y$...?
– Alex
Sep 2 '15 at 23:24
• But do I need to check the Hessian as well? If you do not mind, could there be a proof using elementary fact like $\sin x>=-1$..?
– Alex
Sep 2 '15 at 23:32
• I tried converting the sum into product, but it's a loop.
– Alex
Sep 2 '15 at 23:40
• Sorry, somehow $y= x+(2k+1)\pi$ only produces the maximizers. Take $y=-x + 2k\pi$ as suggested by DStanley's answer. Sep 3 '15 at 0:11
• Sep 3 '15 at 5:01

The local max or min of a 2-variable function comes where both partial derivatives are 0. So if we say that

$$z = \cos x+\cos y+\cos(x-y)$$ then $$\frac{\partial z}{\partial x} = \sin x + \sin(x-y) = 0$$ and $$\frac{\partial z}{\partial y} = \sin y - \sin(x-y) = 0$$ adding the two yields

\begin{align} \sin (x) + \sin(y) &= 0 \\ \rightarrow \sin (x) &= -\sin(y) \\ \rightarrow x &= -y \end{align} plugging that into the first partial yields \begin{align} \sin x + \sin(x+x) &= 0 \\ \rightarrow \sin x &= - \sin(2x) \\ \rightarrow x &= -2x + 2\pi\text{*} \\ \rightarrow 3x &= 2\pi \\ \rightarrow x &= \frac{2\pi}{3} \approx 2.1 \end{align} and $$y = -\frac{2\pi}{3} \approx -2.1$$

plugging those values into the original equation yields

\begin{align} \mathcal z &= \cos (\frac{2\pi}{3})+\cos (-\frac{2\pi}{3})+\cos(\frac{4\pi}{3})\\ &= -\frac{1}{2} -\frac{1}{2} -\frac{1}{2}\\ &= -\frac{3}{2} \end{align}

*x=0 would fit as well but that would be a local maximum. The proof of that is left for the student.

• Hi Stanley, thanks for your help. There are some little problems though...like how do I know that this is indeed the global minimum?
– Alex
Sep 2 '15 at 23:37
• Why does $\sin x=-\sin y\rightarrow x=-y$? Sep 2 '15 at 23:53
• @user84413 because the $\sin$ function is negatively reflective across the y axis, meaning $\sin(x) = -\sin(-x)$. Sep 3 '15 at 0:45
• @Alex technically you would take the second derivatives and plug in the values. if the second derivatives at those values are both positive it is a local minimum. You can also verify it in excel :) Sep 3 '15 at 0:48
• But $\sin\frac{4\pi}{3}=-\sin\frac{\pi}{3}$, and $\frac{4\pi}{3}\ne-\frac{\pi}{3}$. Sep 3 '15 at 20:03

Consider 3 coplanar unit vectors $$\hat{\alpha}$$ , $$\hat\beta$$ , $$\hat\gamma$$

Let $$X$$ be the angle between $$\hat\alpha$$ and $$\mathrm{\hat\beta}$$ and let $$Y$$ be the angle between $$\hat\beta$$ and $$\hat\gamma$$ then it follows that the angle between $$\hat\alpha$$ and $$\hat\gamma$$ is $$(X+Y)$$, hence we can say that:-

$$\hat\gamma\cdot\hat\alpha + \hat\alpha\cdot\hat\beta + \hat\beta\cdot\hat\gamma= \cos{X} + \cos{Y} + \cos{(X+Y)}$$

$${(\hat\alpha + \hat\beta + \hat\gamma)}^{2} \ge 0\\ \implies\hat\alpha^2 + \hat\beta^2 + \hat\gamma^2 + 2(\hat\gamma\cdot\hat\alpha + \hat\alpha\cdot\hat\beta + \hat\beta\cdot\hat\gamma) \ge 0$$ Since $$\hat\alpha^2 + \hat\beta^2 + \hat\gamma^2=3$$, we can say that:-$$\hat\gamma\cdot\hat\alpha + \hat\alpha\cdot\hat\beta + \hat\beta\cdot\hat\gamma= \cos{X} + \cos{Y} + \cos{(X+Y)} \ge \frac{-3}{2}$$

This result can be extended to the given equation by replacing $$Y$$ with $$(-Y)$$ since cos is an even function.

Since cosine is even, the problem is equivalent to

Minimize $\cos(-x)+\cos(y)+\cos(x-y)$.

which is equivalent to

Minimize $\cos a + \cos b + \cos c$ subject to $a+b+c=0$.

Since cosine is periodic with period $2\pi$, this is equivalent to

Minimize $\cos a + \cos b + \cos c$ subject to $a+b+c\equiv 0\pmod{2\pi}$.

If two or more of $\cos a$, $\cos b$, $\cos c$ are positive, say $\cos a>0$ and $\cos b>0$, then replacing $a$ and $b$ with $a+\pi$ and $b+\pi$ will preserve the constraint $a+b+c\equiv 0\pmod{2\pi}$ and negate $\cos a$ and $\cos b$, reducing the sum. So we can assume that at most one of the three is positive. We thus reduce the problem to:

Minimize $\cos a + \cos b + \cos c$ subject to $a+b+c\equiv 0\pmod{2\pi}$, with $a,b\in[\frac\pi2,\frac{3\pi}2]$ and $c\in[0,2\pi)$.

And now we solve:

\begin{align*} \cos a + \cos b + \cos c &= \cos a + \cos b + \cos (2n\pi - a - b) \\ &= \cos a + \cos b + \cos(a+b) \\ &= \cos a + \cos b + 2\cos^2\big(\tfrac{a+b}2\big) - 1 \\ &\ge 2\cos\big(\tfrac{a+b}2\big) + 2\cos^2\big(\tfrac{a+b}2\big) - 1 &&\text{(cosine is convex on $[\tfrac\pi2,\tfrac{3\pi}2]$)} \\ &= 2\big(\cos\big(\tfrac{a+b}2\big) + \tfrac12\big)^2 - \tfrac32 \\ &\ge -\tfrac32 \end{align*} with equality when $a=b$ and $\cos\big(\tfrac{a+b}2\big) = -\frac12$; for example, $a=b=c=\frac{2\pi}3$.

• – user21467
Sep 3 '15 at 1:33

Let $$\displaystyle z=\cos x+\cos y+\cos(x-y) = 2\cos\left(\frac{x+y}{2}\right)\cdot \cos\left(\frac{x-y}{2}\right)+2\cos^2 \left(\frac{x-y}{2}\right)-1$$

so we get $$\displaystyle 2\cos^2 \left(\frac{x-y}{2}\right)-2\cos\left(\frac{x+y}{2}\right)\cdot \cos \left(\frac{x-y}{2}\right)-(1+z) =0$$

Now Let $$\displaystyle \cos\left(\frac{x-y}{2}\right) = t\;,$$ and $$\displaystyle \bullet \; -1\le \cos \left(\frac{x\pm y}{2}\right)\le 1$$

So we get $$\displaystyle 2t^2-2\cos \left(\frac{x+y}{2}\right)-(1+z) =0\;,$$ Now for real roots, its $\bf{Discriminant\geq 0}$

So we get $$\displaystyle 4\cos \left(\frac{x+y}{2}\right)+8(1+z)\geq 0$$

So we get $$\displaystyle \cos \left(\frac{x+y}{2}\right)+2(1+z)\geq 0\Rightarrow 2(1+z)\geq \cos \left(\frac{x+y}{2}\right)\geq -1$$

So we get $$\displaystyle (1+z)\geq -\frac{1}{2}\Rightarrow z\geq -\frac{3}{2}$$

and equality hold when $\displaystyle \cos \left(\frac{x+y}{2}\right) = -1=\cos \pi\Rightarrow x+y=2\pi$