if $A+B+C+D=\pi$, what is $\min(\cos{A}+\cos{B}+\cos{C}+\cos{D})$ Let $A,B,C,D \in R ~|~ A+B+C+D=\pi$, what is the minimum of the following function
$$f(A,B,C,D)=\cos{A}+\cos{B}+\cos{C}+\cos{D}$$
I found a post about a similar problem, butI think an even number of variables is harder than an odd number of variables, because for three variables,
$A+B+C=\pi~|~A,B,C\in R$ then it follows that $\cos{A}+\cos{B}+\cos{C}=1+4\sin{\dfrac{A}{2}}\sin{\dfrac{B}{2}}\sin{\dfrac{C}{2}}\to 1$, but for four variables, we can't.
My try: $$\cos{A}+\cos{B}+\cos{C}+\cos{D}=2\cos{\dfrac{A+B}{2}}\cos{\dfrac{A-B}{2}}+2\cos{\dfrac{C+D}{2}}\cos{\dfrac{C-D}{2}}=2\sin{\dfrac{C+D}{2}}\cos{\dfrac{A-B}{2}}+2\cos{\dfrac{C+D}{2}}\cos{\dfrac{C-D}{2}}$$
 A: So we want to minimize $f(A,B,C) = \cos A + \cos B + \cos C + \cos(\pi-A-B-C)$. We have
\begin{align*}\partial_A f(A,B,C) &= \sin(\pi-A-B-C) - \sin A\\
\partial_B f(A,B,C) &= \sin(\pi-A-B-C) - \sin B\\
\partial_C f(A,B,C) &= \sin(\pi-A-B-C) - \sin C
\end{align*}
In a mininum, we have $f'(A,B,C) = 0$, this gives 
$$ \sin A = \sin B = \sin C = \sin(\pi-A-B-C)$$
So for some $\lambda \in [-\pi, \pi]$, we must have
$$ A, B, C, \pi - A- B-C \in \{\lambda, \pi-\lambda\} + 2\pi \mathbb Z$$
Now we consider two cases (that suffices, as we may replace $\lambda$ by $\pi-\lambda$ are use the symmetry in $A, B, C$): 


*

*Up to multiples of $2\pi$, $A=B=C = \lambda$. Then $$ \pi - A-B-C= \pi - 3\lambda$$ hence for some $k$, either 
$$ \pi - 3 \lambda = \lambda + 2k\pi  \iff \lambda = \frac 14(2k-1)\pi $$
or 
$$ \pi - 3\lambda = \pi - \lambda + 2k\pi \iff 2\lambda = -2k\pi \iff \lambda = -k \pi. $$
In the first case $\cos \lambda \in \{\pm 2^{-1/2}\}$, hence 
$$ f(A,B,C) = \pm 4\cdot 2^{-1/2} = \pm 2^{3/2}. $$
In the second case $\cos\lambda \in \{\pm 1\}$, hence 
$$ f(A,B,C) = \pm 1 \pm 1 \pm 1 \mp 1 \in \{\pm 2\} $$ 

*Up to multiples of $2\pi$, $A = B = \lambda$, $C = \pi - \lambda$. Then $A+B+C = \pi + \lambda$, hence either 
$$-\lambda = \lambda + 2k\pi \iff \lambda = -k\pi $$
or 
$$-\lambda = \pi - \lambda + 2k\pi $$
but this is impossible for integer $\mathbb Z$. So this case gives nothing new.
Hence, the global mininum is $-2^{3/2}$, attained for example when $A= B= C = \frac 34\pi$, $D = -\frac 54\pi$.
A: An alternative approach:
It is known that
$$
 \cos A + \cos B + \cos C + \cos D = 2 \cos\frac{A+B}{2} \cos\frac{A-B}{2} +2 \cos\frac{C+D}{2} \cos\frac{C-D}{2}.
$$
By introducing the new variables
$$
A' = \frac{A+B}{2} \quad B' = \frac{A-B}{2} \quad C' = \frac{C+D}{2} \quad D' = \frac{C-D}{2},
$$
hence
$$
 A = A'+B' \quad B=A'-B' \quad C = C' + D' \quad D = C'-D',
$$
we see that $A +  B + C + D = \pi$ becomes $2 A' + 2 C' = \pi$. Hence we have to minimize the four functions
$$
 2 ( \pm \cos A' \pm \cos(\frac{\pi}{2} - A')) = 2( \pm \cos A' \mp \sin A')
$$
It can be shown analytically (I used the computer) that these all have a minimum of $- 2 \sqrt{2}$. For example for both $`+'$ we have $A' = 2 \tan^{-1}(1+\sqrt{2})$. Hence $C' = \frac{\pi}{2} - 2 \tan^{-1}(1+\sqrt{2})$. Furthermore have we chosen $B' = 0$ and $C' = 0$. Using this we find that:
$$
 A = \tan^{-1}(1+\sqrt{2}) \\
 B = \tan^{-1}(1+\sqrt{2}) \\
 C = \frac{\pi}{4} - \tan^{-1}(1+\sqrt{2}) \\
 D = \frac{\pi}{4} - \tan^{-1}(1+\sqrt{2}).
$$
