# Math Help - factorization by finding modular square roots

1. ## factorization by finding modular square roots

Prove that having three distinct solutions of the conguence $x^2=y\mod n$, where $n,\,y$ are known and $n=pq$ is a product of distinct primes, we can find $p$ and $q$ efficiently.

I've managed to prove, with the Chinese remainder theorem, that the congruence always has four distinct solutions and that we can easily find the fourth solution when we have three.

2. ## Re: factorization by finding modular square roots

Originally Posted by ymar
Prove that having three distinct solutions of the conguence $x^2=y\mod n$, where $n,\,y$ are known and $n=pq$ is a product of distinct primes, we can find $p$ and $q$ efficiently.

I've managed to prove, with the Chinese remainder theorem, that the congruence always has four distinct solutions and that we can easily find the fourth solution when we have three.
Suppose that the three solutions are r, s, t: $r^2\equiv s^2\equiv t^2\equiv y\pmod n.$ Then $0\equiv r^2-s^2 = (r+s)(r-s)\pmod n.$ That can only happen if $s\equiv\pm r\pmod n$, or r+s and r–s are equal (mod n) to the two proper divisors of n, namely p and q. In the latter case, we have efficiently found p and q. So we have to deal with the former case, when $s\equiv -r\pmod n$ (we know that r and s are distinct, so we cannot have $s\equiv r\pmod n$).

In a similar way, $(r+t)(r-t)\equiv 0\pmod n.$ But t≠r and t≠–r(=s). Therefore r+t and r–t are equal (mod n) to p and q. So again we have efficiently found p and q.