Why is it not true that $\int_0^{\pi} \sin(x)\; dx = 0$? 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.
 A: 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!
A: 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$. 

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.
A: 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)$). 
A: 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.
A: 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.
A: 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
A: 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. 
A: \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}
A: 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)$.
A: 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.$
A: 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.
