TITLE: Prove $\int_{0}^{2\pi}{x\sin^3(x)\over 1+\cos^2(x)}dx=2\pi-\pi^2$
QUESTION [8 upvotes]: Integrate 

$$I=\int_{0}^{2\pi}{x\sin^3(x)\over 1+\cos^2(x)}dx=2\pi-\pi^2$$

$${1\over 1+y}=\sum_{n=0}^{\infty}(-1)^ny^n$$
Setting $y=\cos(x)$
$\sin^3(x)={1\over 4}{(3\sin(x)-\sin(3x))}$
Substitute into I
$$I=\sum_{n=0}^{\infty}{(-1)^n\over 4}\int_{0}^{2\pi}x\sin^3(x)\cos^{2n}(x)dx$$
$$I=\sum_{n=0}^{\infty}{(-1)^n\over 4}\int_{0}^{2\pi}x\sin(x)\cos^{2n}(x)-x\sin(3x)\cos^{2n}(x)dx$$
Let $$J=\int_{0}^{2\pi}x\sin(x)\cos^{2n}(x)dx$$
Recall $$\int_{0}^{2\pi}\sin(x)\cos^{2n}(x)dx=0$$
$$\int_{0}^{2\pi}\cos^{2n+1}(x)dx=0$$
Applying by parts
$$J=\left.-x{\cos^{2n+1}\over 2n+1}\right|_{0}^{2\pi}-{1\over 2n+1}\int_{0}^{2\pi}\cos^{2n+1}(x)dx$$
$$J={1-2\pi\over 1+2n}$$
Let $$K=\int_{0}^{2\pi}x\sin(3x)\cos^{2n}(x)dx$$
$$\sin(3x)=3\sin(x)\cos^2(x)-\sin^3(x)$$
Substitute into K
$$K=\int_{0}^{2\pi}3x\sin(x)\cos^{2n+2}(x)-x\sin^3(x)\cos^{2n}(x)dx$$
Let $$L=3\int_{0}^{2\pi}x\sin(x)\cos^{2n+2}(x)dx$$
Applying by parts
$$L=\left.-3x{\cos^{2n+3}(x)\over n+1}\right|_{0}^{2\pi}-{1\over n+1}\int_{0}^{2\pi}\cos^{2n+3}dx$$
$$L={3-6\pi\over n+1}$$
Let $$M=\int_{0}^{2\pi}x\sin^3(x)\cos^{2n}(x)dx$$
Integrate M it is tedious. Anyway can someone show me another easy method to tackle integral $I$? Thank you.

REPLY [2 votes]: Suppose we seek to evaluate
$$J = \int_0^{2\pi} \frac{x\sin^3 x}{1+\cos^2 x} dx
= \int_0^{2\pi} \frac{x\sin x (1-\cos^2 x)}{1+\cos^2 x} dx
\\ = \int_0^{2\pi} \frac{x\sin x (-1-\cos^2 x)}{1+\cos^2 x} dx
+ 2\int_0^{2\pi} \frac{x \sin x}{1+\cos^2 x} dx
\\ = - \int_0^{2\pi} x\sin x dx
+ 2\int_0^{2\pi} \frac{x \sin x}{1+\cos^2 x} dx
\\ = [x\cos x - \sin x]_0^{2\pi}
+ 2\int_0^{2\pi} \frac{x \sin x}{1+\cos^2 x} dx
\\ =  2\pi + 2\int_0^{2\pi} \frac{x \sin x}{1+\cos^2 x} dx
= 2\pi + 2K.$$
Put  $z   =  \exp(ix)$  so  that   $dz  =  i\exp(ix)   dx$  and  hence
$\frac{dz}{iz} = dx$ to obtain
$$\int_{|z|=1}
\frac{(z-1/z)\log(z)/i/(2i)}{1+(z+1/z)^2/4} \frac{dz}{iz}
\\ = - \frac{2}{i} \int_{|z|=1}
\frac{(z-1/z)\log(z)}{4+(z+1/z)^2} \frac{dz}{z}
\\ = - \frac{2}{i} \int_{|z|=1}
\frac{(z^2-1)\log(z)}{4z^2+(z^2+1)^2} dz.$$
Call the  integrand without  the scalar $f(z).$  The integral  must be
purely imaginary because $K$ is real. Now the contour here is a circle
$\Gamma_0$   of  radius   one   starting  at   $z=1$   and  making   a
counterclockwise turn around the  center at the origin until returning
to just below $z=1$. The branch of the logarithm has the branch cut on
the positive real axis with argument from $0$ to $2\pi$.  We now close
this contour with a line segment $\Gamma_1$ from $0$ to $1$ just above
the real  axis and a  a line segment  $\Gamma_2$ from $1$ to  $0$ just
below  the real  axis,  connected  by a  circle  $\Gamma_3$ of  radius
$\epsilon$ around  the origin, obtaining the  closed contour $\Gamma$.
This is like a keyhole contour  except the large circle does not go to
infinity.  We thus have
$$\int_\Gamma f(z) \; dz = 
2\pi i\sum_\rho \mathrm{Res}_{z=\rho} f(z)$$
where  the  sum  is  over   the  poles  $\rho$  inside  $\Gamma.$
In particular
$$\int_{\Gamma_0} f(z) \; dz = 
- \int_{\Gamma_{1,2}} f(z) \; dz - \int_{\Gamma_3} f(z) \; dz +
2\pi i\sum_\rho \mathrm{Res}_{z=\rho} f(z)$$
The contribution from $\Gamma_1$ and $\Gamma_2$ is
$$\int_0^1 \frac{(x^2-1)\log(x)}{4x^2+(x^2+1)^2} dx
- \int_0^1 \frac{(x^2-1)(\log(x)+2\pi i)}{4x^2+(x^2+1)^2} dx
\\ = - 2\pi i\int_0^1 \frac{x^2-1}{4x^2+(x^2+1)^2} dx.$$
Call this integrand  $g(z).$ The poles here are  at $$\rho_{0,1,2,3} =
\pm i(\sqrt{2}\pm 1).$$ We have
$$g(z) = \sum_\rho \frac{1}{z-\rho} \mathrm{Res}_{z=\rho} g(z).$$
Integrating we get
$$\sum_\rho [\log(z-\rho)]_0^1 \mathrm{Res}_{z=\rho} g(z)
= \sum_\rho \log\frac{\rho-1}{\rho} \mathrm{Res}_{z=\rho} g(z).$$
Computing the residues we have
$$\mathrm{Res}_{z=\rho} g(z) = \frac{\rho^2-1}{4\rho^3+12\rho}$$
obtaining
$$i/4 \times \left(\log(+1 + (1+\sqrt{2}) i)
- \log(+1 - (1+\sqrt{2}) i)
\\ + \log(+1 + (1-\sqrt{2}) i)
- \log(+1 - (1-\sqrt{2}) i)\right)
\\ = i/4 \times \log i = i/4\times i \pi/2 = - \frac{\pi}{8}.$$
Moving on to $\Gamma_3$ we get by the ML bound
$$\lim_{\epsilon\rightarrow 0} 2\pi\epsilon\times
\frac{(\epsilon^2-1)\log\epsilon}{4\epsilon^2 + (\epsilon^2+1)^2}
= 0.$$
We are  ready to compute the residues  at the poles of  $f$, which are
the same as  those of $g$, all on the imaginary  axis with the modulus
given by  the scalar  $\sqrt{2}\pm 1.$ We  see that $\rho_{0,1}  = \pm
i(\sqrt{2}-1)$ are inside the contour and the residues are
$$\frac{(\rho_{0,1}^2-1)\log\rho_{0,1}}{4\rho_{0,1}^3+12\rho_{0,1}}$$
which yields
$$- \frac{\pi}{8} + \frac{1}{4} \log(\sqrt{2}-1) i
\quad\text{and}\quad
\frac{3\pi}{8} - \frac{1}{4} \log(\sqrt{2}-1) i.$$
Collecting all the contributions we finally have
$$K = -\frac{2}{i} \times
\left(2\pi i\times -\frac{\pi}{8} + 2\pi i\times\frac{\pi}{4}\right)
= - 2 \times \left(-\frac{\pi^2}{4} + \frac{\pi^2}{2}\right)
= - \frac{\pi^2}{2}.$$
The answer to the problem is thus given by
$$2\pi + 2K = 2\pi - \pi^2$$
as claimed.