I'm trying to understand how to know the numbers of solutions for x^2=a(mod m). I know that if a has roots they are solutions but how could I know the rest of them? Is there a need to use the Chinese reminder here? if so how?
-
1See this question. – Dietrich Burde May 25 '19 at 16:19
-
1The chinese reminder theorem allows you to reduce the problem when $m$ is a prime power, since a solution of $x^2=a\bmod m$ is in correspondence with the system of equations $x^2=a\bmod p_j^{k_j}$ where $m=p_1^{j_1}\dots {p_r}^{j_r}$ – Julian Mejia May 25 '19 at 16:22
-
Thanks. I think I got how to do it with Chinese reminder. I posted an answer and will be glad of someone could confirm if it is the right way to do it. – Idan Daniel May 25 '19 at 16:23
-
Welcome to Mathematics Stack Exchange! A quick tour will enhance your experience. Here are helpful tips to write a good question and write a good answer. For typesetting, please use MathJax. – dantopa May 26 '19 at 02:20
2 Answers
I think I got it: I dismantle m to coprime numbers and check when the x^2=a(mod m) have solutions for each. lets say x^2=11^2(mod 1800) so it has solutions if and only if
x^2=11^2(mod 9)=4(mod 9)
x^2=11^2(mod 8)=1(mod 8)
x^2=11^2(mod 25)=21(mod 25)
Because 1800=9*8*25
x=+-2(mod 9)
x=+-1,+-3(mod 8)
x=+-11(mod 25)
so it has 2*4*2=16 solutions, is it right?
- 151
-
You are right. forgot I need to check numbers modulo. I edited it. is it right now? – Idan Daniel May 25 '19 at 16:47
First, you want to know whether there are solutions: that's where the Legendre symbol comes in; there is a solution to $x^2\equiv a$ mod $m$ iff $\left(\frac{a}{m}\right)=1$. How to compute this Legendre symbol? Well, there are some fine tricks, one of them being the law of quadratic reciprocity.
After finding out it has a solution, one can find solutions the hard way by trying all numbers $1,2,3,\ldots,\lceil m\rceil$. Note that you don't have to checke the other half since if $a$ mod $m$ is a solution, then also $a-m$ mod $m$ is a solution.
There are more methods for finding the solutions but it all comes down to first checking the existence of a solution. For finding all solutions with less work, one can use Tonelli's algorithm, but you need to know about Legendre symbols and Jacobi symbols first.
You may find this post interesting: Number of solutions to $x^2\equiv a\pmod m$
- 1,674
-
Thanks. I am aware of this but is works only if m is odd(at least I only learned Legendre symbol where m is odd). I asked this question because I got stuck on where m is even – Idan Daniel May 25 '19 at 16:27
-
@IdanDaniel Jacobi symbols are the extension of Legendre symbols and they deal with the cases where $m$ is not prime. – Algebear May 25 '19 at 16:28
-
-
@IdanDaniel I should have looked better, but indeed it is defined for positive odd numbers only. – Algebear May 25 '19 at 16:32
-
1Note also that for Jacobi symbols, $\left(\frac{a}{b}\right)=-1$ tells you that $a$ is not a square modulo $b$, but if it is equal to $1$, it is still possible for $a$ to also not be a square modulo $b$. For example, that happens with $-1$ modulo $77$. – Arturo Magidin May 25 '19 at 17:15