Prove $\sum_{k=0}^{n} \binom{n}{k} (\tan \frac{x}{2})^{2k} (1 + \frac{2^{k}}{(1-\tan^{2} \frac{x}{2})^{k}} ) = \sec^{2n} \frac{x}{2} + \sec^{n} x$ (IMO SL) Prove the identity
\begin{equation}
\sum_{k=0}^{n} \binom{n}{k} \Bigl(\tan \frac{x}{2}\Bigl)^{2k} \Biggl(1 + \frac{2^{k}}{(1-\tan^{2} \frac{x}{2})^{k}} \Biggl) = \sec^{2n} \frac{x}{2} + \sec^{n} x
\end{equation}
for any natural number $n$ and any angle $x$.

*

*The solution probably uses the binomial theorem, but I don't see a clear way to use it.


*The identity $\tan^2 x = \sec^2 x - 1$ could also be potentially useful.


*Finally, I noticed that $\tan^{2} \frac{x}{2}$ appears twice on the left side, which might help.
 A: Put $\xi = \tan^2 \frac{x}2$, $\eta = \frac{2}{1-tan^2 \frac{x}2}$.
\begin{align*}
L.h.s. &= \sum \binom{n}{k} \xi^k (1 + \eta^k) \\
&= \sum \binom{n}{k} \xi^k + \sum \binom{n}{k} (\xi \eta)^k \\
&= (1+\xi)^n + (1+\xi \eta)^n \\
&= \Big(1+\tan^2 \frac{x}2\Big)^n + \Big(1+\frac{2\tan^2 \frac{x}2}{ 1 - \tan^2 \frac{x}2}\Big)^n \\
\end{align*}
From the identity $\tan^2 x = \sec^2 x - 1$, $1 + \tan^{2} \frac{x}{2} = \sec^{2} \frac{x}{2}$.
And,
\begin{equation}
\Big(1+\frac{2\tan^2 \frac{x}2}{ 1 - \tan^2 \frac{x}2}\Big)^n = \Big(\frac{1 + \tan^{2} \frac{x}{2}}{1 - \tan^{2} \frac{x}{2}} \Big)^n = \Big(\frac{\sec^{2} \frac{x}{2}}{1 - \tan^{2} \frac{x}{2}} \Big)^n = \Big(\frac{1}{\cos^2 \frac{x}{2} - \sin^{2} \frac{x}{2}} \Big)^n
\end{equation}
From the identity $\cos 2x = \cos^{2} x - \sin^{2} x$,
\begin{equation}
\Big(\frac{1}{\cos^2 \frac{x}{2} - \sin^{2} \frac{x}{2}} \Big)^n = (\frac{1}{\cos x})^n = \sec^{n} x
\end{equation}
Finally, we get
\begin{equation}
\Big(1+\tan^2 \frac{x}2\Big)^n + \Big(1+\frac{2\tan^2 \frac{x}2}{ 1 - \tan^2 \frac{x}2}\Big)^n = (\sec^{2} \frac{x}{2})^{n} + \sec^{n} x = \sec^{2n} \frac{x}{2} + \sec^{n} x = R.h.s
\end{equation}
