Compute$$ \int_{0}^{\pi} \frac{x \sin x}{1+\sin ^{2} x} d x . $$
We use the example from the introduction for the particular function $f(x)=\frac{x}{1+x^{2}}$ to transform the integral into$$ \pi \int_{0}^{\frac{\pi}{2}} \frac{\sin x}{1+\sin ^{2} x} d x . $$This is the same as$$ \pi \int_{0}^{\frac{\pi}{2}}-\frac{d(\cos x)}{2-\cos ^{2} x}, $$which with the substitution $t=\cos x$ becomes$$ \pi \int_{0}^{1} \frac{1}{2-t^{2}} d t=\left.\frac{\pi}{2 \sqrt{2}} \ln \frac{\sqrt{2}+t}{\sqrt{2}-t}\right|_{0} ^{1}=\frac{\pi}{2 \sqrt{2}} \ln \frac{\sqrt{2}+1}{\sqrt{2}-1} . $$