101x == 172(mod300)

asked by guest
on Nov 25, 2024 at 12:40 pm



You asked:

Solve the linear congruence $101 x \equiv 172 \pmod{300}$.

MathBot Answer:

There is a unique solution for $x$ in the congruence relation $101 x \equiv 172 \pmod{300}$: $\textcolor{#228B22}{x = 272}$



We want to find $x$, and we have $101 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 = 101$ and a modulus $n = 300$, 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 $101 s + 300 t = 1$.
You may notice that when $s$ and $t$ are integers, this is a definition for $101 s \equiv 1 \pmod{ 300 }$.
According to the definition of modular multiplicative inverse, $s$ is the modular multiplicative inverse of $101$ in mod $300$.

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 & & 101 & 1 & 0 \\\hline 1 & & 300 & 0 & 1 \\\hline 2 & 0 & 101 & 1 & 0 \\\hline 3 & 2 & 98 & -2 & 1 \\\hline 4 & 1 & 3 & 3 & -1 \\\hline 5 & 32 & 2 & -98 & 33 \\\hline 6 & 1 & 1 & 101 & -34 \\\hline 7 & 2 & 0 & -300 & 101 \\\hline \end{array}\] The GCD is $1$, in the remainder column in the second-to-last row, and the value of $s$ is $101$ in the second-to-last row, under the $s$ column.

Checking against the congruence relation $101 s \equiv 1 \pmod{ 300 }$, we can see that $101 \cdot 101 = 10201 \equiv 1 \pmod{ 300 }$.

Multiplying both sides of the relation $101 x \equiv 172 \pmod{300}$ by the modular multiplicative inverse gives us $x \equiv 272 \pmod{ 300 }$.