<s>[INST] Calculate integral $ \int_{0}^{+\infty} \frac{x - \sin{\left(x \right)}}{x^{3}}\, dx $ using the Dirichlet integral I try to calculate the integral:
$$ \int_{0}^{+\infty} \frac{x - \sin{\left(x \right)}}{x^{3}}\, dx, $$
using the Dirichlet integral
$$ \int\limits_0^{+\infty} \frac{\sin \alpha x}{x}\,dx = \frac{\pi}{2}\mathrm{sgn}\,\alpha. $$
I integrate this integral in parts, but I can't substitute the limits of integration because the limit is infinity.
 [/INST] $$\int\frac{x-\sin (x)}{x^3}\,dx=\int\frac{1}{x^2}\,dx-\int\frac{\sin (x)}{x^3}\,dx=$$
$$=-\frac{1}{x}-\int\frac{\sin (x)}{x^3}\,dx$$
by parts
$$\int\frac{\sin (x)}{x^3}\,dx=-\frac{\sin (x)}{2 x^2}-\int -\frac{\cos (x)}{2 x^2} \, dx=$$
again by parts
$$=-\frac{\sin (x)}{2 x^2}-\left(\frac{\cos (x)}{2 x}-\int -\frac{\sin (x)}{2 x} \, dx\right)=$$
$$=-\frac{\sin (x)}{2 x^2}-\frac{\cos (x)}{2 x}-\int \frac{\sin (x)}{2 x} \, dx$$
And finally
$$\int\frac{x-\sin (x)}{x^3}\,dx=-\frac{1}{x}+\frac{\sin (x)}{2 x^2}+\frac{\cos (x)}{2 x}+\int \frac{\sin (x)}{2 x} \, dx$$
the improper integral becomes
$$\int_0^{\infty } \frac{x-\sin (x)}{x^3} \, dx=\left[-\frac{1}{x}+\frac{\sin (x)}{2 x^2}+\frac{\cos (x)}{2 x}\right]_0^{\infty}+\int_0^{\infty } \frac{\sin (x)}{2 x} \, dx=$$
$$=\underset{M\to \infty }{\text{lim}}\left(\frac{\sin (M)}{2 M^2}+\int_0^M \frac{\sin (x)}{2 x} \, dx-\frac{1}{M}+\frac{\cos (M)}{2 M}\right)-\underset{M\to 0}{\text{lim}}\left(\frac{\sin (M)}{2 M^2}+\int_0^M \frac{\sin (x)}{2 x} \, dx-\frac{1}{M}+\frac{\cos (M)}{2 M}\right)$$
first limit gives $\frac{\pi }{4}$.
Second limit is zero because obviously $\int_0^0 \frac{\sin (x)}{2 x} \, dx=0$,
furthermore
$$\underset{M\to 0}{\text{lim}}\frac{-2 M+\sin (M)+M \cos (M)}{2 M^2}=\underset{M\to 0}{\text{lim}}\frac{\frac{\sin (M)}{M}^*+\cos (M)-2}{2 M}=$$
$$=\underset{M\to 0}{\text{lim}}\frac{\cos (M)-1}{2 M}=^{**}\underset{M\to 0}{\text{lim}}-\frac{\sin (M)}{2}=0$$

$^*$ fundamental limit $\frac{\sin (M)}{M}\to 1$ as $M\to 0$
$^{**}$ L'Hopital rule
</s>