How would you calculate the integral of $\int_{0}^{\infty} \frac{\sin^{2}{x}}{x(x^{2}+1)} dx$

calculusintegration

When I attempted trying to evaluate $$\int_{0}^{\infty} \frac{\sin^{2}{x}}{x(x^{2}+1)} dx$$, I first tried partial fractions to exploit the fact that an inverse tangent might be able to be found, which resulted in two integrals, the first one of which I highly suspect to be integrated using the Leibniz Integral rule, but I have no clue how to evaluate the second part which is $$\int_{0}^{\infty} \frac{x\sin^{2}{x}}{x^{2}+1} dx$$. I then attempted using infinite geometric series but it didn't really go anywhere. Is there something I'm missing here?

Best Answer

$$I=\int\frac{\sin^{2}(x)}{x(x^{2}+1)}\, dx=\frac 12 \int\frac{1-\cos(2x)}{x(x^{2}+1)} \,dx$$ $$I=\frac 12\log (x)-\frac{1}{4} \log \left(x^2+1\right)-\frac 12\int\frac{\cos(2x)}{x(x^{2}+1)}\, dx$$

$$\frac{1}{x(x^{2}+1)}=\frac{1}{x(x+i)(x-i)}=\frac{1}{x}-\frac{1}{2 (x-i)}-\frac{1}{2 (x+i)}$$ So, we face three integrals $$J_a=\int \frac{\cos(2x)}{x+a}\, dx$$ $$x=t-a \quad \implies \quad J_a=\cos(2a)\int \frac{\cos(2t)}{t}\, dt+\sin(2a)\int \frac{\sin(2t)}{t}\, dt$$ and here appear the trigonometric integrals $$\int \frac{\cos(2t)}{t}\, dt=\text{Ci}(2 t)\qquad \text{and} \qquad \int \frac{\sin(2t)}{t}\, dt=\text{Si}(2 t)$$ which, for sure, are related to the exponential integral function (use Euler representation of the sine and cosine function).

Recombine all terms and simplify before using the limits and you will obtain Wolfram Alpha result or some other equivalent formulae.

Edit

The antiderivative is then given by $$8\,e^2\,I(x)=\left(1+e^4\right) \text{Ci}(2 i-2 x)-4 e^2 \text{Ci}(2 x)+e^4 \text{Ci}(2 x+2 i)+$$ $$\text{Ci}(2 x+2 i)+i e^4 \text{Si}(2 i-2 x)-i \text{Si}(2 i-2 x)+$$ $$i e^4 \text{Si}(2 x+2 i)-i \text{Si}(2 x+2 i)-2 e^2 \log \left(x^2+1\right)+4 e^2 \log (x)$$

Which gives $$8\,e^2\,I=-2 (\text{Shi}(2)+\text{Ci}(2 i))+e^4 (-2 \text{Ci}(2 i)+2 \text{Shi}(2)+i \pi )+i \pi +4 e^2 (\gamma +\log (2))$$ which is $$I=\frac{\gamma +\log (2)}{2}-\frac{e^4 \text{Ei}(-2)+\text{Ei}(2)}{4 e^2} $$