Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$P$ is prime number. Prove the only solution for congruence $$x^2 \equiv y^2\pmod{p} $$ are $$x \equiv\pm y\pmod{p} $$ and give an example that exist other solution if n is composite number.

share|cite|improve this question
up vote 2 down vote accepted

Hint $\ $ By $\rm\: p\:$ prime, $\rm\ p\mid (x\!-\!y)(x\!+\!y)\:\Rightarrow\:p\mid x\!-\!y\ \ or\ \ p\mid x\!+\!y$

Conversely, use $\rm\ 2\mid a\!-\!b\ $ $\Rightarrow$ $\rm\ ab\, =\, \left(\dfrac{a+b}2\right)^2 -\left(\dfrac{a-b}2\right)^2\ $

For example, for $\rm\, a,b= 5,3\!:\ \ 15 = 4^2\! - 1^2,\ $ so $\rm\ 4^2\equiv 1^2,\ 4\not\equiv \pm1\pmod{15}$

share|cite|improve this answer

The congruence $x^2\equiv y^2\bmod p$ is equivalent to the equality $x^2-y^2=0$ in the quotient $\Bbb Z/\Bbb Z p$. But $\Bbb Z/\Bbb Z p$ is a field, thus $$ x^2-y^2=(x+y)(x-y)=0 $$ implies either $x+y=0$ or $x-y=0$.

As for the counterexample for a composite modulo, $$ 2^2\equiv 0^2=0 \bmod 4 $$ but $2\not\equiv\pm0=0\bmod 4$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.