58
$\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$
  • 12
    $\begingroup$ There is no inverse function to $\sin(x)$ on $(0,\pi)$. That is, yes, "something" cannot be found and it does matter. $\endgroup$ – Peter Franek Oct 20 '15 at 19:52
  • 4
    $\begingroup$ Your substitution must be a bijective function. In your case, it's not. $\endgroup$ – 5xum Oct 20 '15 at 19:55
  • $\begingroup$ @PeterFranek: Does integration by substitution only work when $u$ has an inverse function? $\endgroup$ – John Doe Oct 20 '15 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$ – Peter Franek Oct 20 '15 at 19:57

11 Answers 11

51
$\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}},u = 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
    $\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 Oct 20 '15 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$ – Cameron Williams Oct 20 '15 at 22:51
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$
14
$\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$
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$
  • 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 Oct 20 '15 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. Oct 20 '15 at 21:21
  • $\begingroup$ Whlist that might be true, your "bonus" answers are always (or should I write a.e.?) insightful! $\endgroup$ – Mark Viola Oct 20 '15 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 Oct 21 '15 at 4:52
8
$\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$
  • $\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 Oct 21 '15 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 Oct 21 '15 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$

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$
  • 3
    $\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$ – Patrick Da Silva Oct 20 '15 at 19:57
  • 3
    $\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 Oct 20 '15 at 20:10
  • 2
    $\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$ – Patrick Da Silva Oct 20 '15 at 20:14
  • $\begingroup$ @PatrickDaSilva The substitution $u=x^2$ does not work for the integral of $x^3$ from -1 to 1. $\endgroup$ – Brian Rushton Nov 5 '15 at 16:46
  • $\begingroup$ @BrianRushton : What? $$ \int_{-1}^1 x^3 \, dx = \int_1^1 \frac u2 \, du = 0. $$ It works perfectly fine! $\endgroup$ – Patrick Da Silva Nov 5 '15 at 16:52
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$

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$
  • $\begingroup$ Did you read the post and not just the title? $\endgroup$ – pjs36 Oct 21 '15 at 5:29
  • $\begingroup$ 0 to π is just limits. Why are you applying sin(x) there? $\endgroup$ – Johny Royan Oct 21 '15 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 Oct 21 '15 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$
2
$\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$

Not the answer you're looking for? Browse other questions tagged or ask your own question.