The integral $$\int^{\infty}_0 \frac{\cos x}{1+x}\,\mathrm dx$$ is shown to be equal to $$\int^{\infty}_0 \frac{\sin x}{{(1+x)}^2}\,\mathrm dx$$ through integration by parts. The latter one converges absolutely (i.e the integral still exists if you take the absolute value of the function) as the function is dominated by the function $1/{(1+x)}^2$. But the first integral does not converge absolutely as stated in Rudin "Principles of Mathematical Analysis" ch 6 exercise 9.
Why is it so?
![1]](https://i.stack.imgur.com/rQdEA.png)
By integrating by parts, $$ \int_0^M \frac{\cos x}{x+1}\:dx=\frac{\sin M}{M+1}+\int_0^M \frac{\sin x}{(x+1)^2}\:dx, \quad M\ge0, $$ and letting $M \to \infty$, one has $$ \left|\int_0^\infty \frac{\cos x}{x+1}\:dx\right|=\left|\int_0^\infty \frac{\sin x}{(x+1)^2}\:dx\right|<\int_0^\infty \frac1{(x+1)^2}\:dx<\infty $$ the given integral is then convergent, there is no contradiction with $$ \int_0^M \left|\frac{\cos x}{x+1}\right|\:dx \to \infty $$ as $M \to \infty$, since we have $$ \left|\int_0^M \frac{\cos x}{x+1}\:dx\right| <\int_0^M \left|\frac{\cos x}{x+1}\right|\:dx. $$