TITLE: Why doesn't every integral from 0 to $2\pi$ equal zero?
QUESTION [10 upvotes]: Quick question, might end up having a simple answer, but I have here a "proof" that any integral from 0 to $2\pi$ is zero, as follows:
$$\int^{2\pi}_0f(x)dx$$
Now using u-substitution, let $u = \sin x$, so $dx = \frac{du}{\cos x}$, so:
$$\int^{0}_{0}\frac{f(x)du}{\cos x}$$
(The bounds were evaluated to zero due to the u-substituion).
However, this is zero, since the integral goes from zero to zero.
Any help as to why this is wrong would be appreciated.

REPLY [2 votes]: Note carefully that you're doing an "inverse" substitution "$u = \sin x$", not an "ordinary (or $u$-)substitution" of the form $x = X(u)$. For your conclusion to follow from the change of variables theorem, you'd need
$$
\int_{0}^{2\pi} f(x)\, dx = \int_{0}^{0} g(u)\, du
$$
for some function $g$. Your argument proposes "solving" $f(x) = g(\sin x) \cos x$ for $g$, so that
$$
\int_{a}^{b} \underbrace{g\bigl(u(x)\bigr) u'(x)}_{f(x)}\, dx = \int_{u(a)}^{u(b)} g(u)\, du.
$$
But despite casual appearances, there is no such function $g$ because, as mercio says, your substitution isn't invertible (injective).
In symbols, you want to write
$$
g(u) = \frac{f(\arcsin u)}{\cos x} = \frac{f(x)}{\cos x}.
$$
However, $\arcsin(\sin x) \neq x$ if $|x| > \pi/2$, so this formal choice doesn't work.
Said another way, the function $\phi(x) = g(\sin x) \cos x$ satisfies the non-trivial symmetry $\phi(\frac{\pi}{2} - x) = -\phi(x)$ for all $x$ ($\phi$ is "odd with respect to $\frac{\pi}{2}$"), while $f$ need not.
Either way, if $f$ is given there is generally no $g$ such that $f(x) = g(\sin x) \cos x$, so your proof doesn't get off the ground.