# Evaluating: $\lim_{n\to\infty} \int_{0}^{\pi} e^x\cos(nx)\space dx$

Evaluate the limit:

$$\lim_{n\to\infty} \int_{0}^{\pi} e^x\cos(nx)\space dx$$

W|A tells that the limit is $0$, but i'm not sure why is that result or if this is the correct result.

-

Hint: Integrate by parts, letting $u=e^x$ and $dv=\cos nx \,dx$.

To get an explicit antiderivative, you will have to do two cycles of integration by parts. However, for the limit calculation, one cycle will do, and is in a sense more informative.

Added: We get $du=e^x\,dx$ and can take $v=\frac{1}{n}\sin nx$. Since $uv$ vanishes at both ends, we find that $$\int_0^\pi e^x \cos nx \,dx=-\frac{1}{n}\int_0^\pi e^x\sin nx \,dx.$$ But $|e^x\sin nx|\le e^x$.

-
ah. Got it! Thanks. I tried to avoid integration by parts, but it seems it works nice and is very useful in these situations. – OFFSHARING Jun 15 '12 at 20:30
This way works very fast. – OFFSHARING Jun 15 '12 at 20:38

This is a consequence of the much more general Riemann-Lebesgue lemma, which (in one version) says that for any $L^1(\mathbb R)$ function $f$ we have $$\lim\limits_{n\to\infty}\int_{-\infty}^\infty f(x)\cos(nx)dx=0.$$ In your case, the function $f$ is $$f(x)=\begin{cases} e^x &\text{if }\; 0\leq x\leq\pi\\ 0 &\text{otherwise} \end{cases}$$ which is certainly in $L^1(\mathbb R)$. This lemma can be proven for characteristic functions of intervals by integrating by parts, then using linearity of integration extended to step functions, and finally proven by using the density of step functions in $L^1(\mathbb R)$.

-
nice. I didn't know of this lemma. Thanks! – OFFSHARING Jun 15 '12 at 20:33
Wasn't the lemma stated with $\sin x$ instead of $\cos x$? – Pedro Tamaroff Jun 15 '12 at 20:46
@PeterTamaroff: It ought to work for either -- and indeed for any periodic function whose integral over one period vanishes. – Henning Makholm Jun 15 '12 at 20:52
@HenningMakholm After posting that came to mind. For example, would it work for $B(\{x\})$, the periodic Bernoulli polynomials? – Pedro Tamaroff Jun 15 '12 at 21:14
@PeterTamaroff The proof I outlined indeed works for "any periodic function whose integral over one period vanishes", since given any interval for sufficiently large $n$ the interval is almost an integer multiple of the period, so the integral over the interval becomes arbitrarily small. – Alex Becker Jun 15 '12 at 21:23

Here's the standard non-integration by parts form of the intergral, using Euler's identity:

\begin{align} \int_0^\pi e^x \cos(nx)\ dx &= \mathfrak{Re}\left(\int_0^\pi e^x e^{inx}\ dx \right) \\ &= \mathfrak{Re}\left(\int_0^\pi e^{(1+in)x}\ dx \right) \\ &= \mathfrak{Re}\left( \left. \frac{1}{1+in}e^{(1+in)x} \right |_0^\pi\right) \\ &= \mathfrak{Re}\left( \left. \frac{1-in}{1+n^2}e^{(1+in)x} \right |_0^\pi\right) \\ \end{align} and it's relatively straightforward to find an explicit form for the latter term using Euler's identity the 'other way', but not even necessary; from here all the exponential terms in $n$ are clearly going to wind up as $\sin(nx)$ and $\cos(nx)$ terms before evaluating, and so they're drowned out by the $O(1/n)$ factor in front of the evaluation.

-
i like to see for each problem a bunch of various solutions. Very short proof. Thanks. – OFFSHARING Jun 15 '12 at 21:01

The intuitive reason why this is true is that successive half-waves of the cosine cancel each other out, since every other half-wave is the negative of its neighbor.

The canceling is not perfect because two neigboring half-waves get multiplied by different parts of the $e^x$ factor. But $e^x$ is continuous, which means that it is "almost constant" when we look only at small $x$ intervals. As $n$ increases, the partial canceling-out of neighboring half-waves takes place across shorter and shorter $x$ intervals, which means the the $e^x$ multipliers become more and more the same between neighboring half-waves.

In the $n\to\infty$ limit, the cancellation becomes perfect.

-
a good explanation! Less formulas! Thanks! :-) – OFFSHARING Jun 15 '12 at 20:55
I was about to write this same intuitive explanation as answer. :) – hkBattousai Jun 15 '12 at 21:16

This might be the more mechanical solution. André's is very clever.

Let $$I(n) =\int_0^\pi e^x \cos nx dx$$

The $nx = u$, we get

$$I(n) =\frac{1}{n} \int_0^{\pi n} e^{u/n} \cos u du$$

$$I(n) =\frac{1}{n} \int_0^{\pi n} e^{\alpha u} \cos u du$$

with $\alpha =1/n$.

We have that

$$\int_0^{\pi n} {{e^{\alpha u}}} \cos udu = \left. {{e^{\alpha u}}\frac{{\alpha \cos u + \sin u}}{{1 + {\alpha ^2}}}} \right|_0^{\pi n} = {e^\pi }\frac{{\cos \pi n + n\sin \pi n}}{{n + \frac{1}{n}}} - \frac{1}{{n + \frac{1}{n}}}$$

So that

$$\int_0^\pi {{e^x}} \cos nxdx = {e^\pi }\frac{{\cos \pi n + n\sin \pi n}}{{{n^2} + 1}} - \frac{1}{{{n^2} + 1}}$$

From this it is evident

$$\mathop {\lim }\limits_{n \to \infty } \int_0^\pi {{e^x}} \cos nxdx = {e^\pi }\mathop {\lim }\limits_{n \to \infty } \frac{{\cos \pi n + n\sin \pi n}}{{{n^2} + 1}} - \mathop {\lim }\limits_{n \to \infty } \frac{1}{{{n^2} + 1}} = 0$$

-
thanks for your proof. – OFFSHARING Jun 15 '12 at 20:43