Here's how I understand $u$-substitution working for an integral. Essentially, it involves substitution of differential expressions, allowing you to cancel out terms of the integrand.

When we change the limits of integration, we essentially evaluate $u(x)$ to make sure the value stays the same.

$$
\begin{gather\*}
\int\_{x=0}^{x=2} \frac{x}{\sqrt{1 + x^2}} \, dx \\
\text{let $u = 1 + x^2$ so $du = 2x \, dx$ and $dx = \frac{1}{2} du / x$} \\
\int\_{u=1}^{u=5} \frac{\color{red}{x}}{\sqrt{u}} \, \left( \frac{1}{2\color{red}{x}} du \right) \\
\frac{1}{2} \int\_{u=1}^{u=5} u^{-1/2} \, du \\
\frac{1}{2} \left( \left. 2\sqrt{u} \ \right|\_{u=1}^{u=5} \right) \\
\sqrt{5} - 1.
\end{gather\*}
$$

That's all well and good. But I can choose anything for my $u$-expression. What if I wanted to let $u = (x)(x - 2)$? Then the limits of integration are $$\int\_{u=(0)(0-2)}^{u=(2)(2-2)} \implies \int\_{u=0}^{u=0}$$
and so the whole integral becomes zero.

Clearly this is invalid. The [correct result for the integral](http://www.wolframalpha.com/input/?i=integral+of+x+%2F+sqrt%28x%5E2+%2B+1%29+from+0+to+2) is indeed $\sqrt{5} - 1$. But what am I missing here? Why can't I set the integral up like this?

My thoughts:

* This is a definite integral, so there's no "$+ C$" constant of integration business going on. (Right?)
* Even if you end up having some $x$s in your expression because the $u$-substitution doesn't cancel them out, that doesn't matter because you're still integrating over an empty domain. (Right?) Plus, I can also get this to "work" with $\int\_{y=-r}^{y=r} (r^2-y^2)^{-1/2}y^2\,dy$ with $u = r^2-y^2$, and that can be expressed as $\int\_{u=0}^{u=0} u^{-1/2}\sqrt{r^2-u} \, du$, which is completely in terms of $u$. (I think?)
* Does it have something to do with the multiple solutions of quadratic equations?
* How do I know when I'm doing this by mistake? It seems like it could be pretty subtle.