Solution (source code)

= Solution

The increasing substitution $x=\sin^2\theta$ maps $0\leq\theta\leq\pi/2$ onto $0\leq x\leq1$, with $dx=2\sin\theta\cos\theta\,d\theta$. Since <sine> and <cosine> are nonnegative there, powers combine without a sign ambiguity:
$$
\boxed{B(p,q)=2\int_0^{\pi/2}\sin^{2p-1}\theta\cos^{2q-1}\theta\,d\theta.}
$$
This is the <trigonometric form of the beta function>. The powers at the endpoints are integrable because $p,q>0$.