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!

  • 2
    $\begingroup$ $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.) $\endgroup$ May 24, 2015 at 21:34
  • $\begingroup$ @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? $\endgroup$
    – myro112
    May 24, 2015 at 21:40
  • 1
    $\begingroup$ @myro112 It exists because $\int_1^zf(x)dx=0$ $\forall$ $z$. $\endgroup$ May 24, 2015 at 21:41

2 Answers 2


$\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


Finally, equating real and imaginary parts yields

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


$$\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}$.


Not the answer you're looking for? Browse other questions tagged .