Evaluate $\int_0^{\infty} \frac{1-e^{-ax}}{x e^x} dx$

I found two different approaches, both is giving the same answer.

  1. Fubini: $$ \begin{align} \int_0^{\infty} \frac{1-e^{-ax}}{x e^x} \,dx &= \int_0^{\infty} e^{-x} \int_0^a e^{-xy} \,dy\, dx \\ &= \int_0^a \int_0^{\infty} e^{-x(1+y)}\, dx \,dy \\ &= \int_0^{a} \frac{1}{1+y}\, dy\\ &=\log (a+1) , a>-1 \end{align} $$

  2. Differentiation of the parameter: Denote $\displaystyle K(a) = \int_0^{\infty} \frac{1-e^{-ax}}{x e^x}\, dx$, differentiate w.r.t. $a$. Also, note that $K(0)=0$.

$$ \begin{align} K'(a) &= \int_0^{\infty} \frac{e^{-ax}}{e^x} \,dx\\ &=\int_0^{\infty} e^{-x(a+1)} \,dx\\ &=\frac{1}{a+1}\\ \end{align} $$

Now we integrate back to get $\displaystyle K(a) = \int K'(a) da = \log(a+1), a>-1$

The requirements of the Fubini theorem are that $f(a,x)$ is a measurable function and $(0,a) \times (0,\infty)$ is a measurable set, right?

To differentiate w.r.t. a parameter, we need that $\displaystyle | e^{-x(a+1)}| \le g(x)$ which has to be an integrable function. Here we could have $g(x)=e^{-x}$ for instance.

So my question now is, whether one of the approaches is more correct than the other. I used 1. in an exam, and got a really low score (so I'm surprised).


I have a third approach relying on interchanging summation and integration: $$\begin{array}{rcl} \displaystyle \int_0^{\infty} \frac{1-e^{-ax}}{x e^x} \ \mathrm dx &=& \displaystyle \int_0^{\infty} \frac{-1}{x e^x} \sum_{n=1}^{\infty} \frac{(-ax)^n}{n!} \ \mathrm dx \\ &=& \displaystyle \int_0^{\infty} \sum_{n=0}^{\infty} (-1)^{n} \frac{a^{n+1}}{(n+1)!} x^n e^{-x} \ \mathrm dx \\ &=& \displaystyle \sum_{n=0}^{\infty} \int_0^{\infty} (-1)^n \frac{a^{n+1}}{(n+1)!} x^n e^{-x} \ \mathrm dx \\ &=& \displaystyle \sum_{n=0}^{\infty} (-1)^n \frac{a^{n+1} n!}{(n+1)!} \\ &=& \displaystyle \sum_{n=0}^{\infty} (-1)^n \frac{a^{n+1}}{n+1} \\ &=& \displaystyle \sum_{n=0}^{\infty} \int_0^a (-x)^n \ \mathrm dx \\ &=& \displaystyle \int_0^a \sum_{n=0}^{\infty} (-x)^n \ \mathrm dx \\ &=& \displaystyle \int_0^a \frac{1}{1-(-x)} \ \mathrm dx \\ &=& \displaystyle \int_0^a \frac{1}{1+x} \ \mathrm dx \\ &=& \displaystyle \log(1+a) \end{array}$$ provided that $a>-1$.

Which one is more correct?

As long as you have shown that the function in concern is absolutely integrable with a finite integral, all three methods are justified.

I used 1. in an exam, and got a really low score

It is best if you ask your teacher why you got a low score, instead of complaining here. I cannot make a guess for you, as this would be unfair for the teacher.