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.
$$\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?