Why is the number of solutions in a linear congruence $ax\equiv b(mod m)$ equal to the $gcd(a,m)$ such that $gcd(a,m)$ divides $b$?
-
It's not. Try $2x\equiv 1\pmod 4$. – lulu Sep 17 '17 at 12:00
-
what about if gcd(a,m) divides b? just edited my question – TheLast Cipher Sep 17 '17 at 12:03
-
The Mathworld article describes the solutions. – lulu Sep 17 '17 at 12:05
-
Also The Art of Problem Solving discussion is good. – lulu Sep 17 '17 at 12:14
-
alright i'll check them out. – TheLast Cipher Sep 17 '17 at 12:22
1 Answers
Let $\ d = \gcd(A,M)\,$ and $\, a,b,m = [A,B,M]/d = A/d,\,B/d,\,M/d.\ $ Then
$$\begin{align} A x \equiv&\ B\pmod{\!M}\\ \iff\ Ax\ -&\ B\ =\ j M,\quad\, {\rm for\ some}\ \ j\in\Bbb Z\\ \iff\ ax\,\ -&\ b\,\ =\,\ j\, m,\quad {\rm for\ some}\ \ j\in\Bbb Z,\, \text{ by scaling by $d$ or $d^{-1}$} \\ \iff\,\ ax\equiv&\ b\,\ \pmod{\!m}\\ \iff\,\ \ \ x\equiv&\: b/a\!\!\!\!\pmod{\!m}\quad\text{[note $a^{-1}$ exists by $\,\gcd(a,m)=1$]} \end{align}$$
The root $\,x\equiv b/a\pmod{\!m}\,$ lifts to $\,\color{#c00}d\,$ roots $\bmod \color{#c00}{d}m = M\,$ since
$$\begin{align} \bmod{dm}\!:\ \ b/a + jm\equiv&\ b/a + km\\ \iff\qquad\ \ (j-k)m\equiv&\ 0\\ \iff\ md\mid (j-k)m\quad &\\ \iff\ d\ \,\mid\,\ j-k\qquad\ \ \ &\\ \iff\ \ j\equiv k\pmod{\!d} \end{align}\qquad\qquad\qquad\qquad$$
Thus choosing normal reps $\,j=0,1,2,\ldots\,d\!-\!1\,$ yields precisely $\color{#c00}d$ roots $\bmod M,\,$ namely
$$ \{ b/a + j\, m\ : \ j = 0,1,2,\ldots,d\!-\!1\}\qquad\qquad\qquad\quad $$

- 272,048
-
what is the rule that states what you did from $ax\equiv b(\mod m)$ to $x\equiv b/a (\mod m)$? I've seen it before but I forgot. thanks – TheLast Cipher Sep 20 '17 at 14:13
-
@The We multiplied both sides of the congruence by $,a^{-1},,$ which is valid by the Congruence Product Rule. It helps to think of congruences as generalized equalities, since they enjoy many of the same properties of equations (e.g. the linked Congruence Laws). Using a symbol visually similar to an equal sign helps to emphasize that analogy. – Bill Dubuque Sep 20 '17 at 14:21
-
alright I shall study those first, thanks! can you teach me how to think about this more "fluidly"? I don't feel a strong grasp of this modular arithmetic although I do understand intuitively why $ax\equiv b(\mod m)$ means ax-my=b. I still don't feel comfortable with it. – TheLast Cipher Sep 20 '17 at 14:29