69
$\begingroup$

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.

$\endgroup$
6
  • 15
    $\begingroup$ There is no inverse function to $\sin(x)$ on $(0,\pi)$. That is, yes, "something" cannot be found and it does matter. $\endgroup$ Commented Oct 20, 2015 at 19:52
  • 7
    $\begingroup$ Your substitution must be a bijective function. In your case, it's not. $\endgroup$
    – 5xum
    Commented Oct 20, 2015 at 19:55
  • 4
    $\begingroup$ @JohnDoe You can always replace $\int f(\varphi(t)) \varphi'(t) dt$ by $\int f(x) dx$. But vice versa, starting with $\int f(x) dx$, you can only use $f(x)=u$ if $f$ has an inverse (the "something" in your question). $\endgroup$ Commented Oct 20, 2015 at 19:57
  • 3
    $\begingroup$ Substitution does not, I repeat does not require a bijective function! $\endgroup$ Commented Aug 25, 2020 at 19:44
  • 1
    $\begingroup$ I explained in this answer that the issue here is that, with the suggested substitution, expressing the given integrand in a way that satisfies the integration-by-substitution theorem's conditions is possible only piecewise, as illustrated by some of the answers below. My answer also explains that changing variable during integration requires injectivity only when the substitution is an implicit one. $\endgroup$
    – ryang
    Commented Feb 10, 2023 at 18:45

11 Answers 11

59
$\begingroup$

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)$).

$\endgroup$
4
  • 5
    $\begingroup$ It might be even more illustrative to write the substitution as $x\to \arcsin x$ and $dx\to \frac{1}{\sqrt{1-x^2}}\,dx$ for $x\in [0,\pi/2]$ and $x\to \pi - \arcsin (x)$ for $x\in [\pi/2,\pi]$, where the arcsine function is taken as the principal branch. $\endgroup$
    – Mark Viola
    Commented Oct 20, 2015 at 22:42
  • 2
    $\begingroup$ That's a good point but I think I will leave it as is. You can make an answer along those lines if you'd like :) $\endgroup$ Commented Oct 20, 2015 at 22:51
  • $\begingroup$ Very simple and helpful. Although I don't understand the last part, about substitution working in forward but not in backwards? Could you go over that part again? $\endgroup$
    – William
    Commented Aug 29, 2022 at 13:14
  • $\begingroup$ @William Sure! It's setting $x=\sin(\theta)$ for instance (provided the region of integration works with $\sin$). $\endgroup$ Commented Aug 29, 2022 at 16:34
16
$\begingroup$

\begin{align} u & = \sin x \\ du & = \cos x\,dx \\[8pt] dx & = \frac{du}{\cos x} = \frac{du}{\pm\sqrt{1-\sin^2 x}} = \frac{du}{\pm\sqrt{1-u^2}} = \begin{cases} \dfrac{du}{\sqrt{1-u^2}} & \text{for }0\le x \le \frac \pi 2 \\[10pt] \dfrac{du}{-\sqrt{1-u^2}} & \text{for } \frac \pi 2 \le x \le \pi \end{cases} \\[15pt] \int_0^\pi \sin x\,dx & = \int_0^{\pi/2} \sin x\,dx + \int_{\pi/2}^\pi \sin x\,dx = \int_0^1 \frac{u\,du}{\sqrt{1-u^2}} + \int_1^0 \frac{u\,du}{-\sqrt{1-u^2}} = \cdots \end{align}

$\endgroup$
0
14
$\begingroup$

As suggested in the other answers, you cannot use that substitution on the whole interval $(0,\pi)$ because $\sin $ is not bijective there. However, you can do the change of variables after having split the interval into two pieces on which $\sin $ is bijective: $$\int_0^\pi\sin x\,\mathrm{d}x=\int_0^{\pi/2}\sin x\,\mathrm{d}x+\int_{\pi/2}^\pi\sin x\,\mathrm{d}x=\int_0^1\frac{u}{\sqrt{1-u^2}}\mathrm{d}u+\int_1^0\frac{-u}{\sqrt{1-u^2}}\mathrm{d}u\,,$$ having used the fact that $\cos x=\sqrt{1-u^2}$ on $(0,\pi/2)$ while $\cos x=-\sqrt{1-u^2}$ on $(\pi/2,\pi)$.

$\endgroup$
1
  • 1
    $\begingroup$ It does not need to be bijective $\endgroup$ Commented Aug 25, 2020 at 19:43
11
$\begingroup$

As mentioned in the comments, a change of variables need not be a $C^1$-diffeomorphism. It also need not be a piecewise $C^1$-diffeomorphism. All you need is for the endpoints to match up and some weak smoothness. For example: Suppose $f$ is continuous on $[a,b]$ and $g:[c,d]\to [a,b].$ Assume $g(c) = a, g(d) = b,$ and that $g$ is differentiable on $[c,d]$ with $g'$ Riemann integrable on $[c,d].$ Then

$$\tag 1 \int_a^b f(x)\,dx = \int_c^d f(g(t))g'(t)\,dt.$$

Proof: Let $F(x) = \int_a^x f.$ Then $F'=f,$ so $(F\circ g)'(t) = (f\circ g)'(t)g'(t).$ The last function is Riemann integrable on $[c,d],$ so the integral on the right of $(1)$ equals $(F\circ g)(d)-(F\circ g)(c) = F(b)-F(a) = \int_a^b f.$

$\endgroup$
4
  • 3
    $\begingroup$ As always, your answer is solid. So, +1. You might consider adding a couple of lines that maps this answer to the specific integral of interest (i.e., $f(x)=\sin x$ and $g(t)=\arcsin(t)$). Again, well done! $\endgroup$
    – Mark Viola
    Commented Oct 20, 2015 at 21:09
  • 1
    $\begingroup$ Thank you @Dr.MV. You always catch me providing an answer that is not directly related to the OP's question. In this case, I was addressing a different question that was raised in the answers and the comments. Can't help myself. $\endgroup$
    – zhw.
    Commented Oct 20, 2015 at 21:21
  • $\begingroup$ Whlist that might be true, your "bonus" answers are always (or should I write a.e.?) insightful! $\endgroup$
    – Mark Viola
    Commented Oct 20, 2015 at 22:31
  • $\begingroup$ I liked this answer by Christian Blatter to a similar question: math.stackexchange.com/a/470460/16490. He explains in similar detail why we really never need to assume that our "substitution" function need be injective. If it is not injective, for our bounds of integration we may choose any points in the preimage of the substituted integral bounds. But if non-invertible substitution functions are really allowed, how do we account for the erroneous proof that $\int^\pi_0\sin x dx =0$? Isn't it exactly the failure of $\sin x$ to be injective that caused this? $\endgroup$
    – ziggurism
    Commented Oct 21, 2015 at 4:52
9
$\begingroup$

Although there have been several great answers, one user suggested that I expand on a comment I wrote. To that end, we make the simple substitution

$$x= \begin{cases} \arcsin (t)&,0\le x\le \pi/2\\\\ \pi-\arcsin(t)&,\pi/2\le x\le \pi \end{cases} $$

where the arcsine is taken to be the principal branch with domain $[-1,1]$ and range $[-\pi/2,\pi/2]$. Then, we have

$$dx= \begin{cases} \frac{1}{\sqrt{1-t^2}}\,dt&,0\le x\le \pi/2\\\\ -\frac{1}{\sqrt{1-t^2}}\,dt&,\pi/2\le x\le \pi \end{cases} $$

Finally, the integral of interest becomes

$$\begin{align} \int_0^\pi \sin x\,dx&=\int_0^{1} \frac{t}{\sqrt{1-t^2}}\,dt+\int_{1}^{0}\frac{-t}{\sqrt{1-t^2}}\,dt\\\\ &=2 \end{align}$$

and we are done!

$\endgroup$
2
  • 1
    $\begingroup$ I like this answer more than other answers out there (+1 for the same). See a similar answer at math.stackexchange.com/a/669276/72031 $\endgroup$
    – Paramanand Singh
    Commented Oct 21, 2015 at 4:10
  • $\begingroup$ I think your answer would be improved if you 1. made it clear that you were adopting two different substitution variables in two different regimes, and did not adopt a nonstandard piecewise notation that makes it appear that you're doing a single substitution for x, and 2. if you motivated a little more how and why you decided to separate the two substitutions for x. $\endgroup$
    – ziggurism
    Commented Oct 21, 2015 at 5:03
8
$\begingroup$

Very precise answers have been given. I would like to answer the subject question only "Why is it not true that $\int_0^{\pi} \sin(x)\; dx = 0$?" This is first a matter of visual evidence and common sense.

In the interval $[0,\pi]$, your sine function is positive, and stricly inside $]0,\pi[$. With a little calculus, you obtain that $\sin$ is stricly positive (say, above $\sin(a)$) in some $[a,\pi-a]$ interval, $0<a<\pi-a<\pi$. Thus your integral, which can be interpreted as an area here, should be above $\sin(a)\times (\pi - 2a)>0$.

enter image description here

Based on these observations, you should resign to the fact that your substitution is not valid for some reason (explained in the above precise answers). Your trick reminds me of the "proof" that $1=0$, which does unappropriate substitutions, leading to a wrong conclusion.

Logic and observations are good masters in maths.

$\endgroup$
4
$\begingroup$

The integral will vanish only if the entire function is a constant, =0. Your logic is correct when you evaluate between limits $ x = 0, 2 \pi$.

It matters a lot what the integrand is, because that is all the matter now is about.

Do not think about diffeomorphisms at this stage.

However the integral vanishes $ x =-u, u $ where $u$ is any real number.

$\endgroup$
3
$\begingroup$

A substitution has to be a bijection on the interval of integration. Draw a picture of the graph and you'll see that with your substitution, you need to split the interval of integration at $\pi/2$ to have a bijection. Otherwise, you miss parts of the interval of integration (in this case, the whole interval!). Note that the maximum of $\sin{x}$ on the interval of integration is $1$, so a substitution of the form $u=\sin{x}$ needs to have this as an endpoint, after splitting into intervals where $\sin{x}$ is monotonic.

$\endgroup$
8
  • 4
    $\begingroup$ A substitution does not have to be a bijection. The substitution $u = x^2$ is perfectly fine, even over the interval $[-1,1]$ for instance. (What you are looking for in the strict sense is that a substitution has to be a piecewise $C^1$-diffeomorphism ; this is because the change of variables theorem works for $C^1$-diffeomorphisms and we can use the linearity of the integral to split the change of variables over the pieces.) $\endgroup$ Commented Oct 20, 2015 at 19:57
  • 4
    $\begingroup$ Yes, but there's no point explaining it in those terms to people who have never done differential geometry. It's far simpler to tell them to split the interval of integration into sections on which the substitution they want to make is monotonic. There's no need to bring chains, pullbacks and partitions of unity into it. And last time I checked, a diffeomorphism had to be a bijection... $\endgroup$
    – Chappers
    Commented Oct 20, 2015 at 20:10
  • 3
    $\begingroup$ I didn't mention the advanced terms to confuse the OP, I added them for you. Since when is $u = x^2$ a bijection? I recall it is a correct change of variables though. That's all my comment is saying. But the point is that the only thing going wrong with the OP's idea is the bounds of integration, not the choice of change of variables. $\endgroup$ Commented Oct 20, 2015 at 20:14
  • $\begingroup$ @PatrickDaSilva The substitution $u=x^2$ does not work for the integral of $x^3$ from -1 to 1. $\endgroup$ Commented Nov 5, 2015 at 16:46
  • 1
    $\begingroup$ The substitution does not need to be bijective. $\endgroup$ Commented Aug 25, 2020 at 19:43
3
$\begingroup$

Since 0 to π in sin(x) covers area in upper part. so it cannot be zero. Please refer following link: https://en.wikipedia.org/wiki/Integral

$\endgroup$
3
  • $\begingroup$ Did you read the post and not just the title? $\endgroup$
    – pjs36
    Commented Oct 21, 2015 at 5:29
  • $\begingroup$ 0 to π is just limits. Why are you applying sin(x) there? $\endgroup$ Commented Oct 21, 2015 at 5:40
  • $\begingroup$ I didn't ask the question, so I'm not applying anything anywhere. I'm just pointing out that the actual question in the post is not addressed by this answer (while acknowledging that the title question, I suppose, is). $\endgroup$
    – pjs36
    Commented Oct 21, 2015 at 5:47
3
$\begingroup$

If you link integration to calculating area the answer is wrong but if if considered as a calculation of some number it is oke. The point $(\frac{\pi}{2},0)$ is a point of reflection and then you will count the number '$f(x)\, dx$' as welll as positive and negative so the outcome will be zero.

$\endgroup$
1
$\begingroup$

The reason that your idea doesn't work is that $u$-substitution only works if your function is one-to-one (also called monotone; it just means it has to be increasing everywhere or decreasing everywhere). They don't talk about this in calculus because it never really comes up. What you can do is split up your integral into two parts (from 0 to $/pi$/2 and then the other half) and do the u-substitution on both parts. That gives the right answer, because the substitution is one-to-one on both parts.

$\endgroup$
1
  • 4
    $\begingroup$ This isn't true, the substitution does not need to be one-to-one $\endgroup$ Commented Aug 25, 2020 at 19:44

You must log in to answer this question.

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