We are currently practicing integration using substitution in calculus and I'm having problems choosing the expression to substitute. For example, we have the following solved example:
Solve $$ \int^r_0 \sqrt{r^2-x^2}dx $$ where $r>0$ using substitution.
Let's choose $ x=r\sin u $ and $ dx=r\cos u du $.
Now $ x=0 \Rightarrow u=0 $ , $ x=r\Rightarrow u=\frac{\pi}{2} $ and
$$ \int^r_0 \sqrt{r^2-x^2}dx=\int^\frac{\pi}{2}_0\sqrt{r^2-r^2\sin^2u} \cdot r \cos udu =r^2\int^\frac{\pi}{2}_0 \cos^2u du=r^2\int^\frac{\pi}{2}_0 \frac{\cos(2u)+1}{2}du=\frac{r^2}{2}\left[ \frac{\sin2u}{2}+u \right]^\frac{\pi}{2}_0=\frac{r^2}{2} \cdot \frac{\pi}{2}=\frac{\pi r^2}{4}.$$
I know there are probably other substitutions that will work out too but how did we know that after choosing $ x=rsinu $ the expression would simplify like that? I mean, whenever I do substitutions I just try out different ways until one of them works out but are there any hints in the original expression that gives away what would be the substitution that will work?
In this particular example I also don't understand how we got $$r^2\int^\frac{\pi}{2}_0 \frac{\cos(2u)+1}{2}du = \frac{r^2}{2}\left[ \frac{\sin 2u}{2}+u \right]^\frac{\pi}{2}_0.$$
We usually choose the substitution to be made based on the form of trigonometric identities. In your example, $r^2-x^2$ might remind us of $\cos^2 x = 1 - \sin^2 x$, so we choose $u= r \sin x$. Of course we could've been reminded of $\sin^2 x = 1 - \cos^2 x$ and chosen $u=r \cos x$, which would've worked as well.
Many Calculus books have tables such as this, which tell you what substitution to make based on the form.
As to why $\displaystyle r^2\int^\frac{\pi}{2}_0 \frac{\cos(2u)+1}{2}du = \frac{r^2}{2}\left[ \frac{\sin 2u}{2}+u \right]^\frac{\pi}{2}_0.$
You can breathe easy on this one; it may look a little complex but it's just a basic integral. Here are the steps:
Let $v=2u$. Then $dv=2du$
$\displaystyle \int \dfrac{\cos(2u)+1}{2}du$
$ =\displaystyle\int \frac{\cos(2u)+1}{2}\dfrac {2du}{2} $
$=\displaystyle\int \frac{\cos(v)+1}{4} {dv}$
$=\dfrac 14 \displaystyle\int (\cos(v)+1) dv$
which I believe is straightforward from here.