Evaluate $\int_0^{\pi } \frac{\cos (x) \sin (2 n x)}{(a+b \sin (x))^2+1} \, dx$

definite integralsintegration

How to prove
\begin{align}
&\int_0^{\pi } \frac{\cos (x) \sin (2 n x)}{(a+b \sin (x))^2+1} \, dx =
\\[5mm]&\!\!\!\!\!
-\frac{1}{b}\pi \sin \left(2 n \tan ^{-1}\left(\sqrt{\frac{s}{2}}\right)\right) \tan ^{2 n}\left(\frac{1}{2} \cos ^{-1}\left(\sqrt{\frac{s}{2 a^2}}\right)\right)
{\Large ?}.
\end{align}

where $s = \sqrt{4a^{2} + t^{2}} – t$ and
$t = -a^{2} + b^{2} + 1$.

Any help will be appreciated.

Best Answer

Well, what can I say?.. G&R references this, where the formula is indeed stated exactly as above.

But it is wrong (you can try it out numerically; I've done it with PARI/GP - it doesn't hold, really).

The correct one would be $\displaystyle\int_0^{\color{red}{2\pi}}\ldots=-\frac{\color{red}{2\pi}\ldots}{b}$. This can be evaluated via the residue theorem, or just using partial fractions and $\displaystyle\int_0^{2\pi}\frac{\sin x\sin nx\,dx}{1-2r\cos x+r^2}=\pi r^{n-1}$. With the original integral, we arrive at \begin{align}\int_0^\pi\frac{\cos x\sin 2nx\,dx}{1-2r\sin x+r^2}&=(-1)^{n-1}\int_{-\pi/2}^{\pi/2}\frac{\sin y\sin 2ny\,dy}{1-2r\cos y+r^2}\\&=(-1)^{n-1}\sum_{k=1}^{\infty}r^{k-1}\int_{-\pi/2}^{\pi/2}\sin ky\sin 2ny\,dy\\&=\frac{\pi}{2}(-1)^{n-1}r^{2n-1}-4n\sum_{k=0}^{\infty}\frac{(-1)^k r^{2k}}{(2k+1)^2-4n^2}\end{align} instead, which I believe is not elementary. [Here, $r\in\mathbb{C}$, $|r|<1$.]