# Find $f$ so that $\int_{1}^{\infty}f(x)dx$ exists, but $\displaystyle \lim_{x\to\infty}f(x)$ does not exist? [duplicate]

I need help finding an example of a function such that $\int_{1}^{\infty}f(x)dx$ converges, but $\displaystyle \lim_{x\to\infty}f(x)$ does not exist.

I was trying to find examples of functions containing some trigonometric function and/or some exponential function, but all the functions I've managed to think of whose improper integral converges also have a well defined limit as $x$ goes to infinity.

I'd appreciate any ideas and hints you might have!

## marked as duplicate by Did real-analysis StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); May 24 '15 at 21:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• $f(x)=1$ if $x$ is an integer, $f(x)=0$ otherwise. (More interesting examples can be obtained by taking "spikes" at the integers whose areas tend to $0$ sufficiently fast.) – David Mitra May 24 '15 at 21:34
• @DavidMitra, I'm not sure that the improper integral exists for your $f$. Could you give me a suggestion on how I would go about proving it does? – myro112 May 24 '15 at 21:40
• @myro112 It exists because $\int_1^zf(x)dx=0$ $\forall$ $z$. – Gregory Grant May 24 '15 at 21:41

## 2 Answers

$\int_1^{\infty}\cos(x^2) dx$ exists but obviously $\lim_{x \to \infty}\cos (x^2)$ does not exist.

Altought not requested in the original post, it is instructive to note that $\int_0^{\infty}\cos(x^2) dx =\frac12 \sqrt{\frac{\pi}{2}}$. This can be easily verified by using contour integration and applying Cauchy's Integral Theorem.

Let $C$ be the contour that consists of $C_1$ along the real axis from $0$ to $R$, $C_2$, the portion of the circle $|z|=R$ that starts at $(R,0)$ and ends at $(r/\sqrt{2},r/\sqrt{2})$, and $C_3$ the line segment that starts at $(r/\sqrt{2},r/\sqrt{2})$ and ends at the origin. Then, Cauchy's Integral Theorem reveals that

$$\oint_C\,e^{-z^2}\,dz=\int_0^R e^{-x^2}dx+\int_0^{\pi/4}e^{-R^2e^{i2\theta}}Re^{i\theta}d\theta-\int_0^R e^{(1+i)^2t^2}(1+i)dt=0$$

The middle integral is easily seen to vanish as $R \to \infty$. Now, simplifying and using $\int_0^{\infty}e^{-x^2}dx=\sqrt{\pi}/2$, we find

$$\int_0^{\infty}e^{-it^2}dt=\frac{\sqrt{\pi}}{2}e^{-i\pi/4}.$$

Finally, equating real and imaginary parts yields

$$\int_0^{\infty}\cos(t^2)dt=\frac12 \sqrt{\frac{\pi}{2}}$$

and

$$\int_0^{\infty}\sin(t^2)dt=\frac12 \sqrt{\frac{\pi}{2}}$$

For an explicit formula, with a nice (?) continuous function, we can use for example $f(x)=\sin(x^2)$. To see that it works, we calculate $$I_M=\int_1^M \sin(x^2)\,dx,$$ and show that $\lim_{M\to\infty} I_M$ exists.

Do the integration using integration by parts, letting $u=\frac{1}{x}$ and $dv=x\sin(x^2)\,dx$. Then $du=-\frac{1}{x^2}\,dx$ and we can take $u=-\frac{1}{2}\cos(x^2)$.

The integral $\int_0^M \frac{\cos x^2}{2x^2}\,dx$ that remains to be looked at has a limit as $M\to\infty$, for the integrand has absolute value $\le \frac{1}{2x^2}$.