# Problem when integrating $e^x / x$.

I made up some integrals to do for fun, and I had a real problem with this one. I've since found out that there's no solution in terms of elementary functions, but when I attempt to integrate it, I end up with infinite values. Could somebody point out where I go wrong?

So, I'm trying to determine: $$\int{\frac{e^x}{x}} \, dx$$

Integrate by parts, where $u = 1/x$, and $v \, ' = e^x$. Then $u \, ' = - 1/x^2$, and $v=e^x$. So,

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \int{\frac{e^x}{x^2}} \, dx$$

Integrate by parts again, $u = 1/x^2$, $v \, ' = e^x$, so that $u \, ' = -2/x^3$ and $v=e^x$. So,

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + 2\int{\frac{e^x}{x^3}} \, dx$$

Repeat this process ad infinitum to get,

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + 2 \left( \frac{e^x}{x^3} + 3 \left( \frac{e^x}{x^4} + 4 \left( \frac{e^x}{x^5} + \, \cdots \right) \right) \right)$$

Expanding this gives,

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + \frac{2e^x}{x^3} + \frac{6 e^x}{x^4} + \frac{24 e^x}{x^5} + \cdots$$

And factoring that gives,

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left( 1 + \frac{1}{x} + \frac{2}{x^2} + \frac{6}{x^3} + \frac{24}{x^4} + \cdots \right)$$

Now, considering the series itself, the ratio between the $n^{th}$ term and the $(n-1)^{th}$ term = $\Large \frac{n}{x}$. Eventually, $n$ will be larger than $x$, so the ratio between successive terms will be positive, so (assuming $x$ is positive), the series diverges, meaning (and I'm sure everybody will cringe upon seeing notation used like this), that:

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left( \infty \right) = \infty$$

-
It looks as if you have discovered an asymptotic expansion. There are divergent series such that if one is sensible and cuts off early, one gets a good approximation, but if you go too far, there is trouble. Such things are even useful! – André Nicolas Dec 5 '12 at 20:33

This part looks right:

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} + \frac{e^x}{x^2} + \frac{2e^x}{x^3} + \frac{6 e^x}{x^4} + \frac{24 e^x}{x^5} + \cdots+ \frac{n!e^x}{x^{n+1}}+(n+1)!\int \frac{e^x}{x^{n+1}}$$

When you say "repeating to infinity" you want to take the limit of that...in order for your equality to hold, you need

$$\lim_n (n+1)!\int \frac{e^x}{x^{n+1}}=0 \,.$$

because that is your error in you partial sum "approximation". But not only the above limit is not 0, it actually makes no sense (an integral is a family of functions, what happens with the constant???).

That's why formally, whenever you use a process like this, you need to prove that the difference between your n-th term and the limit goes to 0...

Your idea is similar to the following

\begin{eqnarray} 1&=&1+1-1\\ &=&1+1+1-2 \\ &=&1+1+1+1-3\\ &=&.... \end{eqnarray}

Taking limit to infinity you get

$$1=1+1+1+...+1+...= \infty$$

On this example you can see immediately that the "errror" in our appoximations don't go to 0, so our approximations are not approximations.

-
Thanks, the example helped a lot. – SiliconCelery Dec 5 '12 at 20:56

There is no elementary antiderivative for you this function.

You can take a look at here: http://en.wikipedia.org/wiki/Exponential_integral

What you have calculated here:

$$\int{\frac{e^x}{x}} \, dx = \frac{e^x}{x} \left( 1 + \frac{1}{x} + \frac{2}{x^2} + \frac{6}{x^3} + \frac{24}{x^4} + \cdots \right)$$ is even something like a taylorexpansion of the integral at $x=\infty$

-
"Like" a Taylor expansion. But divergent for every $x$ ... – GEdgar Dec 5 '12 at 20:37

As André Nicolas said, you've expressed an antiderivative of $e^x/x$ in terms of an asymptotic series! The proof is a little hairy, but the underlying idea is relatively simple, and I hope at least a little of that simplicity shows through in this answer.

An asymptotic expansion of a function $f$ around the point $p$, with respect to the variable $y(x)$, is a formal power series $$a_0 + a_1 y + a_2 y^2 + a_3 y^3 + \ldots$$ whose $n$th partial sum $$\tilde{f}_n(x) = a_0 + a_1 y + \ldots + a_n y^n$$ matches $f$ at $p$ with $o(y^n)$ error. In other words, $$\lim_{x \to p} \frac{f(x) - \tilde{f}_n(x)}{y(x)^n} = 0.$$

As amin discovered, you're dealing with a special function called the exponential integral, defined as the integral $$\operatorname{Ei}(x) = \int_{-\infty}^x \frac{e^u}{u}\;du.$$ The exponential integral is an antiderivative of $e^x/x$. Specifically, it's the antiderivative that goes to zero at $-\infty$. To focus on the power series part of your expression, consider the function $f$ defined by $$\frac{e^x}{x} f(x) = \int_{-\infty}^x \frac{e^u}{u}\;du.$$ Your calculation suggests that $$1 + \frac{1}{x} + \frac{2!}{x^2} + \frac{3!}{x^3} + \ldots$$ is an asymptotic expansion of $f$ around $-\infty$, with respect to the variable $y(x) = 1/x$. Let's prove it.

As N. S. pointed out, the $n$th partial sum of your series differs from $f$ by \begin{align*} f(x) - \tilde{f}_n(x) & = \frac{x}{e^x} (n+1)! \int_{-\infty}^x \frac{e^u}{u^{n+1}}\;du \\ & = x(n+1)! \int_{-\infty}^x \frac{e^{u-x}}{u^{n+1}}\;du \end{align*} Since $u \le x$ over the whole range of the integral, \begin{align*} \left| \int_{-\infty}^x \frac{e^{u-x}}{u^{n+1}}\;du \right| & \le \left| \int_{-\infty}^x \frac{1}{u^{n+1}}\;du \right| \\ & = \tfrac{1}{n+1} \left| \frac{1}{x^{n+2}} \right| \\ & = \tfrac{1}{n+1} \left| y(x)^{n+2} \right|. \end{align*} Therefore, $$\left|f(x) - \tilde{f}_n(x)\right| \le \left|y(x)^{n+1}\right|\,n!.$$ Since $y(x)$ goes to zero as $x$ goes to $-\infty$, it folows that $$\lim_{x \to -\infty} \frac{f(x) - \tilde{f}_n(x)}{y(x)^n} = 0.$$ That means your power series really is an asymptotic expansion of $f$ around $-\infty$, with respect to the variable $y(x)$.

Your asymptotic expression for $\operatorname{Ei}$ near $-\infty$ is cool, but it would be much better if $\operatorname{Ei}$ had a nice, convergent Taylor expansion around $-\infty$, right? As it turns out, $\operatorname{Ei}$ does have a convergent Taylor expansion around $-\infty$, with respect to the variable $y(x) = 1/x$, but this Taylor expansion has a bizarre problem that makes it useless.

The coefficients of the Taylor expansion are given by the derivatives of $\operatorname{Ei}(x)$ with respect to $y(x)$ at $-\infty$. The first derivative is $$\frac{d\operatorname{Ei}}{dy} = \frac{d\operatorname{Ei}}{dx} \frac{dx}{dy} = \frac{e^x}{x} \left(-\frac{1}{y^2}\right) \\ = -\frac{e^{1/y}}{y}.$$ This first derivative is zero at $x = -\infty$. In fact, every derivative $d^n \operatorname{Ei}/dy^n$ is zero at $x = -\infty$. That means the Taylor expansion of $\operatorname{Ei}(x)$ at $-\infty$, with respect to the variable $1/x$, is $$0 + 0\frac{1}{x} + 0\frac{1}{x^2} + 0\frac{1}{x^3} + \ldots$$ This Taylor expansion converges everywhere, as promised. It even converges to $\operatorname{Ei}(x)$ at $-\infty$. Everywhere else, though, it converges to the wrong value: $\operatorname{Ei}(x)$ is strictly negative for $x \in (-\infty, 0)$. In technical terms, we've discovered that the exponential integral is "smooth but not analytic" at $-\infty$. An asymptotic expansion is the best power series expansion you can hope to get for a function like this.

-