27

We will calculate $\displaystyle\int^{2 \pi}_0 x \, dx$. Let $u=\sin (x)$, and observe that $\sin(2 \pi)=0$ and $\sin(0)=0$. We also have that $\frac{du}{dx}=\cos(x)=\sqrt{1-u^2}$. Hence, $$ \int^{2 \pi}_0 x \, dx=\int^0_0 \frac{\sin^{-1}(u)}{\sqrt{1-u^2}} \, du = 0. $$ This is very obviously wrong, but I am not sure how to explain the error formally.

Edit: Thanks for the responses and in particular the link below to the related problem! The error is indeed caused by the substitution $x=\sin^{-1}(u)$. The integration is performed over $[0,2 \pi]$ which is outside the range of the $\sin^{-1}$ function.

Remark The error is slightly better disguised when calculating $\displaystyle\int^1_{-1}\frac{2x}{1+x^2} \, dx.$

Let $u(x)=1+x^2$, and observe that $u(1)=u(-1)=2$. Then since $dx=\frac{1}{2x} du$, we have that $$ \int^1_{-1} \frac{2x}{1+x^2} \, dx = \int^2_2 \frac{1}{u} \, du=0. $$ This time, no trigonometric substitution is used, but it is still an incorrect proof for the same reason as above. A correct proof can be obtained by using the fact that $x \mapsto \displaystyle\frac{2x}{1+x^2}$ is odd.

This example is more disturbing because the procedures above are entirely intuitive and yield the correct result. It seems to me that students when taught integration by substitution of definite integrals should also be taught that great care be exercised in checking the range of integration, particularly when the (apparent) substituting function is not invertible in that range.

Josh
  • 271

5 Answers5

24
  1. Theorem: integration by substitution (change of variable):

    If $g'$ is integrable on $[a,b]$ and $f$ is integrable, and has an antiderivative, on $g[a,b],$ then, substituting $u=g(x)$ into the LHS, $$\int_a^bf\big(g(x)\big)\, g'(x)\,\mathrm{d}x=\int_{g(a)}^{g(b)}f(u)\,\mathrm{d}u.$$

  2. Contrary to your Remark, the integration-by-substitution in the example $\displaystyle\int^1_{-1}\frac{2x}{1+x^2} \, \mathrm{d}x\,$ is perfectly valid even though $u=1+x^2$ is not invertible on $[-1,1].$

    Let $g(x)=1+x^2,\,\,f(u)=\frac1u,$ and $\,a=-1,b=1$.

    Then $f(g(x))=\frac1{1+x^2},\,\,g'(x)=2x,$ and $\,g(a)=g(b)=2$.

    Although $g$ is not injective on $[-1,1],$ the above theorem does validly apply: $$\int^1_{-1}\frac{2x}{1+x^2}\,\mathrm{d}x=\int_2^2\frac1u\,\mathrm{d}u=0.$$ Similarly, this is valid: $$\int_{-4}^3\frac{2x}{1+x^2}\,\mathrm{d}x =\int_{17}^{10}\frac1u\,\mathrm{d}u=-0.531.$$

  3. Changing variable during integration does not inherently require monotonicity or invertibility or even injectivity, except when obtaining the new integration limits after making an implicit substitution (i.e., one in which the new variable $u$ is an implicit function of the starting variable $x$). To wit: $$h_1(u)=h_2(x)\;\implies\; u=g(x)=h_1^{-1}h_2(x)$$ requires $h_1$ to be invertible, typically by restricting it to its principal domain.

    For example, given the integrand $\frac1{x^2\sqrt{4-x^2}},$ we can make the substitution $x=2\sin\theta$ with $\theta\in\left[-\frac\pi2,\frac\pi2\right].$

  4. The mistake in your main example arises not from non-invertibility per se (that is, there is no need to separately ensure that $g$ is invertible), but from neglecting that $$\sqrt{\cos^2(x)}\not\equiv\cos(x)\tag1$$ and that $$u=\sin(x)\kern.6em\not\kern-.6em\implies x=\arcsin(u).\tag2$$ Due to $(1)$ and $(2),$ the given integrand $x$ is expressible on its integration domain $[0,2\pi]$ as $f(g(x))\,g'(x),$ with $g=\sin,$ only piecewise; that is, the above theorem is applicable only piecewise; so, the substitution must also be piecewise, as follows.

    Let $u=\sin(x),$ so $\,\mathrm{d}u=\cos(x) \,\mathrm{d}x.$

    Now, for $x\in\left[0, \frac{\pi}{2}\right],$ \begin{align}x&=\arcsin(u),\\\cos(x) &= \sqrt{1-u^2};\end{align} for $x\in\left[\frac{\pi}{2},\frac{3\pi}{2}\right],$ \begin{align}x&=\pi -\arcsin (u),\\\cos(x) &= -\sqrt{1-u^2};\end{align} for $x\in\left[\frac{3\pi}{2}, 2\pi\right],$ \begin{align}x&=2\pi +\arcsin(u),\\\cos(x) &= \sqrt{1-u^2}.\end{align} Therefore, \begin{align}\int^{2\pi}_0 x \,\mathrm{d}x&=\int^\frac{\pi}{2}_0 x \,\mathrm{d}x + \int^\frac{3\pi}{2}_\frac{\pi}{2} x \,\mathrm{d}x + \int^{2\pi}_\frac{3\pi}{2} x \,\mathrm{d}x\\&=\int^1_0 \frac{\arcsin(u)}{\sqrt{1-u^2}}\mathrm{d}u + \int^{-1}_1 \frac{\pi-\arcsin(u)}{-\sqrt{1-u^2}} \mathrm{d}u + \int^0_{-1} \frac{2\pi + \arcsin(u)}{\sqrt{1-u^2}} \mathrm{d}u\\&=\pi\int^1_{-1} \frac{\,\mathrm{d}u}{\sqrt{1-u^2}}+2\pi\int^0_{-1} \frac{\,\mathrm{d}u}{\sqrt{1-u^2}}\\&=\pi\bigg[ \arcsin(u)\bigg]_{-1}^1+2\pi \bigg[\arcsin(u)\bigg]_{-1}^0\\&=2\pi^2.\end{align}

  5. The previous example actually fails to satisfy the condition $“f$ is integrable on $g[a,b]”$ of the above theorem, because $\displaystyle\int^1_0 \frac{\arcsin(u)}{\sqrt{1-u^2}}\mathrm{d}u,\; \int^{-1}_1 \frac{\pi-\arcsin(u)}{-\sqrt{1-u^2}} \mathrm{d}u,\;\int^0_{-1} \frac{2\pi + \arcsin(u)}{\sqrt{1-u^2}} \mathrm{d}u\,$ are not bound. But this technicality can be ignored, because they are convergent improper integrals.

    The common version of the above theorem actually has a stronger condition, namely, that $f$ be continuous on $g[a,b];$ in this case, it's harder to brush aside this violation as a technicality.

  6. Two other types of examples where non-injectivity is not the root culprit of the initially perceived errors during integration by substitution.

ryang
  • 38,879
  • 14
  • 81
  • 179
9

The substituted formula must match the formula substituted on each interval. $\sin^{-1}(u)\in\left[-\frac\pi2,\frac\pi2\right]$ cannot cover all of $[0,2\pi]$. A safer way to substitute is to substitute on monotonic intervals of the substituted formula: $$ \begin{align} \int_0^{2\pi}x\,\mathrm{d}x &=\overbrace{\int_0^1\color{#C00}{\sin^{-1}(u)}\,\mathrm{d}\sin^{-1}(u)}^{x=\sin^{-1}(u)\in\left[0,\frac\pi2\right]} +\overbrace{\int_{-1}^1\left(\color{#090}{\pi}+\color{#00F}{\sin^{-1}(u)}\right)\,\mathrm{d}\sin^{-1}(u)}^{x=\pi+\sin^{-1}(u)\in\left[\frac\pi2,\frac{3\pi}2\right]} +\overbrace{\int_{-1}^0\left(\color{#C90}{2\pi}+\color{#C9F}{\sin^{-1}(u)}\right)\,\mathrm{d}\sin^{-1}(u)}^{x=2\pi+\sin^{-1}(u)\in\left[\frac{3\pi}2,2\pi\right]}\\ &=\color{#C00}{\frac{\pi^2}8}\color{#090}{+\pi^2}\color{#00F}{+0}\color{#C90}{+\pi^2}\color{#C9F}{-\frac{\pi^2}8}\\[9pt] &=2\pi^2 \end{align} $$

robjohn
  • 345,667
  • 1
    Would the downvoter care to comment? I appreciate your opinion, but it is hard to fix something without knowing what is broken. – robjohn Jan 25 '23 at 13:00
  • Probably because of the colors – user182601 Feb 25 '24 at 12:12
  • The color is not essential to the proof, but it was intended to aid in following where the different pieces went from line to line. Without the color, one can still follow the proof, but might work a bit more to associate source in one line and destination in the next. – robjohn Feb 25 '24 at 19:32
  • I actually like the colors (but I can imagine some here finding it too newfangled for their tastes) – user182601 Feb 26 '24 at 00:28
1

I think that qwerty314 might have a better more direct answer to your bottom line question of why your particular method does not produce the desired result. That being said, it should be noted that you can actually get the desired result using trigonometric substitution by not changing the limits of integration, and instead back substituting the result then evaluating that at the original $x$ limits. To wit, given the indefinite integral

$$\int x\, dx,$$

let $$x=\sin u \Rightarrow dx=\cos u \, du.$$

Then

$$ \begin{align*} \int x\, dx &= \int \sin u \cos u \, du \\ &= -\frac{\cos^2 u}{2}. \end{align*} $$

As we let $\frac{x}{1}=\sin u$ in our original substitution, we now form a right triangle with angle $u$, opposite side $x$, and hypotenuse $1$. Thus the adjacent side is $\sqrt{1-x^2}$. Reading from this triangle we have that

$$-\frac{\cos^2 u}{2}=-\frac{1-x^2}{2}.$$

Now if we evaluate this result at our limits we get

$$ \begin{align*} -\frac{1-x^2}{2}\bigg|_0^{2\pi} &= -\frac{1-4\pi^2}{2}-\left( -\frac{1-0^2}{2} \right)\\ &=-\frac{1}{2}+\frac{4\pi^2}{2}+\frac{1}{2}\\ &=2\pi^2. \end{align*} $$

This is of course the result we would expect had we computed the definite integral in the standard manner.

J. W. Perry
  • 5,447
  • 3
  • 22
  • 28
0

Some quick comments to anyone thinking about the injectivity 'recommendation' that most books have (mine...Spivak's Calculus...included). I am a total novice in maths, so maybe this opinion should be disregarded, but I absolutely loathe the notation that is taught in integration: I think it completely obfuscates what is going on, which is not helpful for beginners like myself. In light of this, first note that, in the context of the OP's problem, we can view $\int_0^{2\pi}xdx$ as being a definite integral of the identity function $I(x)$. Then, letting $g(x)=\arcsin(x)$ and $g'(x)=\arcsin'(x)=\frac{1}{\sqrt{1-x^2}}$, in accordance with the substitution theorem mentioned in ryang's answer...and, for just a second leaving the bounds of integration in a state of ambiguity...we have: $\int_0^{2\pi}I(x)dx=\int_a^b I \circ g(x) \cdot g'(x)dx$. We will refer to this expression as $(\dagger_1)$.

Next, let us deal with the bounds of integration. The theorem states that our $(\dagger_1)$ should have bounds of integration in the following form: $\int_{g(a)}^{g(b)}I(x)dx=\int_a^b I \circ g(x) \cdot g'(x)dx$. Seeing as we 'start out' with the integral $\int_{g(a)}^{g(b)}I(x)dx$, where $g(b)=2\pi$ and $g(a)=0$, let us see if we can deduce what the values $a$ and $b$ should be on the right side of the equality in $(\dagger_1)$.

We know that $g(x)=\arcsin(x)$. So consider the expression: $g(a)=\arcsin(a)$, which, given the knowns, is $g(a)=\arcsin(a)=0$. By definition, the domain of $\arcsin$ is $[-1,1]$, its range is $[-\frac{\pi}{2},\frac{\pi}{2}]$ and is the inverse function of a domain restricted $\sin$ function (where that domain is, by definition, restricted to $[\frac{\pi}{2},\frac{\pi}{2}]$). As such, we can compute: $[g^{-1}\circ g] (a)=[\sin \circ \arcsin] (a)=\sin(0)=0$. So $a=0$. Now what about $b$?

Well, we have $g(b)=\arcsin(b)$ and, given the knowns, we would have the expression $g(b)=\arcsin(b)=2\pi$...but this expression is nonsense because there is no $b$ in the domain of $\arcsin$ that is mapped to $2\pi$, as pointed out by Andre Nicolas in the comments section. Interpreting $(\dagger_1)$ in the context of set theory, we could think of this as asking:

What elements reside in the following set $\displaystyle S=\left\{b \in \mathbb R :\int_0^{2\pi}I(x)dx=\int_0^{b}\frac{I(x)\circ \arcsin(x)}{\sqrt{1-x^2}}dx\right\}$

The answer is simple: none. There are no elements in this set...i.e $S=\emptyset$.

Now, if you choose to break up the integral as ryang and robjohn did, and chose to implement multiple functions...i.e. $g_1=\arcsin$, $g_2=\pi-\arcsin$, and $g_3=2\pi+\arcsin$, then you're fine...but, obviously, none of these functions are equal to one another.

NOTE - the above statements have nothing to do with injectivity. The failure of the original function has nothing to do with injectivity...the success of the recommended multiple-function-switch-up has nothing to do with injectivity.

So, in the event someone actually wants to investigate injectivity in the context of the integral substitution theorem, move on to the following section.


In order to address this subject adequately, I will use two different examples. We will still use the general structure of the integral $\int_{g(a)}^{g(b)} x dx$...which I will refer to as $\int_{g(a)}^{g(b)} I(x) dx$...but the bounds of integration will be different as we go through the different situations (specifically, as we explore different $g$).

For the first example, let us consider $\int_{0}^{1}I(x)dx$ and the function $g(x)=x^2$, with $g'(x)=2x$. Suppose we have the expression: $\int_0^1I(x)dx=\int_a^b I\circ g(x)\cdot g'(x)dx=\int_a^b 2x^3$. We have $g(b)=b^2=1$ and $g(a)=a^2=0$. The solution to the latter is simply $a=0$. However, for the former, we have that $(-1)^2=1$ and $(1)^2=1$ (note that this is different from the $\arcsin$ example, as, this time, $1$ is in the range of the square function). So we have two cases: $b=1$ or $b=-1$...i.e. $\int_0^1 I(x)dx=\int_0^{-1}2x^3dx$ or $\int_0^1 I(x)dx=\int_0^{1}2x^3dx$. In the first case, we get: $\frac{x^4}{2} \Big|^{-1}_0=\frac{1}{2}$. In the second case, we get: $\frac{x^4}{2} \Big|^{1}_0=\frac{1}{2}$. Seeing as $\int_0^1 I(x)dx=\frac{x^2}{2} \Big|^{1}_0=\frac{1}{2}$, it is clear that the lack of injectivity of our $g$ function did not even matter.

Let's consider the second example, where we change our bounds of integration as follows: $\int_1^4 I(x)dx$. Following the same routine as above, where $g(x)=x^2$, we need to find the values of $a,b$ for the following expression: $\int_1^4 I(x)dx=\int_a^b 2x^3 dx$. Unlike our first example, we see that both $a$ and $b$ will take on different solutions: $a=1 \lor a=-1$ and $b=2 \lor b=-2$. This means that our bounds of integration can take on several different forms:

  1. $\int_1^4 I(x)dx=\int_{-1}^2 2x^3dx$, which equals: $\frac{x^4}{2} \Big|_{-1}^{2}=\frac{15}{2}$

  2. $\int_1^4 I(x)dx=\int_{-1}^{-2} 2x^3dx$, which equals: $\frac{x^4}{2} \Big|_{-1}^{-2}=\frac{15}{2}$

  3. $\int_1^4 I(x)dx=\int_{1}^{2} 2x^3dx$, which equals: $\frac{x^4}{2} \Big|_{1}^{2}=\frac{15}{2}$

  4. $\int_1^4 I(x)dx=\int_{1}^{-2} 2x^3dx$, which equals: $\frac{x^4}{2} \Big|_{1}^{-2}=\frac{15}{2}$

Of course, $\int_1^4 I(x)dx=\frac{x^2}{2} \Big|_{1}^{4}=\frac{15}{2}$. Once again, we see that the lack of injectivity of the function $g$ did not affect us.

S.C.
  • 4,984
-1

substituting u=sin(x) will restrict the range of x to [-pi,pi], while x has range [-inf,inf].

qwerty314
  • 756