Consider the following indefinite integral:
$I_n (b) = \int \mathrm{d}x \frac{\sin(nx) \sin(x)}{\cos^2(x)+b^2}$
where $b$ is a constant and $n = 1, 2, 3...$
Is it possible to write the solution in a concise form for any $n$?
The solution for a specific $n$ can be evaluated by Mathematica. For example, the first few evaluations for odd $n$ are (up to a constant):
$I_1 = \frac{\sqrt{1+b^2}}{b} \arctan\left( \frac{b \tan(x)}{\sqrt{1+b^2}}\right) - x$
$I_3 = -\frac{1+5b^2+4b^4}{b \sqrt{1+b^2}} \arctan\left( \frac{b \tan(x)}{\sqrt{1+b^2}}\right) + (3+4b^2)x - \sin(2x)$
$I_5 = \frac{1+13b^2+28b^4+16b^6}{b \sqrt{1+b^2}} \arctan\left( \frac{b \tan(x)}{\sqrt{1+b^2}}\right) - (5+20b^2+16b^4)x + (3+4b^2)\sin(2x) - \tfrac{1}{2}\sin(4x)$
The first few evaluations for even $n$ are:
$I_2 = 2\sqrt{-1-b^2} \arctan\left( \frac{\sin(x)}{\sqrt{-1-b^2}}\right) - 2 \sin(x)$
$I_4 = 4\frac{(1+b^2)(1+2b^2)}{\sqrt{-1-b^2}} \arctan\left( \frac{\sin(x)}{\sqrt{-1-b^2}}\right) + \tfrac{4}{3} \left( 4+ 6b^2 - \cos(2x) \right) \sin(x)$
$I_6 = -2\frac{(1+b^2)(1+4b^2)(3+4b^2)}{\sqrt{-1-b^2}} \arctan\left( \frac{\sin(x)}{\sqrt{-1-b^2}}\right) - \tfrac{2}{15} \left( 63+ 40b^2(7+6b^2) -8(3+5b^2)\cos(2x) + 6 \cos(4x) \right) \sin(x)$
I have not been able to find a pattern leading to a nice solution for general $n$ so far :-(
Any help is much appreciated.