Definite integration $\int_{0}^{\pi}\frac{x\sin(x)}{a + \cos^2(x)}\,\mathrm dx$ I am having trouble computing the following definite integral:
$$\int_{0}^{\pi}\frac{x\sin(x)}{a +\cos^2(x)}\,\mathrm dx$$
My approach was to try and pick a very easy value for $a$, and use an identity on the denominator to try and simplify. However, I could not get anywhere with this approach.
 A: HINT: 
As $\displaystyle\int_a^bf(x)\ dx=\int_a^bf(a+b-x)\ dx$
So, if $\int_a^bf(x)\ dx=I,$
$$2I=\int_a^b[f(x)+f(a+b-x)]\ dx$$
Now $\sin(\pi+0-x)=+\sin x,\cos(\pi+0-x)=-\cos x$
Finally set $\cos x=u$
A: If $a\le 0$, then notice that $a+\cos^2x_0 = 0$ for some $x_0\in(0,\pi)$. Near $x_0$, we will have $x\sin x$ being bounded from below (as $x_0\sin x_0\ne 0$ for $x_0\in(0,\pi)$), while $a+\cos^2x$  will be at most linearly large (i.e. $a+\cos^2x = O(x-x_0)$), so $\frac{1}{a+\cos^2x}$ will be at least as large in absolute value as $\frac{1}{|x-x_0|}$ near $x_0$, and hence will not be integrable around $x_0$. Thus, we may assume $a>0$.
We can try integration by parts on the product $x\frac{\sin x}{a+\cos^2x}$. To use integration by parts, it helps to find $\int{\frac{\sin x}{a+\cos^2x}\,dx}$. Using the substitution $u = \cos x$ (so $du = -\sin x\,dx$), the integral becomes $-\int{\frac{1}{a+u^2}\,du}$. For $a>0$ this is equal (up to a constant) to $\frac{1}{\sqrt{a}}\arctan\left(\frac{u}{\sqrt{a}}\right) = -\frac{1}{\sqrt{a}}\arctan\left(\frac{\cos x}{\sqrt{a}}\right)$. Hence, applying integration by parts yields
\begin{align} \int\limits_{0}^{\pi}{x\frac{\sin x}{a+\cos^2 x}\,dx} &= \left(x\left(-\frac{1}{\sqrt{a}}\arctan\left(\frac{\cos x}{\sqrt{a}}\right)\right)\right)\Big|_{0}^{\pi} - \int\limits_{0}^{\pi}{-\frac{1}{\sqrt{a}}\arctan\left(\frac{\cos x}{\sqrt{a}}\right)\,dx} \\
&=-\frac{\pi}{\sqrt{a}}\arctan\left(\frac{-1}{\sqrt{a}}\right) + \frac{1}{\sqrt{a}}\int\limits_{0}^{\pi}{\arctan\left(\frac{\cos x}{\sqrt{a}}\right)\,dx} \\
&=\frac{\pi}{\sqrt{a}}\arctan\left(\frac{1}{\sqrt{a}}\right) + \frac{1}{\sqrt{a}}\int\limits_{0}^{\pi}{\arctan\left(\frac{\cos x}{\sqrt{a}}\right)\,dx}.
\end{align}
Notice that the integrand in the last integral is even around $x = \pi/2$, so the last integral is zero.
