Integration with surds, problem taking out $x^2$ this my first post so I apologise for any conventional structure features I might be violating.
I'm trying to evaluate the indefinite integral:
$$\int\sqrt{x^2-2x^4}dx$$
I recognise that this question wants me to simplify the expression $\sqrt{x^2-2x^4}$ into $x\sqrt{1-2x^2}$
but what confused me was the fact that the absolute value of $x$ here was not taken out instead to obtain the solution:
$$-\frac{1}{6}(1-2x^2)\sqrt{1-2x^2}+C$$
I thought the simplification would have been:
$$|x|\sqrt{1-2x^2}$$
For which the indefinite integral would take on two separate values, one for each branch that changes the sign of $x$. At first, I suspected the natural domain of the square root implicitly stated that $x\geq0$ but at a closer inspection, I calculated the domain restriction as follows:
$$-\frac{\sqrt{2}}{2}\leq x \leq\frac{\sqrt{2}}{2}$$
Could somebody so kindly advise me where I have made a mistake? Any help will be greatly appreciated!
 A: As you noted, for $0\leq x\leq1/\sqrt{2},$ the factor $x^2$ can be taken out as $x,$ and we obtain
$$
-\frac{1}{6}\sqrt{(1-2x^2)^{3}}+C^+.
$$
For $-1/\sqrt{2}\leq x\leq0$ the factor $x^2$ can be taken out as $-x,$ and we obtain
$$
+\frac{1}{6}\sqrt{(1-2x^2)^{3}}+C^-.
$$
Note that, if we erroneously take the first one for the whole interval, we end with the absurd conclusion
$$
\int_{-1/\sqrt{2}}^{+1/\sqrt{2}}\sqrt{x^2-2x^4}dx=-\frac{1}{6}\sqrt{(1-2x^2)^{3}}\Biggr|_{-1/\sqrt{2}}^{+1/\sqrt{2}}=0
$$
If we would like to use the result to calculate a definite integral over an interval, we need a primitive that is a continuous function over that interval.
To this end, the two constants can be chosen independently and it is convenient to choose them so to have a unique function continuous in $[-1/\sqrt{2},+1/\sqrt{2}].$ If we choose
$$
C^+=+1/6,\\
C^-=-1/6
$$
we have
$$
\int\sqrt{x^2-2x^4}dx=F(x)=\begin{cases}
-\frac{1}{6}\sqrt{(1-2x^2)^{3}}+\frac{1}{6} & 0\leq x\leq 1/\sqrt{2} \\
+\frac{1}{6}\sqrt{(1-2x^2)^{3}}-\frac{1}{6} & -1/\sqrt{2} \leq x \leq 0
\end{cases}
$$
with $F$ continuous also in $x=0,$ so that, for example
$$
\int_{-1/\sqrt{2}}^{1/\sqrt{2}}\sqrt{x^2-2x^4}dx=\left(0+\frac{1}{6}\right)-\left(0-\frac{1}{6}\right)=\frac{1}{3}>0.
$$
