TITLE: Simple Complex Number Problem: $1 = -1$
QUESTION [5 upvotes]: 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*}
Instead, had I used the correct definition of i:
\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)$.

REPLY [4 votes]: 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.
For the reader who may be interested in algorithms see for example
Thomas Breuer. sam@math.rwth-aachen.de
Integral Bases for Subfields of Cyclotomic Fields.
AAECC 8, 1997, 279-289
https://doi.org/10.1007/s002000050065
Abstract. Integral bases of cyclotomic fields are constructed that allow to
determine easily the smallest cyclotomic field in which a given sum of roots of
unity lies.  For subfields of cyclotomic fields integral bases are constructed
that consist of orbit sums of Galois groups on roots of unity. These bases are
closely related to the bases of the enveloping cyclotomic fields mentioned above.
In both situations bases over the rationals and over cyclotomic fields are treated.