How to solve $\int_0^\pi \frac{x\sin x}{1+ \sin^2 x}dx$? I have solved
$$\int_0^\pi \frac{x\sin x}{1+ \cos^2 x}dx=\pi^2/4$$. But I cannot solve it with the same way that I used for the upper problem. Can you help me to solve this problem?  
$$\int_0^\pi \frac{x\sin x}{1+ \sin^2 x}dx$$
 A: $$A=\int_{0}^{\pi }\frac{xsinx}{1+sin^2x}dx =\int_{0}^{\pi }\frac{(\pi-x)sin(\pi-x)}{1+sin^2(\pi-x)}dx\\\int_{0}^{\pi }\frac{(\pi-x)sin(\pi-x)}{1+sin^2(\pi-x)}dx\\=\int_{0}^{\pi }\frac{(\pi-x)sin(x)}{1+sin^2(x)}dx\\=\int_{0}^{\pi }\frac{(\pi)sin(x)}{1+sin^2(x)}dx+\int_{0}^{\pi }\frac{(-x)sin(x)}{1+sin^2(x)}dx\\A=\int_{0}^{\pi }\frac{(\pi)sin(x)}{1+sin^2(x)}dx-A\\$$so$$ 2A=\int_{0}^{\pi }\frac{(\pi)sin(x)}{1+sin^2(x)}dx=\pi\int_{0}^{\pi }\frac{sin(x)}{1+sin^2(x)}dx$$now aplly this u=cos x 
du=-sinx dx $$\int_{}^{ }\frac{sin(x)}{1+sin^2(x)}dx=\\\int_{}^{}\frac{sinx }{1+1-cos^2x}dx=\\\int_{}^{}\frac{-du }{2-u^2}du $$
A: Hint:
$$\begin{align}
I
&=\int_{0}^{\pi}\frac{x\sin{x}}{1+\sin^2{x}}\,\mathrm{d}x\\
&=\int_{0}^{\pi}\frac{(\pi-x)\sin{(\pi-x)}}{1+\sin^2{(\pi-x)}}\,\mathrm{d}x\\
&=\int_{0}^{\pi}\frac{(\pi-x)\sin{x}}{1+\sin^2{x}}\,\mathrm{d}x\\
\implies 2I&=\int_{0}^{\pi}\frac{x\sin{x}}{1+\sin^2{x}}\,\mathrm{d}x+\int_{0}^{\pi}\frac{(\pi-x)\sin{x}}{1+\sin^2{x}}\,\mathrm{d}x\\
&=\int_{0}^{\pi}\frac{\pi\sin{x}}{1+\sin^2{x}}\,\mathrm{d}x\\
\end{align}$$
A: We are going to evaluate the integral
$\displaystyle \int_{0}^{\pi} \frac{x \sin x}{1+\sin ^{2} x} d x \tag*{} $
by substitution, odd and even functions.
Let  $\displaystyle y=x-\frac{\pi}{2},$ then
$\displaystyle \quad \int_{0}^{\pi} \frac{x \sin x}{1+\sin ^{2} x} d x \\$
$\displaystyle=\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{y \cos y}{1+\cos ^{2} y} d y+\frac{\pi}{2}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\cos y}{1+\cos ^{2} y} d y$
$\displaystyle =0+\frac{\pi}{2} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{d(\sin y)}{2-\sin ^{2} y}$
$\displaystyle =-\pi \int_{0}^{1} \frac{d z}{z^{2}-2} \quad \text {, where } z=\sin y$
$\displaystyle =-\frac{\pi}{2\sqrt{2}} \ln \left|\frac{z-\sqrt{2}}{z+\sqrt{2}}\right|_{0}^{1}$
$\displaystyle = \frac{\pi}{\sqrt{2}} \ln (\sqrt{2}+1)$
