# Solving $\int\frac{\ln(1+e^x)}{e^x} \space dx$

I'm trying to solve this integral.

$$\int\frac{\ln(1+e^x)}{e^x} \space dx$$

I try to solve it using partial integration twice, but then I get to this point (where $t = e^x$ and $dx = \frac{1}{t} dt$):

$$\int\frac{\ln(1+t)}{t^2} \space dt = \frac{1}{t} \cdot \ln(1+t) - \frac{1}{t} \cdot \ln(1+t) + \int\frac{\ln(1+t)}{t^2} \space dt$$

$$\cdots$$

$$0 = 0$$

What am I doing wrong?

-
Sigh......... You're trying to EVALUATE this integral. "Solve" is the wrong word. – Michael Hardy Jan 8 '12 at 5:08
Sorry for that, English is not my primary language. – Dimme Jan 8 '12 at 5:18
Lots of English-speaking people make the same mistake. It happens frequently here. – Michael Hardy Jan 8 '12 at 5:34

Ok, I think I know what you did wrong. For a particular choice of variable substitutions, doing integration by parts twice will land you back where you started. Notice that you got a true statement ("0=0", which indeed it does) so you haven't done anything wrong in the sense of doing some step incorrectly, but you haven't made any progress in your answer either.

To illustrate, let me define two functions $f(x)$ and $g(x)$ and consider the integral:

$$\int f(x) g(x) dx$$

integration by parts tells us:

$$\int u dv = u v - \int v du$$

which translates to:

$$\int f(x) g(x) dx = f(x) G(x) - \int G(x) f'(x) dx$$

where $G(x)$ is the anti-derivative of $g(x)$ and $f'(x)$ is the derivative of $f(x)$. In the above, I used $u=f(x)$ and $dv = g(x) dx$.

Let's do integration by parts again, but this time using the substitution $u = G(x)$ and $dv = f'(x) dx$. This will yield:

$$\int G(x) f'(x) dx = G(x) f(x) - \int f(x) g(x) dx$$

substitution back in we find:

$$\int f(x) g(x) dx = G(x) f(x) - G(x) f(x) + \int f(x) g(x) dx$$

$$\to \int f(x) g(x) dx = \int f(x) g(x) dx$$ $$\to 0 = 0$$

$0=0$! It sure does!

Integration by parts represents a transformation. By choosing to do it a second time with the choice of variables above it amounts to doing the inverse of the first transformation, yielding the identity transformation.

In order to get an answer to your integral you have to not apply integration by parts twice in the manner you did. Since your question is likely homework, I won't go into how to actually solve your integral but I will tell you that I solved your integral by first using integration by parts and then an application of partial fractions.

Hope that helps!

-
Thanks. I actually managed to solve it with no substitution at all, and didn't need to use partial fractions either. – Dimme Jan 8 '12 at 5:24

Edit:

Your problem is having integrated by parts twice. Doing it one time looks like this:

$$\int \frac{\ln(1+t)}{t^2} \ \mathrm{d}t = -\frac1{t}\ln(1+t) - \int -\frac1{t}\cdot\frac1{1+t} \ \mathrm{d}t = -\frac1{t}\ln(1+t) + \int \frac1{t}\cdot\frac1{1+t} \ \mathrm{d}t$$

That new integral should be evaluated with partial fractions:

$$\int \frac1{t(t+1)} \ \mathrm{d}t = \int \frac1{t}-\frac1{t+1} \ \mathrm{d}t = \ln t - \ln (t+1) + C$$ If you want to check, the result is the following:

$$\int \frac{\ln(1+e^x)}{e^x} \ \mathrm{d}x= x - \ln(1+e^x) - \frac{\ln(1+e^x)}{e^x} + C$$

-

$$\int\frac{\ln(1+e^x)}{e^x} \; dx = \overbrace{\int u\;dv = uv - \int v\;du}^\text{This is integration by parts.}$$ where \begin{align} u & = \ln(1+e^x), \qquad dv =\frac{dx}{e^x} \\ \\ \\ du &= \frac{e^x}{1+e^x}\;dx, \qquad v = \frac{-1}{e^x} \end{align} So \begin{align} & {} \qquad uv - \int v\;du = \frac{\ln(1+e^x)}{e^x} - \int \frac{-dx}{1+e^x} = \frac{\ln(1+e^x)}{e^x} - \int \frac{-e^{-x}\;dx}{e^{-x}+1} \\ \\ \\ & = \frac{\ln(1+e^x)}{e^x} + \int \frac{e^{-x}\;dx}{e^{-x}+1} = \frac{\ln(1+e^x)}{e^x} + \int \frac{dw}{w+1} \\ \\ \\ & = \frac{\ln(1+e^x)}{e^x} + \ln(w+1) + C = \frac{\ln(1+e^x)}{e^x} + \ln(e^{-x}+1) + C. \end{align}

Notice that $$\ln(e^{-x} + 1) = \ln\Big( e^{-x}(1+e^x) \Big) = \ln(e^{-x}) + \ln(1+e^x) = -x + \ln(1+e^x),$$ so the bottom line can be expressed in that form as well.

-