Why does this $u$-substitution zero out my integral?

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 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.
• Unless special considerations are made, substitutions done in this manner must be injective. – Antonio Vargas Jun 11 '14 at 1:57
• And this is what you get from the "$\dfrac {\mathrm dy}{\mathrm dx}$ is a ratio" crap. – Git Gud Jun 11 '14 at 2:02
• @GitGud How does this relate to that? There isn't any canceling of differentials here, and that's the main problem I've seen arise…could you elaborate? – wchargin Jun 11 '14 at 2:09
• @WChargin It relates by virtue that the other way to teach/do this, is by using this. In the notation in the link, you're never gonna get a problematic $\phi$ like you get a problematic $u$ here. – Git Gud Jun 11 '14 at 2:11
• @m_t_ That question was asked three years after this question. It is the duplicate, not this one. – wchargin Oct 22 '17 at 18:44

You certainly have the right to make any change of variable you want. The problem with using $u=x(x-2)$ is that you have to solve for $x$ as a function of $u$:

$$u=x^2-2 x \implies x = 1 \pm \sqrt{1+u} \implies dx = \pm \frac{du}{2 \sqrt{1+u}}$$

Because $u(x)$ is a quadratic, $x(u)$ is multivalued with two branches. (This is why you were able to get zero in the lower and upper limits.) You would sub differently along each branch. Thus,

$$\int_0^2 dx \frac{x}{\sqrt{1+x^2}} = \frac12 \int_0^{-1} du \frac{1-(1+u)^{-1/2}}{\sqrt{3+u-2 \sqrt{1+u}}} + \frac12 \int_{-1}^0 \frac{1+(1+u)^{-1/2}}{\sqrt{3+u+2 \sqrt{1+u}}}$$

..and take it from there.

• How are you getting $-1$ for the limit of integration? I know that $u(-1) = 2$, but shouldn't you evaluate $u(2) = 0$? (and should that be $\int_0^{\color{red}{1}}$ in the center integral?) – wchargin Jun 11 '14 at 2:09
• @WChargin: when $u=-1$ then $x=1$ for both branches. No, the integrals are correct (and have been verified in Mathematica). – Ron Gordon Jun 11 '14 at 2:12

The wrong output is due to the illegitimate choice of change of variable function $\phi(x)=x(x-2)$. There are different formulations of the substitution formula for integration, but usually injectivity of $\phi$ is a requirement.

Challenge Change the lower bound of integration from $0$ to $-1$. Now the function $\phi(x)=x^2+1$ is no longer injective over this interval. The challenge question is whether you can still use the substitution $u=x^2+1$ to find the right answer.

• But why is that an illegitimate choice of function? – apnorton Jun 11 '14 at 1:58
• @anorton Exactly! I think Antonio might be right that injection is a requirement—that sounds likely. – wchargin Jun 11 '14 at 1:58
• This one dimensional Jacobian is no 1-1 and onto. – IAmNoOne Jun 11 '14 at 2:01