2X = 5 MOD 9

asked by guest
on Nov 18, 2024 at 4:37 am



You asked:

Solve the linear congruence $2 X \equiv 5 \pmod{9}$.

MathBot Answer:

There is a unique solution for $X$ in the congruence relation $2 X \equiv 5 \pmod{9}$: $\textcolor{#228B22}{X = 7}$



We want to find $X$, and we have $2 X$. In normal arithmetic, we would divide to get the answer.
However, division is not well-defined for every number in modular arithmetic. Division in modular arithmetic is better defined by the modular multiplicative inverse.


Modular Multiplicative Inverse

Definition

The modular multiplicative inverse of a given number $a$ is written as $a^{-1}$, for which $a \cdot a^{-1} \equiv 1 \pmod{n}$.

Solution

A number $a$ has a modular multiplicative inverse $a^{-1}$ if and only if $a$ and $n$ are coprime.

For a given base $a = 2$ and a modulus $n = 9$, the modular multiplicative inverse can be computed using the Extended Euclidean Algorithm, shown below.


Extended Euclidean Algorithm

Definition

The Extended Euclidean Algorithm is used to compute two integers, $s$ and $t$, for which the equation $a s + n t = \operatorname{gcd}(a, n)$ is true. It will also produce the modular multiplicative inverse of $a \pmod n$, provided $a$ and $n$ are coprime.

This is because coprime numbers have a GCD of 1, making the equation $2 s + 9 t = 1$.
You may notice that when $s$ and $t$ are integers, this is a definition for $2 s \equiv 1 \pmod{ 9 }$.
According to the definition of modular multiplicative inverse, $s$ is the modular multiplicative inverse of $2$ in mod $9$.

Solution

To set up the initial state, we set $s_0 = 1$, $t_0 = 0$, $s_1 = 0$, and $t_1 = 1$.
For a given step $i$: \[ \begin{align*} r_{i+1} = r_{i-1} - q_{i} r_{i} \\ s_{i+1} = s_{i-1} - q_{i} s_{i} \\ t_{i+1} = t_{i-1} - q_{i} t_{i} \end{align*} \]
Then, we continue until the remainder is $0$. \[\begin{array}{|c|c|c|c|c|}\hline i & \textnormal{quotient }\left(q\right) & \textnormal{remainder }\left(r\right) & s & t \\\hline 0 & & 2 & 1 & 0 \\\hline 1 & & 9 & 0 & 1 \\\hline 2 & 0 & 2 & 1 & 0 \\\hline 3 & 4 & 1 & -4 & 1 \\\hline 4 & 2 & 0 & 9 & -2 \\\hline \end{array}\] The GCD is $1$, in the remainder column in the second-to-last row, and the value of $s$ is $-4$ in the second-to-last row, under the $s$ column.

Checking against the congruence relation $2 s \equiv 1 \pmod{ 9 }$, we can see that $2 \cdot -4 = -8 \equiv 1 \pmod{ 9 }$.

Multiplying both sides of the relation $2 X \equiv 5 \pmod{9}$ by the modular multiplicative inverse gives us $X \equiv 7 \pmod{ 9 }$.