# 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