Must function $f$ substitute in integral be injective on segment? Problem: I want to calculate the area of a circle of radius $r>0$.
One idea is to calculate area of $\frac{1}{4}$ of circle, so that the area is
$$4\int_{0}^{r} \sqrt{r^2 -x^2} dx$$
To solve this we use the substitution $$x = r\cos{t}$$
$$dx = -r\sin{t}dt$$ and the integral can easily be solved.
My question is the following. What if I want first to calculate area of semicircle and then just multiply by $2$?
$$2\int_{-r}^{r} \sqrt{r^2 -x^2} dx$$
The substitution $x = r\cos{t}$ works even if $r\cos{t}$ is not injective on $ [-r,r]$?
 A: I will answer to the question and add some general comments.
Answer. As for your integral, we can take $\phi:[0,\pi]\rightarrow [-r,r]$
defined to be $\phi(t) = r\cos t$, which is bijective (actually it is
a parametrization of the interval $[-r,r]$). Thus we are allowed to
write down
$$
\int_{-r}^r \sqrt{r^2-x^2}\,dx = -\int_0^\pi
\sqrt{r^2(1-\cos^2t)}(-r\sin t)\,dt = \int_0^\pi r^2\sin^2 t\,dt =
\frac{\pi}2 r^2.
$$
Note that we have used $\sqrt{1-\cos^2 t}=\sin t$ because
$0\leq t\leq \pi$. Thus everything works fine by properly considering
the intervals of definition for the substitution.
Comments. More in general, the substitution formula works as follows. For
$f\in C^0[a,b]$ and for $\phi\in C^1[c,d]$ with $\phi[c,d]=[a,b]$
(note that this does not mean $\phi(c)=a$ and $\phi(d)=b$) we have
$$
\int_{\phi(u)}^{\phi(v)} f(x)\,dx = \int_u^v f(\phi(t))\phi'(t)\,dt
$$
for all $u$ and $v$ in $[a,b]$. Note that there is no injectivity
requirement here for $\phi$. For instance to compute
$\int_{-1}^1 e^{1-t^2}(-2t)\,dt = 0$ we are allowed to substitute
$\phi(t)=1-t^2$.
The previous formula can be read "in the opposite direction". If
$\phi:[c,d]\rightarrow [a,b]$ is invertible we have
$$
\int_p^q f(x)\,dx = \int_{\phi^{-1}(p)}^{\phi^{-1}(q)} f(\phi(t))\phi'(t)\,dt
$$
for all $p$ and $q$ in $[a,b]$. Actually, and this is the key point,
this formula holds even when $\phi$ is not invertible. To see
this, let $u$, $v$, $w$, and $z$ points of $[c,d]$ such that
$\phi(u)=\phi(w)=p$ and $\phi(v)=\phi(z)=q$ (so that $\phi$ is not
injective). We have
\begin{align*}
    \int_u^v f(\phi(t))\phi'(t)\,dt &= \int_{\phi(u)}^{\phi(v)} f(x)\,dx = \int_p^q f(x)\,dx =\\
    &= \int_{\phi(w)}^{\phi(z)} f(x)\,dx =
    \left.\left(\int_a^{\phi(t)} f(x)\,dx\right)\right|_z^w =
    \int_w^z f(\phi(t))\phi'(t)\,dt.
\end{align*}
For instance consider $\int_{-1}^1 x\,dx$ which is clearly $0$. We
might want to choose $\phi:[-\sqrt{2},\sqrt{2}]\rightarrow [-1,1]$
defined to be $\phi(t)=t^2-1$, which is not injective. Here $p=-1$ and
$q=1$, thus $\phi^{-1}(p)=0$ and we are free to choose for instance
$\sqrt{2}$ among the backward images of $1$ through $\phi$. Thus
$$
\int_{-1}^1 x\,dx = \int_{0}^{\sqrt{2}} (t^2-1)2t\,dt = 0.
$$
But... in the end the previous integral would have been the same by
choosing $\psi:[0,\sqrt{2}]\rightarrow [-1,1]$, $\psi(t)=t^2-1$, which
is injective.
Thus the moral of the story is that you can choose even non-injective
substitutions, but being careful to properly treat the integration
endpoints and aware that you could have properly restricted the
substitution interval in such a way to have an injective substitution.
A: The substitution does seem to work:
$$A=2\int_{-r}^r\sqrt{r^2-x^2}\,dx$$
$$=2\int_{\pi}^{0}r^2|\sin{t}|(-\sin{t})\,dt$$
$$=2r^2\int_0^\pi \sin^2t \,dt$$
$$=2r^2\int_0^\pi\frac{1-\cos{2t}}{2}\,dt$$
$$=r^2(\pi - \left[\frac{\sin{2t}}{2}\right]_0^\pi)$$
$$A=\pi r^2$$
