Prove this formula $\frac{1-r\cos(x)}{1-2r\cos(x)+r^2}= 1+\sum_{n=1}^{+\infty}r^{n}\cos\left(nx\right)$ I am trying to use prove, by just simple algebraic manipulation, to prove the equality of this formula.
$$\dfrac{1-r\cos(x)}{1-2r\cos(x)+r^2}= 1+\sum_{n=1}^{+\infty}r^{n}\cos\left(nx\right)$$
I have been given hints and instructions from this thread

*

*Write using Euler’s identity $$\cos(x)=\frac{e^{ix}+e^{-ix}}{2}$$

*Factor the denominator

*Find the partial fractions decomposition, expand the parts as geometric series, and convert from exponential functions back to trigonometric functions (Euler’s identity again).

This is how I have done:

*

*RHS: $$\dfrac{1-r(\dfrac{e^{ix}+e^{-ix}}{2})}{1-2r(\dfrac{e^{ix}+e^{-ix}}{2})+r^{2}}=\dfrac{1-r(\dfrac{e^{ix}-e^{-ix}}{2})}{1-re^{ix}-re^{-ix}+r^2}$$
Then from this thread, I have learnt how to factorize the denominator (See Jack D'Aurizio answer, first answer of the thread, first line). The trick is to write $1=e^0$.


*$$\dfrac{1-r(\dfrac{e^{ix}+e^{-ix}}{2})}{(re^{ix})(r-e^{-ix})}$$


*The third step is to decompose the fraction:

$$\dfrac{A}{r-e^{ix}}+\dfrac{B}{r-e^{-ix}}=\dfrac{1-r(\dfrac{e^{ix}+e^{-ix}}{2})}{(r-e^{ix})(r-e^{-ix})}$$
$$A(r-e^{-ix})+B(r-e^{ix})=1-r(\dfrac{e^{ix}+e^{-ix}}{2})$$
I am stuck here, I notice that let $x=0$, we will have
$$A(r-1)+B(r-1)=1-r(\dfrac{e^{ix}+e^{-ix}}{2})$$
I am stuck here, I don't know to find $A$ and $B$
Also, could you provide in details how to finish the part "expand the parts as geometric series, and convert from exponential functions back to trigonometric functions (Euler’s identity again)".
My symbolic manipulation skill is not very good, so a detailed answer is great!
Thanks!
 A: There is possibly a better way, and I think this was discussed as solved example in tristam needham's book(*). Any who, we begin with geometric series:
$$ \frac{1}{1-x} = \sum_{j=0}^{\infty} x^j$$
Sub: $ x  \to re^{ i \theta}$ and simplfy
$$ \frac{1}{(1- r \cos \theta) - i \sin \theta} = \sum_{j=0}^{\infty} r^j e^{i j\theta} \tag{2}$$
For LHS, by multiplying with complex conjguate
$$ \frac{1}{(1-r \cos \theta) - i r\sin \theta} =  \frac{ (1-r \cos \theta) + i \sin \theta}{ 2 - 2 r \cos \theta+r^2} \tag{1}$$
Equating real part in (1) to real part in (2),
$$ \frac{1 - r \cos \theta}{ 2 - 2r \cos \theta + r^2} = \sum_{j=0}^{\infty} r^j \cos j \theta$$
Done!
Another identity could be made by equating imaginary parts
*: Indeed it was! See page-78, 79 of Visual Complex Analysis to see how this is simply the fourier series corresponding to the geometric series. Simply two ways to view a function: As an infinite trignometric sum or as a infinite polynomial series. Pretty neat.
A: Similar to Buraian's answer, a method I enjoy using is using the equivalent series for $\sin$, and then adding $C+iS$, as follows:
Let
$$\begin{align}
C&=1+r\cos x+r^2\cos2x+r^3\cos3x+\cdots\\
S&=r\sin x+r^2\sin2x+r^3\sin3x+\cdots\\
\end{align}$$
Then
$$\begin{align}
C+iS&=1+r(\cos x+i\sin x)+r^2(\cos 2x+i\sin2x)+r^3(\cos3x+i\sin3x)+\cdots\\
&=1+re^{ix}+(re^{ix})^2+(re^{ix})^3+\cdots\\
&=\frac{1}{1-re^{ix}}=\frac{(1-re^{-ix})}{(1-re^{ix})(1-re^{-ix})}=\frac{1-r\cos x+ri\sin x}{1-2r\cos x+r^2}
\end{align}$$
Hence, equating real and imaginary parts we obtain
$$\begin{align}
C&=\frac{1-r\cos x}{1-2r\cos x+r^2}\\
S&=\frac{r\sin x}{1-2r\cos x+r^2}\\
\end{align}$$
I hope that was helpful and gives you a new and interesting method for attacking these sorts of problems.
A: $\cos(nx)=2\cos(x)\cos((n-1)x)-\cos((n-2)x)$, then $$\sum_{n=1}^\infty r^n\cos(nx)=2\cos(x)\sum_{n=1}^\infty r^n\cos((n-1)x)-\sum_{n=1}^\infty r^n \cos((n-2)x) $$
$$
=2r\cos(x)\sum_{n=0}^\infty r^n\cos(nx)-r^2\sum_{n=0}^\infty r^n \cos(nx)
$$
Then, after some algebra, $$\sum_{n=1}^\infty r^n\cos(nx)=\frac{r\cos(x)-r^2}{1-2r\cos(x)+r^2}$$
A: I might derive the series from
$$
\frac{1-r \cos (x)}{r^2-2 r \cos (x)+1}
$$
by setting $\cos x = (e^{ix}+e^{-ix})/2 = (z+z^{-1})/2$ with $z=e^{ix}$.
Then
$$
\eqalign{
  \frac{1-r \cos (x)}{r^2-2 r \cos (x)+1} &= 
  \frac{r z^2+r-2 z}{2 (r-z) (r z-1)} =
  \frac{1}{2}\left(1+\frac{r/z}{(1-r/z)}+\frac{1}{(1-r z)}\right) \cr
 &= \frac{1}{2}\left(2+\frac{r/z}{(1-r/z)}+\frac{r/z}{(1-r z)}\right) =
  \frac{1}{2}\left(2+\sum_{n=1}^{\infty}{(r/z)^n}+\sum_{n=1}^{\infty}{(r z)^n}\right) \cr
 &= 1+\sum_{n=1}^{\infty}{z^n+1/z^n\over2} {r^n} =
  1+\sum_{n=1}^\infty r^n \cos nx \ \ \text{or}\ \sum_{n=0}^\infty r^n \cos nx \,. \cr
}
$$
A: Since$$\begin{align}\frac{1-r(e^{ix}+e^{-ix})/2}{(r-e^{ix})(r-e^{-ix})}&=\frac{A}{r-e^{ix}}+\frac{B}{r-e^{-ix}}\\\implies 1-r(e^{ix}+e^{-ix})/2&=A(r-e^{-ix})+B(r-e^{ix}),\end{align}$$the next step is to consider the $r^0$ and $r^1$ terms separately, giving$$1=-e^{-ix}A-e^{ix}B,\,-(e^{ix}+e^{-ix})/2=A+B.$$Now solve simultaneous equations. You should find$$A=-\frac12e^{ix},\,B=-\frac12e^{-ix}.$$
A: With $1 - 2r\cos x + r^2 = (1-re^{i x})(1-re^{-ix})$
\begin{align} \frac{1-r\cos x}{1-2r\cos x+r^2}
= Re \frac{1}{1-re^{ix}}
= Re\sum_{n=0}^\infty(re^{ix})^n
=1+\sum_{n=1}^{\infty}r^{n}\cos nx
\end{align}
