solving of quadratic congruence

52 Views Asked by At

let us suppose we have following congruence equation

$${y^2}\equiv {a} \pmod {p}.$$

where $p$ is prime, i now that if for instance $r$ is solution, then $p-r$ is also solution , for instance

$${y^2}\equiv {10} \pmod {13}.$$

i can check all possible starting values of $y$ , for instance

 >> y=1:12;
>> y=y.^2;
>> r=y-10;
>> find(mod(r,13)==0)

ans =

     6     7

which satisfies given theorem, but is that only solution method for prime $p$ ? i know when $p$ is composite , i can make prime factorization and solve system using Chinese remainder theorem , but what about when $p$ is prime?