# Integration using substitution

1. Apr 21, 2014

### physics604

1. $$\int \frac{1}{1+e^x}\,dx$$

2. Relevant equations

Substitution

3. The attempt at a solution

$$u=1+e^x$$ $$du=e^xdx$$
$$\int \frac{1}{u}\frac{1}{e^x}\,du$$ $$\int \frac{1}{u}\frac{1}{u-1}\,du$$ $$\int \frac{1}{u(u-1)}\,du$$
$$= \ln {|u^2-u|} = \ln {|(1+e^x)-(1+e^x)|} = \ln {|1+2e^x+e^{2x}-1-e^x|} = \ln {|e^2|}$$

There is something obviously wrong with my answer but I don't know what. The answer key says $$x-\ln {(1+e^x)}+C$$ Any help is greatly appreciated!

2. Apr 21, 2014

### Tanya Sharma

The item in red is wrong .

Write 1/u(u-1) = 1/(u-1) - 1/u .

3. Apr 21, 2014

### Staff: Mentor

To expand on what Tanya Sharma said,
$$\int \frac{dx}{f(x)} \neq ln|f(x)| + C$$
unless f(x) just happens to be x.

4. Apr 21, 2014

### Tanya Sharma

or, to be more precise f(x) happens to be of the form ax+b ,where a and b are constants.

Last edited: Apr 21, 2014
5. Apr 21, 2014

### Panphobia

Yes subbing u = 1+e^x would work, but for this question you do not need to figure out du. So
∫1/(1+e^x) dx

so 1 = u-e^x

∫(u-e^x)/u dx

from here you can see how it would work.
You could also do it your way but you have to use partial fraction decomposition.

6. Apr 21, 2014

### Saitama

A better approach is to do this:
$$\int \frac{1}{1+e^{x}}\,dx=\int \frac{e^{-x}}{1+e^{-x}}\,dx$$
Use $e^{-x}=u$ to get:
$$\int \frac{-du}{1+u}\,du=-\ln|1+u|+C=-\ln|1+e^{-x}|+C$$

Last edited: Apr 21, 2014
7. Apr 21, 2014

### CAF123

Or another: $$\int \frac{1}{1+e^x}\,\text{d}x = \int \frac{1+e^x}{1+e^x}\,\text{d}x - \int \frac{e^x}{1+e^x}\,\text{d}x$$The second integral on the right can be evaluated by a simple substitution.

8. Apr 21, 2014

### Staff: Mentor

No, that wouldn't work.
$$\int \frac{dx}{ax + b} = \frac 1 a ln|ax + b| + C$$
So ∫dx/f(x) ≠ ln|f(x)| + C. There's that pesky factor of 1/a.

9. Apr 21, 2014

### physics604

How was she able to ln the instead like that? I thought there was a factor of $\frac{1}{a}$ to deal with?

10. Apr 21, 2014

### SammyS

Staff Emeritus
... ln the WHAT instead ...

What part of Pranav-Arora's post don't you get?

11. Apr 21, 2014

### physics604

I'm assuming they did something like this?

$$\int \frac{-du}{u+1} = -\frac{1}{1}\ln {|u+1|} +C$$