When does $\sqrt{a b} = \sqrt{a} \sqrt{b}$? So, my friend show me prove that $1=-1$ by using this way:
$$1=\sqrt{1}=\sqrt{(-1)\times(-1)}=\sqrt{-1}\times\sqrt{-1}=i\times i=i^2=-1$$
At first sight, I stated "No, $\sqrt{ab}=\sqrt{a}\times\sqrt{b}$ is valid only for $a,b\in\mathbb{R}$ and $a,b\geq0$"
But, I remember that $\sqrt{-4}=\sqrt{4}\times\sqrt{-1}=2i$ which is true (I guess).
Was my statement true? But, $\sqrt{ab}=\sqrt{a}\times\sqrt{b}$ is also valid if one of a or b is negative real number. Why is it not valid for a dan b both negative? If my statement was wrong, what is wrong with that prove?

An alternate way to understand what is happening here is to note that
$$
1=e^{0i}
$$
When we take the square root, we have
$$
1=\sqrt{e^{0i}} = \sqrt{e^{-\pi i}\times e^{\pi i}}
$$
Notice that $e^{-\pi i}=e^{\pi i}=-1$.
Now, since we are working in polar form, we can evaluate the square roots consistently, arriving at
$$
1=e^{-\pi i/2}\times e^{\pi i/2} = -i\times i = 1
$$
Essentially, the problem lies in the "branch cut" that occurs with the square root operation - you must be careful with the evaluation.
To put it another way, $1=e^{2n\pi i}$ for all integer $n$, and the square root function has to respect its specific value (of $n$), as it can take multiple different values depending on that $n$. To get $1=-1$ as in the question, one must simultaneously use $1=e^{0i}$ and $1=e^{2\pi i}$.
