Compute $\int_{0}^{\infty} \left( \cos\left(\frac{1}{x}\right)+x\sin\left(\frac{1}{x}\right)-2 \right)dx$

definite integralsintegration

I don't remember how to solve this integral ;_;

I tried $u=\frac{1}{x}$ to format it into a frullani integral, but I ended up having this:
$$\int_{0}^{\infty}\frac{1}{u^2}\left ( \cos(u)+\frac{\sin(u)}{u}-2 \right )du$$

Is there a trig-identity I'm not aware of or is there a better way?

Best Answer

Rewrite the original integrand as

$$I = \int_0^\infty\frac{1}{2}\left(2x\sin\frac{1}{x}-\cos\frac{1}{x}-1\right)+\frac{3}{2}\left(\cos\frac{1}{x}-1\right)\:dx \equiv I_1 + I_2$$

The first one has a direct antiderivative

$$I_1 = \frac{1}{2}\left[x^2\sin\frac{1}{x}-x\right]_0^\infty = 0$$

and the second one can be done with your substitution and the half angle identity

$$I_2 = \frac{3}{2}\int_0^\infty \frac{\cos u - 1}{u^2}du = -\frac{3}{2}\int_0^\infty \frac{2\sin^2 \frac{u}{2}}{u^2}du = \boxed{-\frac{3\pi}{4}}$$

which happens to be the final answer.