Evaluate $\int_{2}^{7} \frac{x}{1-\sqrt{2+x}} d x$ We have the following integral:
$$
\int_{2}^{7} \frac{x}{1-\sqrt{2+x}}\, dx
$$
And this is my solution, which seems to be wrong, and I am failing to see where exactly I failed at:
We have $u=1-\sqrt{2+x}, x=u^2-2u-1, dx=-2\sqrt{2+x}\, du$, and we know that $x\geq -2$ and thus $u\leq 1$:
\begin{align}
\int_{2}^{7} \frac{x}{1-\sqrt{2+x}}\, dx
&=-2\int_{-1}^{-2} \frac{(u^2+2u-1)(u-1)}{u}\, du\\
&= -2 \left( \int_{-1}^{-2} u^2 d u + \int_{-1}^{-2} u\, du +\int_{-1}^{-2} -3\, du + \int_{-1}^{-2} \frac{1}{u}\, du \right) \\
&= -2\left[\frac{u^3}{3}+\frac{u^2}{2}-3u+\ln{|u|}\right]_{-1}^{-2}\approx -18
\end{align}
Can someone please help me pinpoint the issue?
 A: I would have calculated it like this:
Let $u=1-\sqrt{2+x} \Leftrightarrow x=(1-u)^2-2$ where $x\ge-2$. We then have
$$ \mathrm dx=2(1-u)(-1)\,\mathrm du$$
so
\begin{align*}
\int_2^7\!\frac{x}{1-\sqrt{2+x}}\,\mathrm dx
&=\int_{-1}^{-2}\!\frac{(1-u)^2-2}{u}\cdot2(1-u)(-1)\,\mathrm du
\\&=2\int_{-2}^{-1}\!\frac{((1-u)^2-2)(1-u)}{u}\,\mathrm du
\\&=2\int_{-2}^{-1}\!\frac{(1-2u+u^2-2)(1-u)}{u}\,\mathrm du
\\&=2\int_{-2}^{-1}\!\frac{(u^2-2u-1)(1-u)}{u}\,\mathrm du
\\&=2\int_{-2}^{-1}\!\frac{-u^3+3 u^2-u-1}{u}\,\mathrm du
\\&=2\int_{-2}^{-1}\!\Bigl(-u^2+3u-1-\frac{1}{u}\Bigr)\,\mathrm du
\\&=2\Bigl[-\frac13u^3+\frac32u^2-u-\ln(|u|)\Bigr]_{-2}^{-1}
\\&=-\frac{47}{3}+2\ln(2).
\end{align*}
A: The first thing I would like to point out is that since you want to do a substitution, it is really extra (unnecessary) work writing $dx$ in terms of $x$ (where the aim of substitution is to "get rid" of the initial variable and simplify the integral in the process).
With that out of the way, let $u = 1 - \sqrt {2 + x}$, then $x = u^2 - 2u - 1$ and $\mathrm{d}x = 2u - 2$.
Now, observe that, $\forall\ n \in \mathbb {R}$, $\sqrt n \geq 0$, so we note that $u \leq 1$.
\begin{align}
\int_{2}^{7} \frac x {1 - \sqrt {2 + x}}\ \mathrm {d}x & =
2\int_{-1}^{-2} \frac {(u^2 - 2u - 1)(u - 1)} u\ \mathrm {d}u
\\[5 mm] & =
2\int_{-1}^{-2} \frac {u^3 - 3u^2 + u + 1} u\ \mathrm {d}u
\\[5 mm] & =
2\left[\frac {u^3} 3 - \frac {3u^2} 2 + u + \ln|u|\right]^{-2}_{-1}
\\[5 mm] & =
2\ln 2 -\frac {47} 3
\end{align}
A: exactly, when you have $u=1-\sqrt{2+x}\ => x=u^2-2u-1$
Then $du=2(u-1)dx$
Plugging it into your formula we get
$=2\int\ \frac{(u^2-2u-1)(u-1)}{u}$
