Integrating a function using u-substitution I'm trying to figure out how to integrate this function. I tried several tricks from my toolkit, but I can't seem to figure it out. 

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

So let's say that I factor out some terms and split the equation to:

$\displaystyle\int\ \frac {e^{2x}}{e^x+2}\ dx\;$ and $\;\displaystyle -6\int\ \frac {e^x}{e^x+2}\ dx$

Now I cannot see how the derivative of $e^{2x}$ is $e^x+2$ or vice versa.
When looking at the other side, it seems more reasonable to set $u$ to $e^x$. So let's do that:

$\displaystyle -6\int\ \frac {e^x}{e^x+2}\ dx$ = $\displaystyle -6\int\ \frac {u}{u+2}\ dx$

Okay, so as you can see, I didn't get anywhere here. I'm really new to $u$-substitution and partial integration, I probably missed some crucial step.
 A: The trick is to see that $e^{2x}$ can be easily changed and factored. We start with the integral.
$$\int \frac {e^{2x}-6e^x}{e^x+2}~ {\rm d}x$$
We can use the fact that $a^{mn} = (a^m)^n$ to change this to
$$\int \frac {(e^x)^2-6e^x}{e^x+2}~ {\rm d}x = \int \frac {e^x(e^x - 6)}{e^x+2}~ {\rm d}x$$
We can then use the substitution $u = e^x +2$ and ${\rm d}u = e^x{\rm d}x$ and solve from there.
$$\int \frac {u - 8}{u}~ {\rm d}u = \int \left(1 - \frac{8}{u}\right){\rm d}u = u - 8\ln|u| + C$$
We then substitute the equivalent of $u$.
$$e^x + 2 - 8\ln|e^x + 2| + C$$
We can also now say that the $2$ can become part of the constant $C$ and remove the absolute value, since $e^x + 2 > 0$ for $x\in\mathbb{R}$ giving us a final answer of
$$e^x - 8\ln\left(e^x + 2\right) + C$$
A: $$\int{\frac{e^{2x}-6e^x}{e^x+2}dx}=\int{\frac{e^{2x}}{e^x+2}dx}-6\int{\frac{e^x}{e^x+2}dx}$$
Substitution: $u=e^x+2$, then $\frac{du}{dx}=e^x=u-2\to dx=\frac{1}{u-2}du$
Sub into first half of integral for:
$$\int{\frac{(u-2)^2}{u(u-2)}du}=\int{\frac{u-2}{u}du}=\int{1-\frac{2}{u}du}=u-2\ln|u|+C$$
And second half of integral will get:
$$\int{\frac{u-2}{u(u-2)}du}\to\int{\frac{1}{u}du}=\ln|u|+C$$
Thus overall you get: $$u-2\ln|u|-6\ln|u| +C=u-8\ln|u|+C$$
A: Hint: $$\frac{e^{2x}-6e^x}{e^x+2}= \frac{e^{2x}}{e^x+2}-\frac{6e^x}{e^x+2}$$
Further hint: Let $u=e^x+2$ then $dx=\frac{du}{e^x}$
So when you substitute this back in the first one, it becomes $\int\frac{u-2}{u}du$. Double-check this carefully.
A: $$\int\ \frac {e^{2x}-6e^x}{e^x+2}\ dx$$
Let $\displaystyle e^x + 2 = u$.$^{\color{blue}{(1)}}$  
So $\displaystyle e^x = u-2$, and so $\displaystyle e^{2x} = (u-2)^2$.
$\color{blue}{(1)}$ Now $\displaystyle e^x \ dx = du \iff \ dx = \frac{du}{e^x}$, but recall from above, that $\displaystyle e^x = u-2$.  
So in fact, $\displaystyle \color{blue}{dx = \frac{du}{u-2}}$.
That gives us the integral
$$\begin{align} \int \frac{(u-2)^2 - 6(u-2)}{u\cdot \color{blue}{(u-2)}}\ \color{blue}{du} & = \int \frac{(u-2) - 6}{u}\,du \\ & = \int \frac{u-8}{u}\,du \\ &= \int \left(1- \frac 8u\right)\ du = \end{align}$$
Can you take it from here?
A: It looks to me like you are almost done.  You have reduced the problem to integrating $-6\int \frac{e^x}{e^x+ 2}dx$.  Now let $u= e^x+ 2$.  Then $du= e^xdx$ so that integral becomes $-6\int \frac{1}{u}du$.
