<s>[INST] Does the integral $\int_{0}^{\infty} \frac{x^3\,\cos{(x^2-x)}}{1+x^2}$ diverge Does the integral 
$$J:=\int_{0}^{\infty} \frac{x^3\,\cos{(x^2-x)}}{1+x^2}dx $$
diverge ?
If we integrate by parts we find
$$J=\lim_{a\rightarrow +\infty} \frac{a^3}{(1+a^2)(2a-1)}\cos{(a^2-a)} -\\
\int_{0}^{\infty}\sin{(x^2-x)}
\left( \frac{3x^2}{(1+x^2)(2x-1)}-\\
\frac{2x^4}{(1+x^2)^2(2x-1)}-\frac{2x^3}{(1+x^2)(2x-1)^2}\right)dx$$
If we integrate by parts again, we find that the latter integral reduces to 
a sum of absolutely convergent integrals plus
the boundary term
$$ -\lim_{a\rightarrow +\infty}\,
\cos{(a^2-a)}\left(\frac{3a^2}{(1+a^2)(2a-1)^2}
-\\
\frac{2a^4}{(1+a^2)^2(2a-1)^2}-\frac{2a^3}{(1+a^2)(2a-1)^3}
\right)=0.$$
So the question simplifies to the existence of the limit
$\lim_{a\rightarrow +\infty} \frac{a^3}{(1+a^2)(2a-1)}\cos{(a^2-a)}$ which I believe does not exist. 
Correct ?
 [/INST] Also you can do that: an improper integral $\lim_{r\to\infty}\int_0^r f(x)\, dx$ converges if and only if for each $\epsilon>0$ there is some $M>0$ such that $\left|\int_a^b f(x)\, dx\right|<\epsilon$ for all pairs $a,b\ge M$.
Now note that $\cos(x)\ge\sqrt 2/2$ when $x\in(-\pi/4+2k\pi,\pi/4+2k\pi)$ for any $k\in\Bbb Z$. Now observe that
$$x^2-x=\alpha\,\text{ and }\, x,\alpha>0\implies x=\frac{1+\sqrt{1+4\alpha}}2$$
Now for $\alpha=2\pi n\pm\pi/4$ we set $a_{n\pm}:=\frac12(1+\sqrt{1+\pi(4n\pm 1)})$ and in your case you have that
$$\begin{align}I_n&:=\left|\int_{a_{n-}}^{a_{n+}}f(x)\, dx\right|\ge\frac{\sqrt2}2\int_{a_{n-}}^{a_{n+}}\frac{x^3}{1+x^2}\, dx\\
&\ge\frac{\sqrt 2}2\cdot(a_{n+}-a_{n-})\min_{x\in[a_{n-},a_{n+}]}\frac{x}2,&\text{because }\frac{x^3}{1+x^2}\ge \frac{x}2\text{ when }x\ge 1\\
&=\frac{\sqrt 2}2(a_{n+}-a_{n-})\cdot\frac{a_{n+}+a_{n-}}{a_{n+}+a_{n-}}\cdot\frac{a_{n-}}2\\
&\ge\frac{\sqrt 2}2\cdot\frac{a^2_{n+}-a^2_{n-}}{2a_{n+}}\cdot\frac{a_{n-}}2,&\text{ because } 2a_{n+}\ge a_{n-}+a_{n+}\\
&\ge\frac{\pi\sqrt 2}{16}\cdot\sqrt{\frac{1+\pi(4n-1)}{1+\pi(4n+1)}}\end{align}$$
Hence $\lim_{n\to\infty}I_n\ge\pi\sqrt 2/16$, so we can conclude that the integral doesn't converge.
</s>