Compute $\int_0^\pi\frac{\cos nx}{a^2-2ab\cos x+b^2}\, dx$ 
How to compute the following integral
  \begin{equation}
\int_0^\pi\frac{\cos nx}{a^2-2ab\cos x+b^2}\, dx
\end{equation}

I have been given two integral questions by my teacher. I cannot answer this one. I have also searched the similar question here but it looks like nothing is similar so I think this is not a duplicate. I could compute the integral if 
\begin{equation}
\int_0^\pi\frac{dx}{a^2-2ab\cos x+b^2}
\end{equation}
The $\cos nx$ part makes the integral is really difficult. I want to use the result to compute this integral (the real question given by my teacher)
\begin{equation}
\int_0^\pi\frac{x^2\cos nx}{a^2-2ab\cos x+b^2}\, dx
\end{equation}
My question is how to compute the first integral (in the grey-shaded part) preferably with elementary ways (high school methods)? 

I don't have a proof yet, but with some computer assistance, this is what I believe to be the answer when $n$ is a non-negative integer.
\begin{align*}
  \int_0^\pi\frac{\cos nx}{a^2-2ab\cos x+b^2}\, dx &= \frac{\displaystyle \left(\left(a^{2n}+b^{2n}\right)\, \left(\Big\lvert \frac{a+b}{a-b}\Big\rvert +1\right)-2\, \sum_{k=0}^{2n}a^k\, b^{2n-k}\right)\, \pi}{\displaystyle 2\, a^n\, b^n\, (a+b)^2}
\end{align*}
I think there might be a reduction formula for this, but at the moment I don't know.
