Why am I getting the wrong answer when I factor an $i$ out of the integrand? 
Consider the following definite integral:
  $$I=\int^{0}_{-1}x\sqrt{-x}dx \tag{1}$$

With the substitution $x=-u$, I got $I=-\frac{2}{5}$ (which seems correct).
But I then tried a different method by first taking out $\sqrt{-1}=i$ from the integrand:
$$I=i\int^{0}_{-1}x\sqrt{x}dx=\frac{2i}{5}[x^{\frac{5}{2}}]^{0}_{-1}=\frac{2i}{5}{(0-(\sqrt{-1})^5})=-\frac{2i^6}{5}=+\frac{2}{5} \tag{2}$$
which is clearly wrong. 
I understand that $x\sqrt{x}$ is not even defined within $(-1,0)$, but why can't we use the same 'imaginary approach' ($\sqrt{-1}=i$) to treat this undefined part of the function (i.e. the third equality in $(2)$).
I can't find a better way of phrasing my question so it may seem gibberish, but why is $(2)$ just invalid?
 A: If $x\in[-1,\,0)$ then $\Im\sqrt{x}=\sqrt{-x}$, so $\sqrt{-x}=\sqrt{x}/i=-i\sqrt{x}$.
A: I had difficulty understanding the previous answer so am offering an expanded  version.
Taking your first step, you write $\sqrt{-x} = i\sqrt{x}$.  Now try that with $x=-1$. It gives a contradiction,
$$1 = \sqrt{1} = i \sqrt{-1} = i^2 = -1.$$
It is not really fixed if you use the alternative sign for $\sqrt{-1}$ because you obtain
$$ 1 = \sqrt{1} = -i \sqrt{-1} = (-i) \times (-i) = -1 $$
Only if you take different signs for the imaginary part at each square root do you get the answer you want.
Underlying this is a general point about complex valued functions. By convention for real $ x \geqslant 0$, $\sqrt{x}$ is always taken to be the positive root. When $x < 0$ there is no natural convention and $\sqrt{x} $ could be either one of $\pm i\sqrt{-x}$.  The difficulty arises because there cannot be a consistent choice for the root of a negative number that at the same time satisfies the desirable identity $\sqrt{xy} = \sqrt{x}\sqrt{y}$.  That is because in complex analysis the square root $\sqrt{z}$ has a branch point (that is, it is badly behaved) at $z=0$ and it cannot be extended to a well behaved function across the whole complex plane.
A: Fundamentally, your error amounts to the following (mis)calculation:
$$1=\sqrt1=\sqrt{-(-1)}=i\sqrt{-1}=i^2\sqrt1=-\sqrt1=-1$$
It's just that the second minus sign doesn't appear in what you're doing until after the first one was converted to an $i$. I.e., you converted $\sqrt{-x}$ to $i\sqrt x$ before doing the integration, and only later substituted the lower limit $x=-1$.
