I wish to calculate
$$I(R)=\int\_0^{2\pi}\frac{\cos(\phi)-R}{1-2R\cos(\phi)+R^2}~\cos(n\phi)~d\phi,$$
where $n\in\mathbb{N}$, $R\in[0,1)$.

Based on trial and error from plugging numbers into [Wolfram alpha](https://www.wolframalpha.com/input?i=integrate+from+0+to+2pi+%28cos%28x%29+-+1%2F3%29*cos%284x%29+%2F+%281-2%2F3*cos%28x%29+%2B+1%2F3%5E2%29) I think the answer is
$$I(R)=\begin{cases}
0, & n=0, \\
\pi R^{n-1}, & n\ge1.
\end{cases}$$
However, I don't know how to show this more rigorously. Do you know how to calculate the above integral, and do you know if my formula is correct?