Show that $\sum_{n=0}^\infty r^n e^{i n \theta} = \frac{1- r\cos(\theta)+i r \sin(\theta)}{1+r^2-2r\cos(\theta)}$ [closed]

Show that $$\sum_{n=0}^\infty r^n e^{i n \theta} = \frac{1- r\cos(\theta)+i r \sin(\theta)}{1+r^2-2r\cos(\theta)},$$ where $0\leq r <1$.

Using this, prove that $\sum_{n=0}^\infty r^n \cos(n\theta)$ and $\sum_{n=0}^\infty r^n \sin(n\theta)$ are convergent.


The first sum is a geometric series $$\sum_{n=0}^{\infty}{r^ne^{in\theta}} = \sum_{n=0}^{\infty}(re^{i\theta})^n$$ $$=\frac{1}{1-re^{i\theta}} = \frac{1}{1-r\cos\theta -ir\sin{\theta}}\cdot\frac{1-r\cos\theta + ir\sin\theta}{1-r\cos\theta + ir\sin\theta} =\frac{1-r\cos\theta + ir\sin\theta}{1+r^2-2r\cos\theta}$$

For the next two sums notice that

$$\sum_{n=0}^{\infty}{r^ne^{in\theta}}=\sum_{n=0}^{\infty}{r^n\cos(n\theta) + i\sum_{n=0}^{\infty}r^n\sin(n\theta)}$$

So $$\displaystyle{\sum_{n=0}^{\infty}{r^n\cos(n\theta)}} = \frac{1-r\cos\theta}{1+r^2-2r\cos\theta}$$ $$\displaystyle{\sum_{n=0}^{\infty}{r^n\sin(n\theta)}} = \frac{r\sin{\theta}}{1+r^2-2r\cos\theta}$$


The series $\sum_{n=0}^\infty z^n$ is convergent provided $|z|<1$, and we have $$ \sum_{n=0}^\infty z^n=\frac{1}{1-z} \quad |z|<1. $$ So if we set $z=re^{i\theta}$, we have $r=|z|$, and therefore for every $0 \le r <1$ we get $$ \sum_{n=0}^\infty r^ne^{in\theta}=\frac{1}{1-re^{i\theta}}=\frac{1-re^{-i\theta}}{(1-re^{i\theta})(1-re^{-i\theta})}=\frac{1-r\cos\theta+ir\sin\theta}{1-2r\cos\theta+r^2}. $$ I'm guessing that what want to deduce is that the series $\sum_{n=0}^\infty r^n\cos(n\theta)$ and $\sum_{n=0}^\infty r^n\sin(n\theta)$ are convergent provided $0 \le r <1$.

This follows from the fact $$ \sum_{n=0}^\infty r^ne^{in\theta}=\sum_{n=0}^\infty r^n\cos(n\theta)+i\sum_{n=0}^\infty r^n\sin(n\theta) $$ is convergent and so we have $$ \sum_{n=0}^\infty r^n\cos(n\theta)=\frac{1-r\cos\theta}{1-2r\cos\theta+r^2},\quad \sum_{n=0}^\infty r^n\sin(n\theta)=\frac{r\sin\theta}{1-2r\cos\theta+r^2}. $$