# If $x^2=y^2$, prove that $x=y$ or $x=-y$

I have a simple question here. I am trying to prove that, given $x^2=y^2$, $x=y$ or $x=-y$. I know exactly why this is true; it's obvious. I'm just unclear on the general format of a proof, as well as how I should specifically write this one.

Any help would be appreciated. Thanks.

-

We have that

$$x^2 = y^2 \iff x^2 - y^2 = 0 \iff (x - y)(x + y) = 0$$

Now we can conclude that either $x - y = 0$ (so that $x = y$) or $x + y = 0$ (so that $x = -y$). Hence, if $x^2 = y^2$, it is true that $x = \pm y$.

The reverse is immediate.

-
which also shows why the original need not be true if we have zero divisors. For example in $\mathbb Z/100\mathbb Z$, we have $15^2=5^2$, but neither $15=5$ nor $15=-5$. – Hagen von Eitzen Aug 27 '13 at 6:03
@HagenvonEitzen Similarly, it shows why it might not hold in non-commutative rings (even not in skew fields without zero divisors) since there $x^2-y^2\ne x^2+xy-yx-y^2= (x-y)(x+y)$. For example in the quaternions $i^2=j^2=k^2$. – Jeppe Stig Nielsen Dec 23 '13 at 0:34

Equivalently to @T's approach, note that we have $$|x|=|y|⟺x=\pm y$$

-
Short and sweet! +1 – amWhy Aug 27 '13 at 11:24
@BabakS. I grok $|x|=|y| \Longleftarrow x=\pm y$. I just sub in $\pm y$ like this ——— $|\pm y| = |y|$. But how $|x|=|y| \Longrightarrow x=\pm y$? How can you break the absolute value to get an equality with no absolute value? – 1eser Sep 6 '13 at 12:00
$|x|=z\implies x=\pm z$, also you have that $|y|=\pm y$. Now do $z=|y|$ and the result follows. – Integral Sep 6 '13 at 12:47
@Integral — you wrote $|x| = z \Longrightarrow x = \pm z$. Hence $|y| = z \Longrightarrow y = \pm z$. Hence $x = y.$ But where's $-y$? Furthermore, you wrote $|y| = \pm y$. I'm discombobulated — Isn't Definition of $|y| = \left\{ \begin{array}{rcl} y & \mbox{if} & y > 0 \\ 0 & \mbox{if} & y = 0 \\ -y & \mbox{if} & y < 0 \\ \end{array}\right.$. – 1eser Sep 7 '13 at 3:33
@1eser The definition you wrote is the same I used. Using your definition note that : if $y\geq0$ then $|y|=y$, and if $y<0$ then $|y|=-y$. In short, $|y|= y$ or $|y|=-y$, and a more short notation is $|y|=\pm y$. – Integral Sep 23 '13 at 12:12

Another approach is to note that $x^2-y^2 = 0$ as a polynomial in $x$ over a field (think $y$ as a constant in that field) has at most $2$ roots (counting multiplicities) because it has degree $2$. This basic fact about polynomials follows from the fact that some $w$ being a root of a polynomial is equivalent to the divisibility of the polynomial by $x - w$, and dividing by $x-w$ makes the degree decrease by $1$, thus for a degree $n$ polynomial I can divide at most $n$ times until I get a constant.

Now that we have justified that equations (one variable polynomials) of degree $2$ over a field have at most two solutions, since $x = y$ and $x = -y$ are two solutions (I exclude the case $y=0$, where the equation has only the zero solution, but with multiplicity $2$) that we find by pure luck, we know that there is no room for more, and we prove the equivalence. As observed in previous comments, all of these arguments are good over any field (but may fail over rings in general).

-