# U-substitution for integral of 1/(1+e^x)dx. What am I doing wrong? Here is my work, with the right

U-substitution for integral of 1/(1+e^x)dx. What am I doing wrong?
Here is my work, with the right answer. I feel like every step is right, but somehow I am getting the wrong answer. How?
$\int \frac{1}{1+{e}^{z}}dz=\int \frac{1}{{e}^{z}\left(\frac{1}{{e}^{z}}+1\right)}dz=\int \frac{1}{\frac{1}{{e}^{z}}+1}\frac{1}{{e}^{z}}dz$
subbing $u=\frac{1}{{e}^{z}}+1$, $\frac{du}{dz}=-{e}^{-z}dz\phantom{\rule{thickmathspace}{0ex}}⟹\phantom{\rule{thickmathspace}{0ex}}-du=\frac{1}{{e}^{z}}dz$
$\int \frac{1}{1+{e}^{z}}dz=-\int \frac{1}{u}du=-\mathrm{ln}\left(u\right)+C=-\mathrm{ln}\left({e}^{-z}+1\right)+C$
But the right answer is $z-\mathrm{ln}\left(1+{e}^{z}\right)+C$
You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Arcatuert3u
$-\mathrm{ln}\left({e}^{-z}+1\right)+C=-\mathrm{ln}\left[{e}^{-z}\left(1+{e}^{z}\right)\right]+C=\dots$
###### Did you like this example?
sviraju6d
The "right answer" is merely the simplification of the answer you found.
$z+\text{ln}\left(1+{e}^{-z}\right)==\text{ln}\left(1+{e}^{z}\right)\phantom{\rule{0ex}{0ex}}{e}^{z+\text{ln}\left(1+{e}^{-z}\right)}=={e}^{\text{ln}\left(1+{e}^{z}\right)}\phantom{\rule{0ex}{0ex}}{e}^{z}\left(1+{e}^{-z}\right)==1+{e}^{z}\phantom{\rule{0ex}{0ex}}{e}^{z}+1==1+{e}^{z}$