[Math] Why is it not true that $\int_0^{\pi} \sin(x)\; dx = 0$

calculusdefinite integralsintegration

I know the following is not right, but what is the problem. So we want to calculate
$$
\int_0^{\pi} \sin(x) \; dx
$$

If one does a substitution $u = \sin(x)$, then one gets
$$
\int_{\sin(0) = 0}^{\sin(\pi) = 0} \text{something}\; du = 0.
$$

We know that $\int_a^a f(x) \; dx = 0$ for all functions $x$, so why doesn't this work for the above?

I get that the "something" "can't be found" because $du = \cos(x)\,dx$. But does it really matter what the $du$ is when one is integrating from $0$ to $0$?

Edit: I don't know what a "diffeomorphism" is. I am just in basic calculus.

Best Answer

This is a very good question and not one that many students ask. Let's see what happens when we do as you are suggesting. Letting $u = \sin x$, we get

$$du = \cos x\,dx = \pm\sqrt{1-\sin^2 x}\,dx = \pm\sqrt{1-u^2}\,dx.$$

Thus the integral becomes

$$\int \sin x\,dx = \int \frac{\pm u}{\sqrt{1-u^2}}\,du.$$

Notice I did not put any limits of integration in here. When $x\in[0,\frac{\pi}{2}]$, cosine is non-negative, so we can use the positive root. However when $x\in(\frac{\pi}{2},\pi]$, cosine is negative so we have to use the negative root. Meaning our one integral splits into two different integrals:

$$\int_0^{\pi} \sin x\,dx = \int_{u(0)}^{u(\pi/2)} \frac{u}{\sqrt{1-u^2}}\,du + \int_{u(\pi/2)}^{u(\pi)} \frac{-u}{\sqrt{1-u^2}}\,du.$$

Note that $u(0) = 0$, $u(\pi/2) = 1$ and $u(\pi) = 0$ so we get

$$\int_0^{\pi} \sin x\,dx = \int_0^1 \frac{u}{\sqrt{1-u^2}}\,du - \int_1^0 \frac{u}{\sqrt{1-u^2}}\, du = 2\int_0^1 \frac{u}{\sqrt{1-u^2}}\,du.$$

Note that this is a positive number. The reason for why it doesn't work out is exactly as Baloown is suggesting. What you suggest does not apply here and is partially reflected in the occurrence of the $\pm$ roots. What the actual case is that the forward direction for $u$-substitution always works (meaning substituting $x = \text{ something}$) - it is the backwards case is where the issues lie (substituting $\text{something } = f(x)$).

Related Question