Integrating $\int_0^{a} x^{\frac{1}{2}} (a-x)^{\frac{1}{2}} dx$ with $x=a \sin^2 u$ - limits query I had to evaluate the integral $$\int_0^{a} x^{\frac{1}{2}} (a-x)^{\frac{1}{2}} dx$$
I used the substitution $x=a \sin^2 u$ for this and got the correct answer of $\frac{\pi a^2}{8}$
However, part of my method involved the changing of the limits.
For example, when $x=0$, I reduce to $\sin u = 0$, which has multiple solutions $u=0, \pi, 2\pi, ...$. I chose $u=0$ to replace $x=0$, but why would it be incorrect to choose the others?
Similarly with $x=a$, I get $\sin^2 u = 1$.  I happened to choose $\sin u = 1$ but again why would it be incorrect to pick $\sin u = -1$ and use $u = -\frac{\pi}{2}$? It ends up giving the negative of the correct answer...
 A: You can choose whatever solution you want, provided that you choose the other one according to the first one. This is due to the periodicity of trigonometric function.
For example, your substitution reads $x = a\sin^2(u)$, which means a change in the first extrema as
$$\sin^2(u) = 0 \longrightarrow x = 0$$
And consequently the second extrema needs to be chosen with the "principal" solution:
$$\sin^2(u) = 1 \longrightarrow x = \frac{\pi}{2}$$
Say you want to choose the second solution, in the first extrema that is,
$$\sin^2(u) = 0 \longrightarrow x = \pi$$
allowed of course since it fits.
The other extrema then needs to be chosen in a shifted way according to the first solution that is,
$$\sin^2(u) = 1 \longrightarrow x = \frac{\pi}{2} \color{red}{ + \pi}$$
If you choose $x = 2\pi$ as a solution for the first extrema, then the second one shall be $x = \frac{\pi}{2} \color{red}{+ 2\pi}$
Indeed we have
$$\int_0^{\pi/2} \sin^2(u)\cos^2(u)\ \text{d}u = \frac{\pi }{16}$$
as well as
$$\int_{\pi}^{\pi/2 + \pi} \sin^2(u)\cos^2(u)\ \text{d}u = \frac{\pi }{16}$$
as well as
$$\int_{2\pi}^{\pi/2 + 2\pi} \sin^2(u)\cos^2(u)\ \text{d}u = \frac{\pi }{16}$$
and in general
$$\int_{0 + k\pi}^{\pi/2 + k\pi} \sin^2(u)\cos^2(u)\ \text{d}u = \frac{\pi }{16} ~~~~~~~~~~~ k\in\mathbb{Z}$$
A: You may choose any of the intervals
$$u\in \cdots (-\frac\pi2,0), (0,\frac\pi2),(\frac\pi2,\pi)\cdots$$
Take $u\in (-\frac\pi2,0)$ under $ x=\sin^2 u$, for the example,
$$\int_0^{a} x^{\frac{1}{2}} (a-x)^{\frac{1}{2}} dx
= a^2\int^{-\frac\pi2}_0(-\sin u)\cos u\>d(\sin^2u)=\frac\pi8a^2
$$
All the interval choices result in the same result. In practice, though, the choice $(0,\frac\pi2)$ is the most straightforward.
A: The reason is pretty simple. You can see here that your substitution in the interval of integration must be a continuous and differentiable function. Now a function is a map of any one value of $x$ in that interval of integration to exactly one value of $u$ in the target interval.
In your specific case, that means that you cannot simply choose $x=a \sin^2 u$ but you must in advance specify which monotonous branch of the $\sin(u)$-function you wish to consider, e.g. $0 \le u \le \pi/2$. You may also use  another branch, e.g. $\pi/2 \le u \le \pi$, but you must specify in advance.
To see how it works, consider your example: You have
$$
I = \int_0^{a} x^{\frac{1}{2}} (a-x)^{\frac{1}{2}} dx
$$
Substitute $x=a \sin^2 u$, where $dx/du = 2 a \sin u \cos u$. We will be very picky in discussing the square roots.
Using the "standard" branch $0 \le u \le \pi/2$ gives ${u(0) = 0}$ and ${u(a)} = \pi/2$, and
$$
I = \int_{u(0)}^{u(a)} 2 a^2 \sqrt{\sin^2 u}  \sqrt{\cos^2 u}  \sin u \cos u\; du \\
= \int_{u(0)}^{u(a)} 2 a^2 \sin u \cos u\  \sin u \cos u\; du = a^2 \frac{4 u - \sin(4 u) }{16} |_{u(0)}^{u(a)} = \frac{\pi a^2}{8}
$$
Using the alternative branch $\pi/2 \le u \le \pi$ gives  ${u(0) = \pi}$ and ${u(a)} = \pi/2$, and
$$
I = \int_{u(0)}^{u(a)} 2 a^2 \sqrt{\sin^2 u}  \sqrt{\cos^2 u}  \sin u \cos u\; du \\
= \int_{u(0)}^{u(a)} 2 a^2 \sin u \color{red}{(-\cos u)}  \sin u \cos u\; du = \color{red}{-} a^2 \frac{4 u - \sin(4 u) }{16} |_{u(0)}^{u(a)} = \frac{\pi a^2}{8}
$$
Note the (red) minus sign as the correct representation of the square root. The reason is that the substitution at this point is $(a-x)^{\frac{1}{2}} = \sqrt{\cos^2 u} = - \cos u$  is correct since these terms must be positive, as $\cos u$ is negative in the branch $\pi/2 \le u \le \pi$. The overall result is correct again.
A: $$ \textbf{Another way to solve that kind of integrals using Laplace transform} $$
$ \ $
For $ \alpha,\beta\in\mathbb{R}_{+}^{*} $, let's define a function $ f_{\alpha,\beta}:x\mapsto\int_{0}^{x}{y^{\alpha - 1}\left(x-y\right)^{\beta - 1}\,\mathrm{d}y} $, since $ f $ is a locally integrable function, we're allowed to talk about its Laplace transform which will then be : $$ \mathcal{L}\left\lbrace f_{\alpha,\beta}\right\rbrace=\mathcal{L}\left\lbrace g_{\alpha}*g_{\beta}\right\rbrace =\mathcal{L}\left\lbrace g_{\alpha}\right\rbrace\times\mathcal{L}\left\lbrace g_{\beta}\right\rbrace $$
Where $ g_{y} $, for $ y\in\mathbb{R}_{+}^{*} $, is the function defined as $ g_{y}:x\mapsto x^{y-1} $.
We know that, for any $ y\in\mathbb{R}_{+}^{*} $, and for all $ s\in\mathbb{C} $, $ \mathcal{L}\left\lbrace g_{y}\right\rbrace\left(s\right)=\frac{\Gamma\left(y\right)}{s^{y}} $. Hence, for all $ s\in\mathbb{C} $ : $$ \mathcal{L}\left\lbrace f_{\alpha,\beta}\right\rbrace\left(s\right)=\frac{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}{s^{\alpha +\beta}}=\frac{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}{\Gamma\left(\alpha +\beta\right)}\mathcal{L}\left\lbrace g_{\alpha +\beta}\right\rbrace\left(s\right) $$
Thus, for all $ x\in\mathbb{R}_{+}^{*} $, we have : $$ f_{\alpha,\beta}\left(x\right)=\frac{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}{\Gamma\left(\alpha +\beta\right)}g_{\alpha +\beta}\left(x\right) $$
$$\text{(Because when dealing with continuous functions, $ \mathcal{L} $ is injective)}$$
Meaning that for all $ x\in\mathbb{R}_{+}^{*} $, $$ \int_{0}^{x}{y^{\alpha -1}\left(x-y\right)^{\beta -1}\,\mathrm{d}y}=\frac{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}{\Gamma\left(\alpha +\beta\right)}x^{\alpha +\beta -1} $$
That holds for $ x = 1 $, and gives indeed one of the main properties (if not the definition) of the $ \beta $ function.
