0

Assume we are given a linear congruence $ax \equiv b \mod n$.

Now let $d = \gcd(a, n) | b$ and let $d > 1$. Then I learned that there are in total $d$ solutions to the linear congruence in $\mathbb Z_n$, all of which can be found in the following way:

  • Create a simpler congruence from the originally given one like so: $(a/d)x \equiv (b/d) \mod (n/d)$.
  • Let $x=c$ be a solution to this simpler congruence. Then all solutions to the originally given congruence are: $c, c + n/d, c + (2n)/d, ..., c + [(d-1)n] / d$.

We can demonstrate that if we find $c$ is a solution to the simpler congruence, then it has to be also a solution to the original congruence.

  • Assuming $x=c$ is a solution, translate $(a/d)c \equiv (b/d) \mod (n/d)$ to the linear Diophantine equation $a/d \times c = b/d + k \times n/d$ for some integer $k$.
  • Multiply through with $d$ gives $ac = b + kn$ or $ac -b = kn$ or $ac \equiv b \mod n$.

Two questions here:

  1. If $c$ is a solution to the simpler congruence, it's not obvious to me that $c + n/d, ...$ are also automatically solutions to the original congruence. Is there a way to show this?
  2. Is there a way to show that there are only $d$ solutions to the original linear congruence in $\mathbb Z_n$? I have found the formula for finding all solutions for a linear Diophantine equation, but I wasn't able to understand it in context of $\mathbb Z_n$.
Sumanta
  • 9,534
BMBM
  • 2,461

1 Answers1

1

1.

$a(c+\frac nd)\equiv b\ \ \text{ mod } n \iff ac+n\frac ad\equiv b \ \ \text{ mod } n $

This is valid, since $d|a$. You have that $ac$ is congruent to $b$ modulo $n$, so:

$\iff b+n\frac ad\equiv b \ \ \text{ mod } n \iff n\frac ad\equiv 0 \ \ \text{ mod } n $

And this is trivially true.

2.

You are already in the context of $\mathbb{Z}_n$ if you think about it. In fact if we want to reason in $\mathbb{Z}$, the solution that you wrote are not the only ones. You wrote these solutions: $c+\frac{jn}{d} \ \ \ j=0,...,d-1$

But working in $\mathbb{Z}$ the general solution is: $c+\frac{jn}{d}+kn \ \ \ j=0,...,d-1 \ \ k\in \mathbb{Z}$ You can easily verify that these are all solutions to the initial equation. The fact is that the solutions that differ of a multiple of $n$ are not interesting because they are congruent modulo $n$. So you can synthetize all the solutions in equivalence classes of the congruence modulo $n$:

$[c+\frac{jn}{d}]_n\ \ \ j=0,...,d-1$

And this are the only solutions if you look at the equation not as a congruence in $\mathbb{Z}$

($ax \equiv b \ \ \text{mod } n$), but as an equality in $\mathbb{Z}_n$ ($[a]_n[x]_n = [b]_n$).

If you want a formal proof that those classes are the only classes that satisfy the congruential equation then let's do it. We have already a solution $c$. Let $c'$ be a solution to our congruential equation. Then:

$a(c-c') \equiv ac-ac' \ \ \text{mod } n$

Since $c,c'$ are both solutions:

$ac-ac'\equiv b-b \equiv 0 \ \ \text{mod } n$

So:

$a(c-c') \equiv 0 \ \ \text{mod } n \iff n|a(c-c')$

Since $d=\text{gcd}(a,n)$, then $n=dk$ and $a=dh$ with $k$ and $h$ coprime:

$\iff dk|dh(c-c') \iff k|h(c-c')$

Since h and k are coprimes:

$\iff k|c-c'$

But $n=dk$ so $k=\frac nd$:

$\iff \frac nd |c-c'$

So:

$\iff c-c'=j \frac nd \iff c'=c+\frac {jn}{d}$

So a general solution is of the form:

$c'=c+\frac {jn}{d}$

But this representation is not unique in $\mathbb{Z}_n$, indeed if $j=0$ or $j=d$, we obtain the same equivalence class(because $c$ and $c'=c+n$ will differ of a multiple of $n$). Now you can easily verify that the solutions with $j=0,1,...,d-1$ are all different(in the sense that they are not congruent modulo $n$) indeed if $k,j \in \{0,1,...,d-1\}$:

$(c+\frac {jn}{d})-(c+\frac {kn}{d})=\frac {(k-j)}{d}n$

And this is not divisible by $n$ because if it was :

$\frac {(k-j)}{d} \in \mathbb{Z} \Rightarrow |k-j| \geq d$

But it's not because $k,j \in \{0,1,...,d-1\}$. So the solutions for $j \in \{0,1,...,d-1\}$ are all different, now we have to prove that they are the only ones(any other solution is congruent to one of them modulo $n$). So let's take a solution:

$c'=c+\frac{qn}{d} \ \ q\neq 0,1,...,d-1$

Clearly $q$ is integer so it must be in one(and only one) congruence class modulo $d$, let's say $q \in [Q]_d$(where we can consider $Q\in \{0,1,...,d-1\}$, because $\mathbb{Z}_d=\{[0]_d,...,[d-1]_d\}$). I want to show that $c+\frac{qn}{d}$ and $c+\frac{Qn}{d}$ are congruent modulo $n$:

$(c+\frac{qn}{d})-(c+\frac{Qn}{d})=\frac{(q-Q)n}{d}$

But since $q \in [Q]_d$ then $q \equiv Q \ \ \ \text{mod }d$, and by definition $q-Q=zd$ , where $z$ is integer:

$\frac{zdn}{d}=zn$

And this proves they are congruent modulo $n$. So a generic solution of the equation is always congruent modulo $n$ to one(and only one) solution of the kind: $c+\frac{jn}{d} \ \ \ j=0,...,d-1$ And so they completely(and withouth repetitions) represent the set of solutions of the equation modulo $n$.

Kandinskij
  • 3,709