TITLE: Showing that $\sum_{k=0}^{\infty} a^{k} \cos(kx) = \frac{1- a \cos x}{1-2a \cos x + a^{2}}$ without using complex variables
QUESTION [15 upvotes]: The identity $$\sum_{k=0}^{\infty} a^{k} \cos(kx) = \frac{1- a \cos x}{1-2a \cos x + a^{2}} \ ,  \ |a| <1$$
can be derived by using the fact that $ \displaystyle \sum_{k=0}^{\infty} a^{k} \cos(kx) = \text{Re} \sum_{k=0}^{\infty} (ae^{ix})^{k}$.
But can it be derived without using complex variables?

REPLY [12 votes]: Using the identity,
$$\cos{\left(nx\right)}=\sum_{k=0}^{\lfloor\frac{n}{2}\rfloor}(-1)^k\binom{n}{2k}\sin^{2k}{\left(x\right)}\cos^{n-2k}{\left(x\right)},$$
the infinite series in question may be rewritten as a double infinite series over a triangle. Changing the order of summation (if you're like me and the transformation gymnastics with multiple indices makes you dizzy, here's a very handy cheat-sheet), we're left with fairly elementary summations:
$$\begin{align}
\sum_{n=0}^{\infty}a^{n}\cos{\left(nx\right)}
&=\sum_{n=0}^{\infty}a^{n}\sum_{k=0}^{\lfloor\frac{n}{2}\rfloor}(-1)^k\binom{n}{2k}\sin^{2k}{\left(x\right)}\cos^{n-2k}{\left(x\right)}\\
&=\sum_{n=0}^{\infty}\sum_{k=0}^{\lfloor\frac{n}{2}\rfloor}(-1)^k\binom{n}{2k}a^{n}\sin^{2k}{\left(x\right)}\cos^{n-2k}{\left(x\right)}\\
&=\sum_{n=0}^{\infty}\sum_{k=0}^{\infty}(-1)^k\binom{2k+n}{2k}a^{2k+n}\sin^{2k}{\left(x\right)}\cos^{n}{\left(x\right)}\\
&=\sum_{k=0}^{\infty}(-1)^ka^{2k}\sin^{2k}{\left(x\right)}\sum_{n=0}^{\infty}\binom{2k+n}{2k}\left[a\cos{\left(x\right)}\right]^n\\
&=\sum_{k=0}^{\infty}(-1)^ka^{2k}\sin^{2k}{\left(x\right)}\frac{1}{\left(1-a\cos{\left(x\right)}\right)^{2k+1}}\\
&=\frac{1}{1-a\cos{\left(x\right)}}\sum_{k=0}^{\infty}(-1)^k\left[\frac{a\sin{\left(x\right)}}{1-a\cos{\left(x\right)}}\right]^{2k}\\
&=\frac{1}{1-a\cos{\left(x\right)}}\cdot\frac{1}{1+\left[\frac{a\sin{\left(x\right)}}{1-a\cos{\left(x\right)}}\right]^{2}}\\
&=\frac{1}{1-a\cos{\left(x\right)}}\cdot\frac{\left(1-a\cos{\left(x\right)}\right)^2}{\left(1-a\cos{\left(x\right)}\right)^2+a^2\sin^2{\left(x\right)}}\\
&=\frac{1-a\cos{\left(x\right)}}{1-2a\cos{\left(x\right)}+a^2\cos^2{\left(x\right)}+a^2\sin^2{\left(x\right)}}\\
&=\frac{1-a\cos{\left(x\right)}}{1-2a\cos{\left(x\right)}+a^2}.~~\blacksquare\\
\end{align}$$
Happy holidays!