Evaluate the Integral:$\int\frac{(1+e^x)^2}{e^x}\ dx$ 
Evaluate the indefinite integral $$\int\frac{(1+e^x)^2}{e^x}\ \mathrm{d}x$$

My attempt: Expand numerator:
$$\int\frac{1+2e^x+e^{2x}}{e^x} \, \mathrm{d}x$$ 
divide $e^x$ by the numerator:
$$\int (e^{-x}+2+e^{x}) \, \mathrm{d}x$$ 
the integration part is where I am little confused: Does $\int e^x \, \mathrm{d}x = e^x+C$
and the $e^{-x}$ when I integrate it does it equal zero? 
 A: You are correct up till $$\int e^{-x} +2 + e^x \, \mathrm{d}x$$
This evaluates to $$e^x + 2x - e^{-x} + c.$$
This is due to the "rule" that $$\int e^{\alpha x} \, \mathrm{d}x = \frac{e^{\alpha x}}{\alpha} + c.$$ In the case that $\alpha = 1$ we get $\int e^x \, \mathrm{d}x = e^x + c$. For $\alpha = -1$ we get $\int e^{-x} \, \mathrm{d}x = \frac{e^{-x}}{-1} = -e^{-x} + c$
You can try and deduce the above rule by using the substitution $u = \alpha x$ in the integral. 
A: You also can make substitution: 


*

*$e^x=u-1\Rightarrow dx=\frac{du}{e^x}$
$$\int\frac{(1+e^x)^2 dx}{e^x}=\int\frac{u^2}{(u-1)^2}du$$

*$\omega=u-1\Rightarrow d\omega=du$
$$\int\frac{u^2}{(u-1)^2}du=\int\frac{(\omega+1)^2}{\omega^2}d\omega=\int(1+\frac{2}{\omega}+\frac{1}{\omega^2})d\omega=\omega+2\log\:\omega-\frac{1}{\omega}+\zeta$$


*

*$\omega=u-1=e^x\Rightarrow \omega+2\log\:\omega-\frac{1}{\omega}=u-1+2\log(u-1)-\frac{1}{u-1}=e^x+2x-\frac{1}{e^x}$

A: Here are the steps
$$\int\frac{(e^x+1)^2}{e^x}\ dx$$
$$=\int\frac{e^{2x}+2e^x+1}{e^x}\ dx$$
$$=\int\left(e^x+2+\frac{1}{e^x}\right)\ dx$$
$$=\int e^x\ dx+2\int\ dx+\int\frac{1}{e^x}\ dx$$
$$=(e^x+C_1)+(2x+C_2)+\int e^{-x}\ dx$$
This last integral is where you seemed to get stuck as it does not equal zero. Using $u$-substitution, we have
$$u=-x$$
$$du=-dx$$
$$-du=dx$$
So now
$$(e^x+C_1)+(2x+C_2)-\int e^u\ du$$
$$=(e^x+C_1)+(2x+C_2)-(e^u+C_3)$$
$$=(e^x+C_1)+(2x+C_2)-(e^{-x}+C_3)$$
$$=e^x+2x-\frac{1}{e^{x}}+C$$
Therefore
$$\int\frac{(e^x+1)^2}{e^x}\ dx=e^x+2x-\frac{1}{e^{x}}+C$$
A: You are doing this correctly upto the point where you evaluate $\int (e^{-x}+2+e^{x}) dx$.
$$\int (e^{-x}+2+e^{x}) dx = \int e^{-x} dx + \int 2 dx + \int e^{x}dx= -e^{-x} + c + 2x + d + e^x + f$$
Where $c,d,f$ are constants. These constants can be added together and we name this $C$. So we have 
$$\int (e^{-x}+2+e^{x}) dx = -e^{-x} + 2x + e^x + C$$
