Simple Complex Number Problem: $1 = -1$ [duplicate]

Possible Duplicate:
-1 is not 1, so where is the mistake?

I'm trying to understand the exact point of failure in the following reasoning:

\begin{equation*} 1 = \sqrt{1} = \sqrt{(-1)(-1)} = \sqrt{\sqrt{-1}^2\sqrt{-1}^2} = \sqrt{(\sqrt{-1}\sqrt{-1})^2} = \sqrt{-1}\sqrt{-1} = \sqrt{-1}^2 = -1. \end{equation*}

I've been previously told that the problem is due to square root not being a function in C; which I found totally unhelpful. Could someone please explain the problem here in simpler terms.

Edit:

Thank you all for your comments in trying to help me understand this. I finally do. Following is the explanation on my problems in understanding this, in case it'll be of any help to anyone else.

My problem was really due to using an incorrect definition of i: $i = \sqrt{-1}$. While the correct definition would be: $i^2 = -1$.

My incorrect definition led me reasoning, such as (which superficially seemed to give expected results. I see now that this is incorrect, too):

\begin{equation*} \sqrt{-9} = \sqrt{9 * (-1)} = \sqrt{\sqrt{9}^2 \sqrt{-1}^2} = \sqrt{(\sqrt{9} \sqrt{-1})^2} = \sqrt{9} \sqrt{-1} = 3i. \end{equation*}

\begin{equation*} {(xi)}^2 = x^2i^2 = -x^2 = -9, \\ x^2 = 9, \\ x = +- 3. \end{equation*}

Now, analyzing the equations in the original problem, I can see at least the following two errors:

1) In the third =, I'm relying on $-1 = {\sqrt{-1}}^2$, while I should be relying on: $-1 = (+-\sqrt{-1})^2$ which would of course give two different branches. Hmm.. on the second reading, this isn't really a problem, as even with the two separate branches, both of them will lead to the result in the next step.

2) In the fifth =, I'm relying on $\sqrt{i^4} = i^2$, which would be correct, if i was a non-negative number in R. But as i is the imaginary unit and in C: $\sqrt{i^4} = \sqrt{i} = +-(1/\sqrt{2})(1 + i)$.

-

marked as duplicate by Grigory M, Aryabhata, falagar, Qiaochu Yuan, Larry WangAug 24 '10 at 16:53

See also the discussion at math.stackexchange.com/questions/1211/… . This kind of stuff seems to come up a lot here... –  Qiaochu Yuan Aug 24 '10 at 16:46
Yes, they come up a lot, because people here are bad at explaining things at a level below their own. I'm still left wondering what exactly it wrong with the above. –  Sami Aug 24 '10 at 17:05
Sami, in general one has to put in a lot of thought and work themselves to even see what it is they do not understand as well as extracting understanding from peoples comments. It's something to start practicing as early as possible. –  anon Aug 24 '10 at 17:10
If you consider $\sqrt{x} = y$ as a short hand notation for $x = y^2$ and start rewrite the derivation in this explicit way it should become clear where the error creeps in. –  anon Aug 24 '10 at 17:12
@Sami: Actually, I think the point of failure in your reasoning above is different than in the linked question. Across your 5th =, you rewrite $\sqrt{z^2}$ as $z$ (for $z=\sqrt{-1}\sqrt{-1}$), but $\sqrt{z^2}\neq z$. For $z\in\mathbb{R}$, $\sqrt{z^2}=|z|$; for $z\notin\mathbb{R}$, it's a bit more complicated, but again becomes an issue of defining principal square roots and/or there being more than one root of a complex number. –  Isaac Aug 24 '10 at 18:59

You need to pay attention to branches of multivalued functions, e.g. see the Wikipedia explanation here. Similar less-trivial questions often arise when symbolic mathematical sotfware systems exhibit bugs due to failure to stay on principal branches, e.g. see this thread where John McKay asks what your favorite system returns for $(-1)^{5/9} - (-1)^{2/9} - (-1)^{8/9}$. You may find such discussions instructive.