Evaluating $\int_{0}^{\pi/2}\frac{x\sin x\cos x\;dx}{(a^{2}\cos^{2}x+b^{2}\sin^{2}x)^{2}}$ How to evaluate the following integral
$$\int_{0}^{\pi/2}\frac{x\sin x\cos x}{(a^{2}\cos^{2}x+b^{2}\sin^{2}x)^{2}}dx$$
For integrating I took $\cos^{2}x$ outside and applied integration by parts.
Given answer is $\dfrac{\pi}{4ab^{2}(a+b)}$.
But I am not getting the answer.

The case $a^2=b^2$ being simple, let's just consider, by symmetry, the case $a>b>0$.
Observe that
$$
\partial _x \left(\frac{1}{a^2 \cos^2x+b^2 \sin^2 x}\right)=2(a^2-b^2)\frac{\cos x\sin x}{(a^2 \cos^2x+b^2 \sin^2 x)^2}
$$
then, integrating by parts, you may write
$$
\begin{align}
I(a,b)&=\int_0^{\pi/2}\frac{x\cos x\sin x}{(a^2 \cos^2x+b^2 \sin^2 x)^2} dx\\\\
&=\frac{x}{2(a^2-b^2)}\left.\frac{1}{a^2 \cos^2x+b^2 \sin^2 x}\right|_{0}^{\pi/2}-\frac{1}{2(a^2-b^2)}\int_0^{\pi/2}\frac{dx}{a^2 \cos^2x+b^2 \sin^2 x}\\\\
&= \frac{\pi}{4(a^2-b^2)b^2}-\frac{1}{2(a^2-b^2)}\int_0^{\pi/2}\frac{1}{\left(a^2 +b^2 \large{\frac{\sin^2 x}{\cos^2x}}\right)}\frac{1}{\cos^2 x}dx\\\\
&= \frac{\pi}{4(a^2-b^2)b^2}-\frac{1}{2(a^2-b^2)}\int_0^{\pi/2}\frac{1}{\left(a^2 +b^2 \tan ^2x\right)}(\tan x)'dx\\\\
&= \frac{\pi}{4(a^2-b^2)b^2}-\frac{1}{2(a^2-b^2)}\frac{1}{ab}\left.\arctan \left(\frac ba \tan x \right)\right|_{0}^{\pi/2}\\\\
&= \frac{\pi}{4(a^2-b^2)b^2}-\frac{\pi}{4(a^2-b^2)}\frac{1}{ab}\\\\
&= \frac{\pi}{4(a+b)ab^2}.
\end{align}
$$ 
