27
$\begingroup$

This question/observation is inspired by the integral:

$$\int_0^{\sqrt{\pi}}x\sin(x^2)\cos(x^2)dx$$

The $u$-substitution $u=\sin(x^2)$ yields $du=2x\cos(x^2)dx$ and

$$\int_0^{\sqrt{\pi}}x\sin(x^2)\cos(x^2)dx=\frac{1}{2}\int_0^0 u du=0,$$

right? Wolframalpha certainly agrees.

Great, now consider the much harder integral $$\int_0^1 dx.$$

After banging our heads against the wall for hours we take $u=x^2-x$ so $du=(2x-1)dx=\pm\sqrt{1+4u}*dx$ by the quadratic formula, so

$$\int_0^1 dx=\int_0^0\frac{du}{\pm\sqrt{1+4u}}=0$$

The problem is wolframalpha says this integral should be $1$. Well, I guess it is a unit square.


Since $0\neq 1$ there is something fishy going on - I'm just trying to fully nail down the issue here. I think it boils down to hidden division by $0$ like most false proofs. In particular we can't solve the equation $du=(2x-1)dx$ for $dx$ if $x=\frac{1}{2}$, which happens inside the domain of integration. This isn't a problem for the original integral because even though there is a place where $\frac{du}{dx}=0$ inside the domain of integration $(x=\sqrt{\frac{\pi}{2}})$ there is no issue because we don't have to divide by this expression to make all the $x$s cancel. Anyway, I'm curious for further explanation and to know if there are any references which carefully explain subtleties such as this for integration by substitution.

$\endgroup$
6
  • 10
    $\begingroup$ The change of variable transform should be a diffeomorphism, see here. In the framework of $\mathbb R$, that is to say, the $x\mapsto u$ map should be monotone. $\endgroup$
    – Feng
    Commented Sep 7, 2023 at 3:19
  • 7
    $\begingroup$ As the answer below points out, it's the $\pm$ symbol. You haven't actually fully worked out the substitution, because $\pm\sqrt{1+4u}$ isn't a function of $u$. $\endgroup$
    – David K
    Commented Sep 7, 2023 at 4:41
  • 10
    $\begingroup$ @Feng : It doesn't have to be a diffeomorphism in the $1$-dimensional case (or even in $n$ dimensions if you keep track of orientation, but that's harder for $n>1$ and the link you gave doesn't do that). Notice that the theorem in Alex's answer doesn't need $g$ to be a diffeomorphism, nor does the first integral in the question. But of course it does need to be a well-defined (and differentiable) function, which is where the second integral in the question fails. $\endgroup$ Commented Sep 7, 2023 at 5:56
  • 4
    $\begingroup$ @TobyBartels You're right! Thank you for your patient explanation. :-) $\endgroup$
    – Feng
    Commented Sep 7, 2023 at 6:10
  • $\begingroup$ @TobyBartels Where can I find proof for change of variable in which substitution does not have to be diffeomorphism? $\endgroup$
    – Meet Patel
    Commented Sep 9, 2023 at 5:42

1 Answer 1

54
$\begingroup$

Formally, substitution says that if $g$ is differentiable on an interval, and $f$ is continuous on the image interval of $g$, then

$$ \int_a^b f(g(x)) g'(x) \, dx = \int_{g(a)}^{g(b)} f(u) \, du.$$

In our case, when we try to write the simple yet problematic integral in the form required by the left-hand side, we get

$$ \int_0^1 \, dx = \int_0^1 \frac1{2x-1}(2x-1)\, dx = \int_0^1 \, \frac1{\pm\sqrt{1+4(x^2 -x)}}(2x-1) \, dx, $$

but the sign ambiguity tells us that we must proceed more carefully (or else what single $f$ do we choose?). Indeed $2x - 1 = \sqrt{1+4(x^2-x)}$ when $x > 1/2$, whereas $2x - 1 = -\sqrt{1+4(x^2-x)}$ when $x < 1/2$. So really we should have written

$$ \int_0^{1/2} \, \frac1{-\sqrt{1+4(x^2 -x)}}(2x-1) \, dx + \int_{1/2}^{1} \, \frac1{\sqrt{1+4(x^2 -x)}}(2x-1) \, dx,$$ or via $u = g(x)$

$$ \int_0^{-1/4} \, \frac1{-\sqrt{1+4u}} \, du + \int_{-1/4}^{0} \, \frac1{\sqrt{1+4u}} \, du = \frac12 + \frac12 = 1,$$

which is the correct answer.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .