We use substitution to put the problem into a form where we can use partial fractions.
Let u = 1+e^x => du = e^xdxu=1+ex⇒du=exdx. Then:
int1/(1+e^x)dx = inte^x/(e^x(1+e^x)dx∫11+exdx=∫exex(1+ex)dx
=int1/(u(u-1)du=∫1u(u−1)du
Decomposing 1/(u(u-1))1u(u−1), we find
1/(u(u-1)) = 1/(u-1) - 1/u1u(u−1)=1u−1−1u
=> int1/(u(u-1))du = int1/(u-1)du - int1/udu⇒∫1u(u−1)du=∫1u−1du−∫1udu
=ln|u-1|-ln|u|+C=ln|u−1|−ln|u|+C
=ln|e^x+1-1|-ln|e^x+1|+C=ln|ex+1−1|−ln|ex+1|+C
=ln(e^x)-ln(e^x+1)+C=ln(ex)−ln(ex+1)+C
=x-ln(e^x+1)+C=x−ln(ex+1)+C
Rather than using partial fractions, we can also solve this with a little algebraic manipulation and substitution.
int1/(1+e^x)dx = int(1+e^x-e^x)/(1+e^x)dx∫11+exdx=∫1+ex−ex1+exdx
=int(1+e^x)/(1+e^x)dx - int e^x/(1+e^x)dx=∫1+ex1+exdx−∫ex1+exdx
=intdx-inte^x/(1+e^x)dx=∫dx−∫ex1+exdx
=x-inte^x/(1+e^x)dx=x−∫ex1+exdx
Focusing on the remaining integral, let u = (1+e^x) => du = e^xdxu=(1+ex)⇒du=exdx
Substituting, we have
inte^x/(1+e^x)dx = int1/udu∫ex1+exdx=∫1udu
=ln|u|+C=ln|u|+C
=ln(1+e^x)+C=ln(1+ex)+C
Plugging this into the equation above, we can get our result:
int1/(1+e^x)dx = x-ln(1+e^x)+C∫11+exdx=x−ln(1+ex)+C