# Prove that $\cos(f(x))$ is not Lebesgue-integrable if $\lim_{\lvert x\rvert\to\infty}f(x)=0$.

Let $f\in H^1(\mathbb{R})$ (Sobolev space). Then we have $\lim_{\lvert x\rvert\to\infty}f(x)=0$. I have to prove that this implies that $\cos(f(x))$ is not Lebesgue-integrable, i.e. $$\int_{\mathbb{R}}\lvert \cos(f(x)\rvert\, d\lambda=\infty,$$ where $\lambda$ is the Lebesgue-measure.

I do not know exactly how to prove that.

We have $\lim_{\lvert x\rvert\to\infty}\cos(f(x))=1$ by assumption.

My first vague idea was to choose $\lvert a\rvert$ large enough and to write the integral as

$$\int_R\lvert\cos(f(x))\rvert\, d\lambda=\lim_{z\to\infty}\int_{-a-z}^{-a}\lvert\cos(f(x))\rvert\, d\lambda+\int_{-a}^a\lvert\cos(f(x))\rvert\, d\lambda+\lim_{z\to\infty}\int_a^{a+z}\lvert\cos(f(x))\rvert\, d\lambda$$

Now, can't we compute the first and the last integral as $\approx z$ and then taking the limit $z\to\infty$?

Let us prove that if $\lim \limits _{|x| \to \infty} g(x) = 1$ then $g \notin L^1 (\Bbb R)$ (any other non-zero number could be used instead of $1$).
If $\lim \limits _{|x| \to \infty} g(x) = 1$, then there exist $R>0$ such that for $|x| > R$ we have $|g(x) - 1| < \frac 1 2$ (this comes from the $\varepsilon-\delta$ definition of the concept of limit, with $\varepsilon = \frac 1 2$ and $\delta = R$). This means that for $|x| > R$ we have $-\frac 1 2 < g(x) - 1 < \frac 1 2$, i.e. $\frac 1 2 < g(x) < \frac 3 2$.
$$\int \limits _{\Bbb R} |g(x)| \ \Bbb d x = \int \limits _{|x| \le R} |g(x)| \ \Bbb d x + \int \limits _{|x| > R} |g(x)| \ \Bbb d x \ge \int \limits _{|x| \le R} |g(x)| \ \Bbb d x + \int \limits _{|x| > R} \frac 1 2 \ \Bbb d x = \text{finite} + \infty = \infty ,$$
which shows that $g \notin L^1 (\Bbb R)$. Notice that the only thing used here is that $g$ is locally-integrable (because I have integrated it on $[-R,R]$) - which is clearly true for functions in $H^1 (\Bbb R)$. This means that your statement remains true even for functions in $L^1_{loc} (\Bbb R)$.
Now, take $g = \cos \circ f$ and you are done.