A problem on calculating integral Show that the integral $$\int_{0}^{1} \frac{1}{x} \left|\cos \frac{1}{x^2}\right|\ dx$$
is finite.
I plotted the graph, but it looks like it is infinity. 
 A: We prove the claim: $\int_0^1\frac{1}{x}\left\vert \cos\frac{1}{x^2}\right\vert dx=+\infty$.
Indeed, the change of variables $x=1/\sqrt{u}$ shows that
$$
\int_0^1\frac{1}{x}\left\vert \cos\frac{1}{x^2}\right\vert dx=\frac{1}{2}
\int_1^\infty\frac{|\cos u|}{u}du\leq+\infty
$$
This last integral is $+\infty$. Indeed, we can compare it with a series as follows
$$\eqalign{
\int_1^{\pi n}\frac{|\cos u|}{u}du&\geq\sum_{k=1}^{n-1}\int_{k\pi}^{\pi(k+1)}\frac{|\cos u|}{u}du\geq\sum_{k=1}^{n-1}\int_{k\pi}^{\pi(k+1)}\frac{|\cos u|}{\pi(k+1)}du\cr
&\geq\left(\frac{1}{\pi}\int_0^\pi|\cos u|du\right)\left(\sum_{k=2}^n\frac{1}{k}\right)
}
$$
Thus, $\lim\limits_{n\to\infty}\int_1^{\pi n}\frac{|\cos u|}{u}du=+\infty$. This proves our claim.
A: Intuitively, as $x \to 0$, the $\cos^2$ term oscillates very rapidly between $0$ and $1$.  If you "average it out" to $\frac 12$, the integral becomes $\int_0^1 \frac 1{2x}dx=\frac 12 \log x|_0^1$, which is infinite as you say.  
To make this more rigorous, you can find the intervals where $|\cos \frac 1{x^2}| \ge \frac 12$, replace the $\cos$ term with $0$ where it is less than $\frac 12$ and by $\frac 12$ where it is greater.  This will decrease the integral.  Now show the modified version diverges and you are there.
