Integrate $\int_0^\pi{{x\sin x}\over{1+\cos^2x}}dx$. Integrate $\displaystyle \int \limits_0^\pi{{x\sin x}\over{1+\cos^2x}}dx$. I tried substituting $t=\cos x$, and then integrate with integration by parts. It got all messy... Thanks in advance for any help! 
 A: Integration by parts is worth a try:
$$
\begin{align}
\int_0^\pi\frac{x\sin(x)}{1+\cos^2(x)}\,\mathrm{d}x
&=-\int_0^\pi\frac{x}{1+\cos^2(x)}\,\mathrm{d}\cos(x)\\
&=-\int_0^\pi x\,\mathrm{d}\arctan(\cos(x))\\
&=-\pi\left(-\frac\pi4\right)+\int_0^\pi\arctan(\cos(x))\,\mathrm{d}x\\
&=\frac{\pi^2}{4}+\int_{-\pi/2}^{\pi/2}\arctan(\sin(x))\,\mathrm{d}x\\
&=\frac{\pi^2}{4}
\end{align}
$$
Since $\cos(x)=\sin(\pi/2-x)$ and then $\arctan(\sin(x))$ is an odd function.
A: Let 
$I =\displaystyle \int \limits_0^\pi{{x\sin x}\over{1+\cos^2x}}dx$.
Substitute $t=\pi - x$.
Note that sin($\pi - x$) = sin($x$), and cos($\pi - x$) = -cos($x$).
You will notice that;
$I = \text{"something to integrate using your original substitution"} - I$
A: If you use this substitution $u=x-\frac{\pi}{2}$, it is much easier to get the answer. In fact
\begin{eqnarray*}
\int_0^\pi\frac{x\sin x}{1+\cos^2x}dx&=&\int_{-\pi/2}^{\pi/2}\frac{(u+\frac{\pi}{2})\cos u}{1+\sin^2u}dx\\
&=&\int_{-\pi/2}^{\pi/2}\frac{u\cos u}{1+\sin^2u}du+\frac{\pi}{2}\int_{-\pi/2}^{\pi/2}\frac{\cos u}{1+\sin^2u}du\\
&=&\frac{\pi}{2}\int_{-\pi/2}^{\pi/2}\frac{d\sin u}{1+\sin^2u}\\
&=&\frac{\pi}{2}\int_{-\pi/2}^{\pi/2}\frac{d\sin u}{1+\sin^2u}\\
&=&\frac{\pi}{2}\arctan(\sin u)\big|_{-\pi/2}^{\pi/2}\\
&=&\frac{\pi^2}{4}.
\end{eqnarray*}
Here we use the facts that if $f(u)$ is an odd function in $(-a,a)$, then
$$ \int_{-a}^af(u)du=0. $$
Clearly $\frac{u\cos u}{1+\sin^2u}$ is an odd function.
A: Hint: $\int_0^af(x)dx=\int_0^af(a-x)dx$ Use this to simplify it and then do what you were trying.
Edit:
ohad asked why $\int_0^af(x)dx=\int_0^af(a-x)dx$ is true. This follows from making the substitution $t=a-x$, So, $\int_0^af(x)dx=-\int_a^0f(a-t)dt=\int_0^af(a-x)dx$.
One can also look at it geometrically, by taking the same area under the curve and starting from a instead of 0.
A: Ohad, you can actually prove it. We want to prove $$\int_{0}^{a} f(x) \ dx = \int_{0}^{a} f(a-x) \ dx$$
To do this, do the following:


*

*Put $t= a-x$. Then you actually have $dx=  -dt$. 

*Your new integral then becomes $\displaystyle\int_{a}^{0} -f(a-t) \ dt$
A: $$
\begin{aligned}
\because \int_{0}^{\pi} \frac{x \sin x}{1+\cos ^{2} x} d x &=\int_{0}^{\pi} \frac{(\pi-x) \sin x}{1+\cos ^{2} x} d x \\
&=\pi \int_{0}^{\pi} \frac{\sin x d x}{1+\cos ^{2} x}-\int_{0}^{\pi} \frac{x \sin x}{1+\cos ^{2} x} d x \\
&=-\pi\left[\tan ^{-1}(\cos x)\right]_{0}^{\pi}-I \\
\therefore \int_{0}^{\pi} \frac{x \sin x}{1+\cos ^{2} x} d x&=-\frac{\pi}{2}\left(-\frac{\pi}{4}-\frac{\pi}{4}\right) \\
&=\frac{\pi^{2}}{4}
\end{aligned}
$$
