1

$$10x + 20 \equiv 11 \pmod{23}$$

So I know the answer is $6 \mod{23}$. I understand that we subtract $20$ from each side. But how do we do extended gcd on this?

Can you explain the steps involved?

tc1729
  • 3,017

5 Answers5

5

Below are a few ways to solve this modular linear equation. We use fractional modular arithmetic and we massage the fractions so that the quotient is exact, e.g. by pulling out factors and/or replacing $k$ by $j\equiv k$ (colored the same below), for example $\ \color{#c00}{7\equiv 30\, \pmod{23}}$

$$\displaystyle\begin{eqnarray}{\rm mod}\ 23\!:\ \ 10x&\equiv&\, \color{blue}{14} &\,\Rightarrow\,& x&\equiv& \frac{14}{10}&\equiv& \,2\,\left(\dfrac{\color{#c00}7}{10}\right)&\!\equiv&\, 2\left(\frac{\color{#c00}{30}}{10}\right) &\!\equiv& 6\\ \\ \\ {\rm mod}\ 23\!:\ \ 10x&\equiv& \color{blue}{-9} &\,\Rightarrow\,& x&\equiv& \frac{-9}{10}&\equiv&\, 3\left(\dfrac{\color{#0a0}{-3}}{10}\right)&\!\equiv&\, 3\left(\frac{\color{#0a0}{20}}{10}\right) &\!\equiv& 6\\ \\ \\ {\rm mod}\ 23\!:\ \ 10x&\equiv& \color{blue}{-9} &\,\Rightarrow\,& x&\equiv& \frac{-9}{10}&\equiv&\ \ \, \dfrac{-18}{\color{#0a0}{\,\ 20}}&\!\equiv&\ \ \frac{-18}{\color{#0a0}{-3}} &\!\equiv& 6\end{eqnarray}$$

While this may seem a bit ad-hoc at first, it actually works surprisngly well for small numbers - often much more quickly than brute-force application of algorithms. For larger numbers it is generally best to employ an algorithm to compute inverses, such as the Extended Euclidean Algorithm (see this answer for a worked example).

Beware $\, $ The above use of fractions in modular arithmetic is valid only when the denominator is a unit (invertible); else it is a zero-divisor so the quotient need not be unique, e.g. mod $\rm\:10,\:$ $\rm\:4\,x\equiv 2\:$ has solutions $\rm\:x\equiv 3,8,\:$ so the "fraction" $\rm\:x \equiv 2/4\pmod{10}$ cannot designate a unique solution. Indeed, the solution $\rm\:x\equiv 1/2\equiv 3\pmod 5\:$ requires cancelling $\,2\,$ from the modulus too, since $\rm\:10\:|\:4x-2\iff5\:|\:2x-1.\:$

Generally the grade-school rules of fraction arithmetic apply universally (i.e. in all rings) where the denominators are units (invertibles). This fundamental property will be clarified conceptually when one learns in university algebra about the universal properties of fractions rings and localizations.

Bill Dubuque
  • 272,048
3

$$10x+20 \equiv 11 \pmod{23} \implies 10x \equiv -9 \pmod{23} 10x \equiv -9+23 \pmod{23}$$ $$10x \equiv -9+23 \pmod{23} \implies 10x \equiv 14 \pmod{23} \implies 5x \equiv 7 \pmod{23}$$ $$5x \equiv 7 \pmod{23} \implies 5x \equiv 7+23 \pmod{23} \implies 5x \equiv 30 \pmod{23}$$ Hence, $$x \equiv 6 \pmod{23}$$

1

So, $10x\equiv -9 \pmod{23}$. Writing it on some other way, using e.g. $-9\equiv 14$, this is even, and $2$ is coprime to $23$, so we can divide the congruence by $2$: $$10x\equiv 14\pmod{23} \ \implies \ 5x\equiv 7\pmod{23}$$ And the same trick again, use that $7\equiv 30\pmod{23}$, so what we have to solve can be also written as $5x\equiv 30\pmod{23}$ and now again we can divide by $5$ as it is coprime to the modulus.

Berci
  • 90,745
0

Edit: This may not be the most efficient way to solve this particular problem, but is a general method of solving linear congruences such as this.

This is a linear congruence in the variable $x$. Using the definition of a modulus:

$$10x + 20 \equiv 11 \pmod{23}$$

$$\rightarrow 23|(10x + 20 - 11)$$

$$\rightarrow 23|(10x + 9)$$

$$\rightarrow 23y =10x + 9$$

$$\rightarrow 23y - 10x = 9$$

This is now in the form of a Diophantine equation: using the Euclidean algorithm, we can find the solution of:

$$23(-3) - 10(-7)= 1$$ $$23(-27) - 10(-63)=9$$

Meaning that $x=-63$ is one possible solution. We know that $63\equiv 6 \pmod{23}$.

Thus, $x=17$.

Cisplatin
  • 4,675
  • 7
  • 33
  • 58
0

It seems to me to be simpler to multiply by the inverse of 10 (mod 23), i.e., by $7$. Then you get $x$ alone and an easy calculation gives the result. It can be done in one line.

Rodney Coleman
  • 742
  • 3
  • 8