<s>[INST] 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}}$$
 [/INST] 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$.
</s>