[Math] Show that $937$ is an inverse of $13$ modulo $2436$

discrete mathematics

Use the Euclidean Algorithm to see if an inverse exists.

1) 2436 = 13 * 187 + 5
2) 13 = 5 * 2 + 3
3) 5 = 3 * 1 + 2
4) 3 = 2 * 1 + 1
5) 2 = 1 * 2 + 0

gcd(13,2436) = 1

Find the Bezout coefficients and inverse.

…1) 1 = 3 – 1 * 2
…2) 1 = 3 – 1 * ( 5 – 1 * 3)
…3) 1 = 3 – 1 (5) + 1 (3)
…4) 1 = -1(5) + 4(3)
…5) 1 = -1(5) + 4(13 – 2 * 5)
…6) 1 = -1(5) + 4(13) – 8(5)
…7) 1 = 4(13) – 9(5)
…8) 1 = 4(13) – 9 (2436 – 187 * 13)
…9) 1 = 4(13) – 9(2436) + 1683(13)
…10) 1 = -9(2436) + 1687(13)

Bezout coefficients are -9 and 1687.

1687 is an inverse.

Answer: 937 is not an inverse of 13 modulo 2436.

Best Answer

There is an error in back-substitution going from $3)$ to $4),\,$ namely $\,3 + 1(3) = 2(3),\,$ not $\,4(3).$

I recommend against using the back-substitution version of the extended Euclidean algorithm since it often leads to errors such as above. Instead, using the form described here yields

$$\begin{array}{rrr} 2436 & 1 & 0\\ 13 & 0 & 1\\ 5 & 1 & -187\\ 3 & -2 & 375\\ -1 & \color{#c00}5& \color{#0a0}{-937}\\ \end{array}$$

where each above line $\,\ a\ \ b\ \ c\ \,$ means that $\ a = 2436\, b + 13\, c.\ $ Therefore

$$ -1 \,=\, 2436\cdot \color{#c00}{5}+ 13(\color{#0a0}{-937})\quad $$

Multiplying the above by $\,-1\,$ yields that $\ {\rm mod}\ 2436\!:\ 13\cdot 937\equiv 1,\,$ so $\,13^{-1}\equiv 937$.

The linked post describes the algorithm in great detail, in a way that is easy to remember.


Here is another example computing $\rm\ gcd(141,19),\,$ with the equations written explicitly

$$\rm\begin{eqnarray}(1)\quad \color{#C00}{141}\!\ &=&\,\ \ \ 1&\cdot& 141\, +\ 0&\cdot& 19 \\ (2)\quad\ \color{#C00}{19}\ &=&\,\ \ \ 0&\cdot& 141\, +\ 1&\cdot& 19 \\ \color{#940}{(1)-7\,(2)}\, \rightarrow\, (3)\quad\ \ \ \color{#C00}{ 8}\ &=&\,\ \ \ 1&\cdot& 141\, -\ 7&\cdot& 19 \\ \color{#940}{(2)-2\,(3)}\,\rightarrow\,(4)\quad\ \ \ \color{#C00}{3}\ &=&\, {-}2&\cdot& 141\, + 15&\cdot& 19 \\ \color{#940}{(3)-3\,(4)}\,\rightarrow\,(5)\quad \color{#C00}{{-}1}\ &=&\,\ \ \ 7&\cdot& 141\, -\color{#0A0}{ 52}&\cdot& \color{#0A0}{19} \end{eqnarray}\qquad$$