Evaluate $\int_{0}^{\infty} \frac{\sin x-x\cos x}{x^2+\sin^2x } dx$

The integral $$\int_{0}^{\infty} \frac{\sin x-x\cos x}{x^2+\sin^2x } dx$$ admits a nice closed form. The question is: How to evaluate it by hand.

• Substitute $u = x\csc(x)$. Jul 21 '19 at 2:30
• Are you sure it converges? Jul 21 '19 at 2:36
• The integral is imroper but it is convergent, one has to take limit of the anti-derivative as $x \rightarrow \infty$. Jul 21 '19 at 2:55

$$I=\int_{0}^{\infty} \frac{\sin x-x \cos x}{x^2+\sin^2 x} dx= - \int_{0}^{\infty}\frac{\frac {x\cos x -\sin x}{x^2}}{1+(\frac{\sin x}{x})^2}dx= -\int_{1}^{0} \frac{dt}{1+t^2}=\frac{\pi}{4}.$$
• Isn't $-\int_0^\infty\frac{\mathrm{d}t}{1+t^2}=-\frac\pi2$? The integral should be $-\int_1^0\frac{\mathrm{d}t}{1+t^2}$.
Note that \begin{align} \frac{\mathrm{d}}{\mathrm{d}x}\log(x-i\sin(x)) &=\frac{1-i\cos(x)}{x-i\sin(x)}\\ &=\frac{x+\sin(x)\cos(x)}{x^2+\sin^2(x)}+i\frac{\sin(x)-x\cos(x)}{x^2+\sin^2(x)} \end{align} Taking the imaginary part of both sides \begin{align} \frac{\mathrm{d}}{\mathrm{d}x}\frac1{2i}\log\left(\frac{x-i\sin(x)}{x+i\sin(x)}\right) &=\frac{\sin(x)-x\cos(x)}{x^2+\sin^2(x)} \end{align} Thus, $$\int\frac{\sin(x)-x\cos(x)}{x^2+\sin^2(x)}\,\mathrm{d}x =\frac1{2i}\log\left(\frac{x-i\sin(x)}{x+i\sin(x)}\right)+C$$ and \begin{align} \int_0^\infty\frac{\sin(x)-x\cos(x)}{x^2+\sin^2(x)}\,\mathrm{d}x &=-\frac1{2i}\log\left(\frac{1-i}{1+i}\right)\\ &=\frac\pi4 \end{align}
• $\frac1{2i}\log\left(\frac{x-i\sin(x)}{x+i\sin(x)}\right) =-\tan^{-1}\left(\frac{\sin(x)}x\right)$