$$3\int_{0}^{2\pi} \sin(t) \cos(t) \,{\rm d}t$$
My calculus is a bit rusty and I can not find where I get it wrong. Setting $u= \sin(t)$, I get ${\rm d} u=\cos(t) \,{\rm d} t$ and, thus,
$$3\int_{u=0}^{u=0}u \,{\rm d}u=0$$
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this community$$3\int_{0}^{2\pi} \sin(t) \cos(t) \,{\rm d}t$$
My calculus is a bit rusty and I can not find where I get it wrong. Setting $u= \sin(t)$, I get ${\rm d} u=\cos(t) \,{\rm d} t$ and, thus,
$$3\int_{u=0}^{u=0}u \,{\rm d}u=0$$
The substitution is correct. If $f$ is a function with an antiderivative $F$, one has by the fundamental theorem of calculus \begin{equation} \int_a^b f(u(t))u'(t)dt = \int_a^b(F(u(t)))' dt = F(u(b)) - F(u(a)) = \int_{u(a)}^{u(b)}f(x) d x \end{equation} A sufficient hypothesis is that $u'$ is continuous in $[a,b]$ and that $f$ is continuous on an interval that contains $u([a,b])$.
In your case $u(t) = \sin(t)$ and $f(t)=t$.
I'm amazed that so many people are puzzled by this simple application of the fundamental theorem of calculus.
Let us take the case of the integral \begin{equation} I = \int_0^\pi \sin(x) d x \end{equation} and let $u(x) = - \cos(x)$ as suggested in the comments, with $f(x)= 1$. The above substitution formula gives \begin{equation} I = \int_{-\cos(0)}^{-\cos(\pi)} dx = \int_{-1}^1 d x = 2 \end{equation} which is the correct result.
There is no contradiction with this counterexample because in the counterexample, the invalid substitution is $u(x) = \sin(x)$. It would imply $f(u) = \pm\frac{u}{\sqrt{1-u^2}}$ and the original integral must be split at $\pi/2$ to choose between $+$ and $-$. It does not invalidate the above formula with the continuity condition on $f$.
I thought I'd create a separate answer to just try and explain the confusion people have a bit more. @Gribouillis has given you a really good answer, so please give him the solution check-mark.
It's not true that the substitution needs to be injective. You can see for yourself on the Wikipedia article the conditions required for $u$ substitution, and injectivity is not one of those requirements: https://en.wikipedia.org/wiki/Integration_by_substitution. In this case - your solution for this integral is completely valid (it is indeed $0$) and there is nothing wrong with your method.
There are some cases where if you blindly apply substitution, you can get the incorrect result. For example, consider
$${\int_{0}^{\pi}\sin(x)dx}$$
Let's substitute ${u=\sin(x)}$. Then the bounds become ${\int_{0}^{0} ...du=0}$. Does that mean the original integral is $0$? NO!. We have incorrectly applied the theorem of Integration by Substitution. All substitution says is that
$${\int_{a}^{b}f(\phi(x))\phi'(x)dx=\int_{\phi(a)}^{\phi(b)}f(u)du}$$
${\int_{0}^{\pi}\sin(x)dx}$ does not match this form. You can make it happen - so let's try it. We can write
$${\int_{0}^{\pi}\sin(x)\frac{\cos(x)}{\cos(x)}dx}$$
Now here's the problem - we need to write the bottom ${\cos(x)}$ in terms of ${\sin(x)}$ - we know ${\cos(x)=\pm\sqrt{1-\sin^2(x)}}$ - that's the problem - the ${\pm}$. If ${x \in \left[0,\frac{\pi}{2}\right)}$, we have ${\cos(x)=\sqrt{1-\sin^2(x)}}$, and if ${x \in \left(\frac{\pi}{2},\pi\right]}$ then ${\cos(x)=-\sqrt{1-\sin^2(x)}}$. So you will have to split up the integral into two halves, like so:
$${\int_{0}^{\pi}\sin(x)dx=\int_{0}^{\frac{\pi}{2}}\frac{\sin(x)}{\sqrt{1-\sin^2(x)}}\cos(x)dx+\int_{\frac{\pi}{2}}^{\pi}\frac{\sin(x)}{-\sqrt{1-\sin^2(x)}}\cos(x)dx}$$
And now we can apply substitution to the two individual integrals to get
$${=\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}$$
So as you can see - there are certain subtleties with using substitution - but injectivity is not a direct condition required for it. Your solution to the integral is absolutely fine.
I'd just like to point out that there is a simpler method to finding the definite integral than by substitution. We have the identity $$\sin2x=2\sin x \cos x$$ so dividing by $2$ gives $$\frac{1}{2}\sin2x=\sin x \cos x$$ so this allows us to find the value of your definite integral by integrating $\sin t$, which is much easier (as $\int \sin{t} dt=-\cos t +c.$)
I hope that's useful.
The result is correct, because the function $x \mapsto \sin(x) \cos(x)$ is $\pi$-periodic. However, this was more of a lucky strike here, because the sub is not appropriate.
Another (bad) example would be the integral $\displaystyle\int_0^\pi \sin(x) \mathrm{d}x$. If you set $u = \sin(x)$, then you get $\mathrm{d}x = \dfrac{\mathrm{d}u}{\sqrt{1 - u^2}}$, and after substitution, you end up with $\displaystyle\int_0^0 \dfrac{\mathrm{d}u}{\sqrt{1 - u^2}} = 0$, which is clearly false. So something went wrong somewhere.
The main problem, in both cases, is that the inverse sine function is only defined to give you outputs in the "rightmost" part of the trigonometric circle (in other words, the image of $\sin^{-1}$ is $[-\pi/2, \pi, 2]$).
So, since in your example, your range is $[0, 2\pi]$, it messes up as soon as $x$ goes beyond $\pi/2$.
That's why you need to be careful when making trig subs. To do it properly, you'd have to split your intervals in parts where $\sin$ is injective, so that you can get a well defined inverse.