TITLE: Proof of $\frac{1-r^2}{1-2r \cos \theta + r^2}=1+2\sum_{k=1}^{\infty} r^k \cos k\theta$ for $0 < r < 1$
QUESTION [5 upvotes]: How to prove the following: For $0 < r < 1,$
$$\frac{1-r^2}{1-2r \cos \theta + r^2}=1+2\sum_{k=1}^{\infty} r^k \cos k\theta.$$
I started with writing the left hand side as 
$$\frac{1-r^2}{1-2r \cos \theta + r^2}=\textrm{Re} \left( \frac{1+r e^{i \theta}}{1 - r e^{i \theta}} \right),$$
but wasn't successful. Any help is much appreciated.

REPLY [5 votes]: The approach in the OP is a good one.  Proceeding we can write
$$\begin{align}
\frac{1+re^{i\theta}}{1-re^{i\theta}}&=(1+re^{i\theta})\sum_{k=0}^\infty r^ke^{ik\theta}\\\\
&=\sum_{k=0}(r^ke^{ik\theta}+r^{k+1}e^{i(k+1)\theta})\\\\
&=1+2\sum_{k=1}^\infty r^ke^{ik\theta}
\end{align}$$
which after taking the real part yields
$$\text{Re}\left(\frac{1+re^{i\theta}}{1-re^{i\theta}}\right)=1+2\sum_{k=1}^\infty r^k\cos(k\theta)$$
as was to be shown!