Showing $\sum_{cyc} \frac{\cos(\frac{\alpha+\beta}{2})}{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}}=2$ when $\alpha+\beta+\gamma=\pi$ I saw this problem in a math magazine:

Let $\alpha,\beta$ and $\gamma$ be the angles of a triangle, so that
$$
\alpha+\beta+\gamma=\pi
$$
Show that
$$
\frac{\cos\left(\frac{\alpha+\beta}{2}\right)}{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}}+\frac{\cos\left(\frac{\alpha+\gamma}{2}\right)}{\cos \frac{\alpha}{2}\cos \frac{\gamma}{2}}+
\frac{\cos\left(\frac{\gamma+\beta}{2}\right)}{\cos \frac{\gamma}{2}\cos \frac{\beta}{2}}=2
$$

I tried to rewrite $\alpha+\beta$ with $\pi-\gamma$ so that
$$
\cos\left(\frac{\alpha+\beta}{2}\right)=\cos\left(\frac{\pi}{2}-\frac{\gamma}{2}\right)= \cos \frac{\pi}{2}\cos \frac{\gamma}{2}+ \sin\frac{\pi}{2}\sin \frac{\gamma}{2}= \sin\frac{\gamma}{2}
$$
Now the above equation equals
$$
\frac{\sin\frac{\gamma}{2}}{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}}+\frac{\sin\frac{\beta}{2}}{\cos \frac{\alpha}{2}\cos \frac{\gamma}{2}}+
\frac{\sin\frac{\alpha}{2}}{\cos \frac{\gamma}{2}\cos \frac{\beta}{2}}=2
$$
But now I don't have ideas for continuation. Any hints to tackle this?
 A: First off the bat, your formula in the first line is wrong, it should be, as per my comment, $$\cos\left(\frac{\pi}{2}-\frac{\gamma}{2}\right) = \cos \frac{\pi}{2}\cos \frac{\gamma}{2}\color{purple}+\sin\frac{\pi}{2}\sin \frac{\gamma}{2}=\sin\frac{\gamma}{2}$$

I’ll take an alternative route. Expand $\cos\left(\dfrac{\alpha+\beta}{2}\right)$ as $\cos\dfrac{\alpha}{2}\cos\dfrac{\beta}{2}-\sin \dfrac{\alpha}{2}\sin \dfrac{\beta}{2}$ so that $$\dfrac{\cos\left(\dfrac{\alpha+\beta}{2}\right)}{\cos\dfrac{\alpha}{2}\cos\dfrac{\beta}{2}}=\dfrac{\cos\dfrac{\alpha}{2}\cos\dfrac{\beta}{2}-\sin \dfrac{\alpha}{2}\sin \dfrac{\beta}{2}}{\cos\dfrac{\alpha}{2}\cos\dfrac{\beta}{2}}$$$$=1-\tan\frac{\alpha}{2}\tan\frac{\beta}{2}$$
So summing similar terms we get $$LHS=3-\left(\tan\frac{\alpha}{2}\tan\frac{\beta}{2}+ \tan\frac{\gamma}{2}\tan\frac{\beta}{2}+ \tan\frac{\gamma}{2}\tan\frac{\beta}{2}\right)\tag{1}$$
Now, $$\alpha+\beta+\gamma=\pi$$$$\implies\frac{\alpha}{2}+\frac{\beta}{2}=\frac{\pi}{2}-\frac{\gamma}{2}$$ so that taking tangents and expanding using the formula gives us $$\frac{\tan\frac{\alpha}{2}+\tan\frac{\beta}{2}}{1-\tan\frac{\alpha}{2}\tan\frac{\beta}{2}}=\tan\left(\frac{\pi}{2}-\frac{\gamma}{2}\right)=\frac{1}{\tan\frac{\gamma}{2}}.\tag{2}$$ Rearranging gives us $$ \tan\frac{\alpha}{2}\tan\frac{\beta}{2}+ \tan\frac{\gamma}{2}\tan\frac{\beta}{2}+ \tan\frac{\gamma}{2}\tan\frac{\beta}{2}=1$$ so using $(1)$ and $(2)$, we get our desired result.
A: One method is to use Computer Algebra Systems to factor rational expressions.
Let
$\, x = e^{i\alpha/2},
 y = e^{i\beta/2}, z = e^{i\gamma/2}.\,$ Use
Euler's formula
to get
$$ \cos(\frac\alpha2) = \frac{x+\frac1x}2,
\quad \cos(\frac\beta2) = \frac{y+\frac1y}2,
\quad \cos(\frac\gamma2) = \frac{z+\frac1z}2,\\
\cos(\frac{\alpha+\beta}2) = \frac{xy+\frac1{xy}}2,
\cos(\frac{\alpha+\gamma}2) = \frac{xz+\frac1{xz}}2,
\cos(\frac{\beta+\gamma}2) = \frac{yz+\frac1{yz}}2.
$$
Then using a Computer Algebra System to do the algebra
factoring,
$$
\frac{\cos\left(\frac{\alpha+\beta}{2}\right)}{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}}+\frac{\cos\left(\frac{\alpha+\gamma}{2}\right)}{\cos \frac{\alpha}{2}\cos \frac{\gamma}{2}}+
\frac{\cos\left(\frac{\gamma+\beta}{2}\right)}{\cos \frac{\gamma}{2}\cos \frac{\beta}{2}} - 2 = \\
\frac{4(1+(xyz)^2)}{(1+x^2)(1+y^2)(1+z^2)}. $$
This is zero iff $(xyz)^2 = -1$ iff $\alpha+\beta+\gamma \equiv \pi \pmod{ 2\pi}.$
Alternatively, continuing from your approach (sign error fixed), you got
$$ \frac{\sin\frac{\gamma}{2}}{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}}+\frac{\sin\frac{\beta}{2}}{\cos \frac{\alpha}{2}\cos \frac{\gamma}{2}}+
\frac{\sin\frac{\alpha}{2}}{\cos \frac{\gamma}{2}\cos \frac{\beta}{2}}=2.
$$
Multiply both sides by twice the product of the cosines and
use the known trig identity $\sin(2x) = 2\sin(x)\cos(x)$ to get
$$ \sin(\alpha) + \sin(\beta) + \sin(\gamma) = 4\cos(\frac\alpha2)
\cos(\frac\beta2)\cos(\frac\gamma2) $$ which is a known trig identity
for triangles as in the Wikipedia article
List of trigonometric identites.
A: 
$$
\frac{\sin\frac{\gamma}{2}}{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}}+\frac{\sin\frac{\beta}{2}}{\cos \frac{\alpha}{2}\cos \frac{\gamma}{2}}+
\frac{\sin\frac{\alpha}{2}}{\cos \frac{\gamma}{2}\cos \frac{\beta}{2}}=2
$$

I start from your work, (Note the LHS of your equation in the last line should be all positive sum). First, do common denominator and use $~~\sin(\frac{x}2)\cos(\frac{x}2)=\frac{1}2\sin(x)$
$$\begin{align}
LHS&=\frac{\frac{1}{2}\cos \frac{\alpha}{2}\cos \frac{\beta}{2}\cos \frac{\gamma}{2}\sin\gamma
+\frac{1}{2}\cos \frac{\alpha}{2}\cos \frac{\beta}{2}\cos \frac{\gamma}{2}\sin\beta
+\frac{1}{2}\cos \frac{\alpha}{2}\cos \frac{\beta}{2}\cos \frac{\gamma}{2}\sin\alpha }{\cos^2 \frac{\alpha}{2}\cos^2 \frac{\beta}{2}\cos^2 \frac{\gamma}{2}}\\
\\
&=\frac{\frac{1}{2}\sin\gamma
+\frac{1}{2}\sin\beta
+\frac{1}{2}\sin\alpha }{\cos \frac{\alpha}{2}\cos \frac{\beta}{2}\cos \frac{\gamma}{2}}=\frac{\sin\alpha+\sin\beta+\sin(\alpha+\beta)}{2\cos\frac{\alpha}2\cos\frac{\beta}2\sin\frac{\alpha+\beta}2}\\
\end{align}$$
Now we work on the denominator
$$\begin{align}
2\cos\frac{\alpha}2\cos\frac{\beta}2\sin\frac{\alpha+\beta}2&=2\cos\frac{\alpha}2\cos\frac{\beta}2\left(\sin\frac{\alpha}2\cos\frac{\beta}2+\cos\frac{\alpha}2\sin\frac{\beta}2\right)\\
\\
&=\sin\alpha\cos^2\frac{\beta}2+\sin\beta\cos^2\frac{\alpha}2\\
\\
&=\sin\alpha~\frac{1+\cos\beta}2+\sin\beta~\frac{1+\cos\alpha}2\\
\\
&=\frac{1}2\left( \sin\alpha+\sin\beta+\sin(\alpha+\beta)\right)
\end{align}$$
$$$$
$$\Rightarrow LHS=2=RHS$$
