TITLE: How does Wolfram Alpha come up with the substitution $x = 2\sin u$? Integration/Analysis
QUESTION [6 upvotes]: I have to integrate 
$$
\int_0^2 \sqrt{4-x^2} \, dx
$$
I looked at the Wolfram Alpha step by step solution, and first thing it does is it substitutes
$x = 2\sin(u)\text{ and } \,dx = 2\cos(u)\,du$
How does it know to substitute $2\sin(u)$ for $x$?

REPLY [3 votes]: Theóphile's comment is a good answer. I will give another.
The $\sqrt{4-x^2}$ and indeed anything of the form $\sqrt{a^2-b^2}$ --- think $\sqrt{x^2-b^2}$ or $\sqrt{a^2-x^2}$ --- or $x^2+b^2$ can be considered --- via Pythagoras --- as sides of a right-angled triangle. 
In this example we have $\sqrt{2^2-x^2}=b\Rightarrow b^2+x^2=2^2$ so that we have a right-angled-triangle with sides $x$, $b=\sqrt{2^2-x^2}$ and hypotenuse $2$. 
Draw this triangle. Now choose an angle $\theta$ in the triangle so that you can write 
$$\sec/\tan/\sin\theta=\frac{x}{2}.$$
In this case we have $\sin \theta=\frac{x}{2}$.
Now, using the triangle you sketched,
$$\cos\theta=\frac{\sqrt{4-x^2}}{2}\Rightarrow \sqrt{4-x^2}=2\cos\theta.$$
We can also get a handle on $dx$ no problem.
When we eventually antidifferentiate, our answer will be in terms of $\theta$. We can find any of the trig ratios in terms of $x$ using our triangle and $\theta$... well $\theta$ is than angle whose sine is $\frac{x}{2}$ so
$$\theta=\sin^{-1}\left(\frac{x}{2}\right).$$
... not that it arises in this question.