TITLE: Compute $\int_0^{\pi} \frac{\cos(nx)\cos(x) - \cos(nt)\cos(t)}{\cos(x) -\cos(t)}dt$
QUESTION [12 upvotes]: Let $n\in\mathbb{N}$ and $x\in]0,\pi[$, I am asked to calculate the following :
$$ I_n = \int_0^{\pi} \dfrac{\cos(nx)\cos(x) - \cos(nt)\cos(t)}{\cos(x) -\cos(t)}dt$$
From testing on small values of $n$, it seems that this integral is equal to $n\pi\cdot \cos^n(x)$ but I can't seem to prove it. I tried finding a recurrence formula but didn't succeed.
Here is my working for $n=0$, $n=1$ and $n=2$ :
For $n=0$, 
$$ I_0=\int_0^{\pi}\dfrac{\cos(x) -\cos(t)}{\cos(x) - \cos(t)}dt = \pi$$
For $n=1$,
$$ I_1 = \int_0^{\pi} \dfrac{\cos^2(x) -\cos^2(t)}{\cos(x)-\cos(t)}dt=\int_0^{\pi}\cos(x) + \sin(t)dt = \pi\cdot \cos(x)$$
For $n=2$ :
$$ I_2 = \int_0^{\pi} \dfrac{2\cos^3(x) - 2\cos^3(t) -\cos(x) + \cos(t)}{\cos(x) - \cos(t)}dt$$
$$ I_2 = 2\int_0^{\pi}\cos^2(x) +\cos(x)\cos(t) + cos^2(t) dt - \pi$$
$$ I_2 = 2\pi\cos^2(x) + \int_0^{\pi}\cos(2t)+1dt - \pi$$
$$ I_2 = 2\pi\cos^2(x) $$
This is my first post here, please tell me if I did anything wrong. I tried searching this integral on this website without any success.

REPLY [2 votes]: An alternative solution to the problem: 
For $n \in \mathbb{N}$ and $x \in (0,\pi)$ define
$$J_n (x) \equiv \int \limits_0^\pi \frac{\cos(n x) - \cos(n t)}{\cos(x) - \cos(t)} \, \mathrm{d} t \, . $$
We can use the identities ($(2)$ follows from the geometric progression formula)
\begin{align}
\cos(\xi) - \cos(\tau) &= - 2 \sin \left(\frac{\xi + \tau}{2}\right) \sin \left(\frac{\xi - \tau}{2}\right) \, , \, \xi,\tau \in \mathbb{R} \, , \tag{1} \\
\frac{\sin(n y)}{\sin(y)} &= \mathrm{e}^{-\mathrm{i}(n-1)y} \sum \limits_{k=0}^{n-1} \mathrm{e}^{2\mathrm{i} k y} \, , \, n \in \mathbb{N} \, , \, y \in \mathbb{R} \, , \tag{2} \\
\int \limits_0^{2 \pi} \mathrm{e}^{\mathrm{i}(k-l) t} \, \mathrm{d} t &= 2 \pi \delta_{k,l} \, , \, k,l \in \mathbb{Z} \, , \tag{3}
\end{align}
to compute
\begin{align}
J_n (x) &= \frac{1}{2} \int \limits_0^{2\pi} \frac{\cos(n x) - \cos(n t)}{\cos(x) - \cos(t)} \, \mathrm{d} t \stackrel{(1)}{=} \frac{1}{2} \int \limits_0^{2\pi} \frac{\sin \left(n\frac{x+t}{2}\right)}{\sin \left(\frac{x+t}{2}\right)} \frac{\sin \left(n\frac{x-t}{2}\right)}{\sin \left(\frac{x-t}{2}\right)} \, \mathrm{d} t \\
&\stackrel{(2)}{=} \frac{1}{2} \mathrm{e}^{-\mathrm{i} (n-1) x} \sum \limits_{k,l=0}^{n-1} \mathrm{e}^{\mathrm{i} (k+l) x} \int \limits_0^{2 \pi} \mathrm{e}^{\mathrm{i}(k-l) t} \, \mathrm{d} t \stackrel{(3)}{=} \pi \mathrm{e}^{-\mathrm{i} (n-1) x} \sum \limits_{k=0}^{n-1} \mathrm{e}^{2 \mathrm{i} k x} \\
&\stackrel{(2)}{=} \pi \frac{\sin(nx)}{\sin(x)} \, .
\end{align}
This result directly leads to
\begin{align}
I_n(x) &\equiv \int \limits_0^\pi \frac{\cos(n x) \cos(x) - \cos(n t) \cos(t)}{\cos(x) - \cos(t)} \, \mathrm{d} t = \int \limits_0^\pi \left[\cos(x)\frac{\cos(n x) - \cos(n t)}{\cos(x) - \cos(t)} + \cos(n t)\right]\, \mathrm{d} t \\
&= \cos(x) J_n(x) + 0 = \pi \cos(x) \frac{\sin(nx)}{\sin(x)} \, .
\end{align}