# Simple integral with $e^x$ - how to decompose it?

How to calculate this integral?

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

I have tried various substitions such as: $$t = e^x, t = e^x + 1, t = e^x +2, t = e^{2x}$$ and none seem to work.

According to wolframalpha I can simplify this expression into:

$$\frac{e^{2x}+2}{e^x +1} = e^x + \frac{3}{e^x+1} - 1$$

And then it'd be rather simple. But still no idea how to decompose it like that.

Any tips?

• What goes wrong with $t=e^x$? – Angina Seng Mar 11 '19 at 18:29

\begin{align} \frac{e^{2x}+2}{e^x +1}&=\frac{(e^{x})^2+2e^x+1-2e^x+1}{e^x +1}\\ &=\frac{(e^x+1)^2-2e^x+1}{e^x +1}\\ &=e^x+1+\frac {-2e^x-2+3}{e^x +1}\\ &=e^x+1-2+\frac {3}{e^x +1}\\ &=e^x + \frac{3}{e^x+1} - 1 \end{align}
$$\int \frac{e^{2x}+2}{e^x+1}dx$$ Applying $$u=e^x\implies dx=\frac{du}{u}$$ gives the following integral $$\int \frac{u^2+2}{u+1}\frac{du}{u}=\int \frac{u^2+2}{u(u+1)}du$$ Using partial fraction decomposition gives $$\frac{u^2+2}{u(u+1)}=-\frac3{u + 1} + \frac2u + 1$$ Hence the integral becomes $$\int (-\frac3{u + 1} + \frac2u + 1)du=-3\ln{(u+1)}+2\ln{(u)}+u+C$$ $$=-3\ln{(e^x+1)}+2\ln{(e^x)}+e^x+C$$ $$=-3\ln{(e^x+1)}+e^x+2x+C$$
For the last integral you can substitute$$\int\frac{1}{e^x+1}dx$$ $$t=e^x+1$$ and $$dt=e^xdx=(t-1)dx$$ or $$dx=\frac{1}{t-1}dt$$