Prove that $a^2 \equiv b^2 $ mod $p$ implies that $a \equiv \pm b$ mod $p$ Prove that $a^2 \equiv b^2 $ (mod $p$) implies that $a \equiv \pm b$ (mod $p$). Where $p$ is a prime number.
So I know that $a^2 \equiv b^2 $ (mod $p$) implies $p|(a^2 -b^2)$ which implies that $a^2 -b^2 = mp$ for some $m \in \mathbb{Z}$. So $a^2 =b^2 +mp$. 
But I am not sure where to go from here. 
 A: Since $p\mid(a^2-b^2)$, since $a^2-b^2=(a-b)(a+b)$, and since $p$ is prime, $p\mid(a-b)$ or $p\mid(a+b)$.
A: We can write a congruence $x\equiv y\bmod p$ as an equation $x=y$ in the finite field $\mathbb{F}_p$. Then we have $a^2=b^2$ in $\mathbb{F}_p$, which means $(a-b)(a+b)=0$. Since a field has no (non-trivial) zero divisors, it follows $a=b$ or $a=-b$.
A: Just to be different (but essentially exactly the same):
Obviously if $a\equiv \pm b \mod p$ then $a^2 \equiv b^2 \mod p$.  ($a = kp \pm b\implies a^2 = (k^2p \pm 2b)*p + b^2$.) 
There are $p$ possible integers, $m$ so that $0\le m < p$ and for all integers $a$, $a \equiv m \mod p$ for one of these.
Let $0 \le n < m \le \frac {p-1}2$ and let $d = m-n>0$.  Then $m^2 = (n+d)^2 = n^2 + 2nd + d^2$ so $n^2 \equiv m^2 \mod p \implies p|2nd+d^2=d(2n+d)=d(m+d)$.  
But $d< p$ and $m+d<p$ so the prime factors of $d(m+d)$ are less than $p$ and $p|d(m+d)$ is impossible.
Now for any two $a,b$ there are for possibilities:
Either $a \equiv m \mod p$ for some $0\le m \le \frac{p-1}2$ or $a \equiv m \mod p$ for some $\frac{p-1}2 < m < p$.  If the latter then $-m \equiv p-m \mod p$ and $0 < p-m < \frac {p-1}2$. So $\pm a\equiv m \mod p$ for some $m;0\le m \le \frac{p-1}2$.
Likewise $\pm b \equiv n \mod p$ for some $n;0\le n \le \frac{p-1}2$.
The if $a^2 \equiv b^2 \mod p$ then $m = n$ and thus $\pm a \equiv \pm b \mod p$ and $a \equiv \pm b \mod p$.
.....
Just as the other answers assuming if $p|(a+b)(a-b)$ then $p|a+b$ or $p|a-b$ (Euclid's lemma), this answer assumes if $p|N$ then $N$ has a unique prime factorization and $p$ is one of the factors, and further if $N$ has factors, that $p$ is a factor of one of the factors (Unique prime factorization theorem).  
These are essentially the same assumption.
