<s>[INST] Help in evaluating integral using elementary methods I have the following integral:
$\int\limits_{0}^{\pi/2}\frac{x\sin x \cos x}{a^2 \cos^2x+ b^2\sin^2x} \ dx$, for $a,b \geq 0$, both not zero.
I have tried several substitutions without any success at all. How can this be tackled?
Thanks.
 [/INST] First we deal with the case $b= a$, then:
$$I(a,a)=\int\limits_{0}^{\pi/2}\frac{x\sin x \cos x}{a^2 \cos^2x+ a^2\sin^2x} \ dx=\frac{1}{a^2} \int\limits_{0}^{\pi/2} x\sin x \cos x dx$$
Now we use integration by parts with:
$$u=x,\qquad dv=\sin x \cos x dx$$
$$v=\int \sin x \cos x dx=\frac{1}{4} \int \sin 2x d2x=-\frac{\cos 2x}{4} $$
$$uv \bigg|_0^{\pi/2}=\frac{\pi}{8}$$
$$I(a,a)=\frac{\pi}{8a^2}+\frac{1}{4a^2} \int\limits_{0}^{\pi/2} \cos 2x ~dx=\frac{\pi}{8a^2}+\frac{1}{8a^2} \int\limits_{0}^{\pi} \cos 2x ~d2x=\frac{\pi}{8a^2}$$

Now we assume $a \neq b$. We use the same method of integration by parts:
$$u=x,\qquad dv=\frac{\sin x \cos x}{a^2 \cos^2x+ b^2\sin^2x} dx$$
Suprisingly, $v$ has a simple form, which I'm not going to derive here, as it can be checked by direct differentiation:
$$v=-\frac{\log \left(a^2+b^2+(a^2-b^2) \cos 2x \right)}{2(a^2-b^2)}$$
$$uv \bigg|_0^{\pi/2}=-\frac{\pi \log \left(2 b^2 \right)}{4(a^2-b^2)} $$
So:
$$I(a,b)=-\frac{\pi \log \left(2 b^2 \right)}{4(a^2-b^2)}+\frac{1}{4(a^2-b^2)}\int\limits_{0}^{\pi}\log \left(a^2+b^2+(a^2-b^2) \cos u \right) du=$$
$$=\frac{\pi \left(\log \left(a^2+b^2\right)- \log \left(2 b^2 \right) \right)}{4(a^2-b^2)}+\frac{1}{4(a^2-b^2)}\int\limits_{0}^{\pi}\log \left(1+p \cos u \right) du$$
Where $p=\frac{a^2-b^2}{a^2+b^2}$ and thus $|p|<1$.

Going further, we can expand the logarithm as Taylor series, then express the integrals as Beta function, and then find a closed form for the resulting series. The latter I have done with the help of Wolfram Alpha.
This way turns out to be quite tedious. Maybe it's better to expand the original integral as a series in $p$ right from the start. However, I will write the final answer I obtained (which can be confirmed by numerical experiments):

$$I(a,b)=\int\limits_{0}^{\pi/2}\frac{x\sin x \cos x}{a^2 \cos^2x+ b^2\sin^2x} \ dx= \frac{\pi}{2} \frac{\log (a+b)-\log b- \log 2}{a^2-b^2}$$
$$a \neq b$$


Remark: while the methods here are not completely elementary, neither is this integral. The best way to evaluate integrals like this is contour integration.
</s>