I am having some trouble with the problem below. I cannot see where the $r^2$ comes from on the fourth line of the answer below. I have the integral
$$ \int\sqrt{r^2-x^2}\,{\rm d}x $$
I make the substitution $x=r\sin(u)$ , $ \frac {dx}{du}=r\cos(u)$ , $u=\sin^{-1}(\frac{x}{r})$ to get
= $\int\sqrt{r^2-(r\sin u )^2} (r\cos u )\,{\rm d}u $
= $ \int r^2(\cos u )\sqrt{1-\sin^2 u }$ du
$\int \sqrt{r^2-x^2} dx \\ x=r \sin(\theta) \\ dx= r \cos(\theta) d \theta \\ \int \sqrt{r^2-x^2} dx=\int \sqrt{r^2-(r \sin(\theta))^2 } r \cos(\theta) d \theta \\ =\int \sqrt{r^2-r^2 \sin^2(\theta)}r \cos(\theta) d \theta=\int \sqrt{r^2(1-\sin^2(\theta))} r \cos(\theta) d \theta \\ =\int \sqrt{r^2} \sqrt{1-\sin^2(\theta)} r \cos(\theta) d \theta = \int r \sqrt{1-\sin^2(\theta)} r \cos(\theta) d \theta \\ =\int r \cdot r \sqrt{1-\sin^2(\theta)} \cos(\theta) d \theta=\int r^2 \sqrt{1-\sin^2(\theta) } \cos(\theta) d \theta \\ \text{ This is where the $r^2$ comes from...}$