Show that $\sum_{n=1}^\infty r^n\cos(n\theta)=\dfrac{r\cos\theta -r^2}{1-2r\cos\theta+r^2}$ whenever $0Note I have seen that this question has already been posted but I believe my concerns with the question have yet to be answered.
Question: Write $z=re^{i\theta}$, where $0<r<1$, in the summation formula $$\sum_{n=0}^\infty z^n=\dfrac{1}{1-z}$$ whenever $|z|<1$. Then, with the aid of the following theorem,

Suppose that $z_n=x_n+iy_n$ ($n=1,2,\dots$) and $S=X+iY$. Then
  $$\sum_{n=1}^\infty z_n=S \text{ if and only if }\sum_{n=1}^\infty x_n=X \text{ and } \sum_{n=1}^\infty y_n=Y$$

show that 
$$\sum_{n=1}^\infty r^n\cos(n\theta)=\dfrac{r\cos\theta -r^2}{1-2r\cos\theta+r^2} \text{ and } \sum_{n=1}^\infty r^n\sin(n\theta)=\dfrac{r\sin\theta}{1-2r\cos\theta+r^2}$$ whenever $0<r<1$.
Proof: Let $z=re^{i\theta}$, where $0<r<1$. Recall $$\sum_{n=0}^\infty z^n=\dfrac{1}{1-z}$$ whenever $|z|<1$. Replace $z$ by $re^{i\theta}$ in the summation.
$$\sum_{n=0}^\infty \left(re^{i\theta}\right)^n=\sum_{n=0}^\infty r^ne^{i\theta n}=\dfrac{1}{1-re^{i\theta}}$$ whenever $\left|re^{i\theta}\right|<1$. Replace $e^{i\theta}$ by $\cos\theta +i\sin\theta$.
\begin{equation*}
\sum_{n=0}^\infty r^ne^{i\theta n} =\dfrac{1}{1-r\cos\theta-ir\sin\theta} =\dfrac{1-r\cos\theta+ir\sin\theta}{((1-r\cos\theta)-ir\sin\theta)((1-r\cos\theta)+ir\sin\theta)}=\dfrac{1-r\cos\theta+ir\sin\theta}{(1-r\cos\theta)^2+(r\sin\theta)^2}=\dfrac{1-r\cos\theta+ir\sin\theta}{1-2r\cos\theta+r^2\cos^2\theta+r^2\sin^2\theta}=\dfrac{1-r\cos\theta+ir\sin\theta}{1-2r\cos\theta+r^2}
\end{equation*}
whenever $\left|re^{i\theta} \right|<1$. 
Replace $e^{i\theta n}$ by $\cos(n\theta)+i\sin(n\theta)$. 
$$\sum_{n=0}^\infty r^n(cos(\theta n)+i\sin(\theta n))=\dfrac{1-r\cos\theta}{1-2r\cos\theta+r^2}+i \cdot \dfrac{r\sin\theta}{1-2r\cos\theta+r^2}$$
whenever $\left|re^{i\theta}\right|<1$. 
By the theorem, we have the next two sums:
$$\sum_{n=1}^\infty r^n\cos(n\theta)=\dfrac{1-r\cos\theta}{1-2r\cos\theta+r^2}$$ and $$\sum_{n=1}^\infty r^n\sin(n\theta)=\dfrac{r\sin\theta}{1-2r\cos\theta+r^2}$$ whenever $\left|re^{i\theta}\right|<1$.
So my questions are: 


*

*How can I get $1-r\cos\theta$ to become $r\cos\theta -r^2$?

*What do I do with the $n=0$ term of both sums?


The answer to your questions can be answered in one fell swoop.  Note that we have
$$\sum_{n=0}^\infty r^n\cos(n\theta)=\frac{1-r\cos(\theta)}{1-2r\cos(\theta)+r^2}\tag 1$$
The left-hand side of $(1)$ can be written
$$\sum_{n=0}^\infty r^n\cos(n\theta)=1+\sum_{n=1}^\infty r^n\cos(n\theta) \tag 2$$
Using $(2)$ in $(1)$ reveals
$$\sum_{n=1}^\infty r^n\cos(n\theta)=\frac{1-r\cos(\theta)}{1-2r\cos(\theta)+r^2}-1=\frac{r\cos(\theta)-r^2}{1-2r\cos(\theta)+r^2}$$
as was to be shown!
