What is the indefinite integral $\int \sqrt{1-2\sqrt{x-x^2}} \ \mathrm dx$? What is
$$\int \sqrt{1-2\sqrt{x-x^2}} \ \mathrm dx$$
I have tried substituting everything and it doesn't seem to be working. Substituting trigonometry doesn't seem to work either. 

One could also remember that nice little formula for nested square roots:
$$\sqrt{a\pm b\sqrt{c}}=\sqrt{u}\pm\sqrt{v}$$
with 
$$u=\frac{a+\sqrt{a^2-b^2c}}{2}\quad v=\frac{a-\sqrt{a^2-b^2c}}{2}$$
In our case $a=1$, $b=2$, $c=x-x^2$ and the sign is minus.
So
$$a^2-b^2c=1-4x+4x^2=4\left(x-\frac12\right)^2$$
hence, if we take $x\geq 1/2$,
$$u=\dfrac{1+2x-1}{2}=x\qquad v=\dfrac{1-2x+1}{2}=1-x$$
and the opposite if $0\leq x\leq 1/2$, so
$$\sqrt{1-2\sqrt{x-x^2}}=\left\{\begin{array}{rcl}\sqrt{1-x}-\sqrt{x}&\textrm{if}& 0\leq x\leq 1/2\\
\sqrt{x}-\sqrt{1-x}&\textrm{if}&1/2\leq x\leq 1\end{array}\right.$$
Now, the integral is easy:
$$\int \sqrt{x}dx=\frac23x^{3/2}+C$$
$$\int\sqrt{1-x}dx=-\frac23(1-x)^{3/2}+C$$
As a check,
$$\int_0^{1/2}\sqrt{1-x}-\sqrt{x}dx=\frac23\left[-(1-x)^{3/2}-x^{3/2}\right]_0^{1/2}=\frac23\left(1-2\frac{1}{2\sqrt{2}}\right)=\frac{1}{3}(2-\sqrt{2})$$
