# I need help understanding “the inverse”

Towards the bottom of this page. where it says Solving systems of equations modulo 26 is slightly more difficult than solving them normally, but it is still quite easy

How did D go from -15 to 11?

and how is the inverse of D 19? I don't understand how these numbers came up

-
-15 = 11 mod 26. – Euler....IS_ALIVE Aug 22 '12 at 20:33
What is $D$ in the question? – William Aug 22 '12 at 20:35

-15 = 11 mod 26. 11*19 mod 26 = 1.

-
$11$ and $-15$ are the same element in the ring $\mathbb Z / 26\mathbb Z$. More precisely, the sets $\{11 + 26n \ | \ n \in \mathbb Z\}$ and $\{-15 + 26n \ | \ n \in \mathbb Z\}$ are equal. Also, $\{11 * 19 + 26n \ | \ n \in \mathbb Z\} = \{1 + 26n \ | \ n \in \mathbb Z\}$. – Tunococ Aug 22 '12 at 20:41

Hint $\rm\ mod\ 26\!:\, {-}15 \equiv 26-15 \equiv 11,\:$ and $\rm\ \dfrac{1}{-15}\equiv\dfrac{-1}{15}\equiv \dfrac{25}{15}\equiv\dfrac{5}{3}\equiv\dfrac{-21}{3}\equiv -7\equiv 19$

While tricks like the above often work to compute inverses for small moduli, for larger moduli it is more efficient to use the extended Euclidean algorithm.

-

Typically when working with $\mod n$ arithmatic, and especially in applications to arithmetic, we want a numerical value between 0 and $n-1$. When a result is outside of this range, we can add or subtract $n$ enough times to get it into the correct range. In this particular situation, -15 becomes 11 by adding 26 to it.

As to your second question, we can check that 19 is the inverse of 11 $\mod n$ by multiplying them: $11 \cdot 19 = 209$. Now we subtract 26 from 209 until we get a number between 0 and 26. Equivalently, we can divide 209 by 26 and take the remainder, which is 1 in this case. Therefore, $11 \cdot 19 \equiv 1 \mod 26$.

Now if you want to find the inverse of a number, rather than just check for an inverse, we need to use the Euclidean algorithm. (I won't describe it here. If you are unfamiliar with it, you should visit the link.) For this problem, we proceed as follows:

$$\begin{eqnarray} 26 &=& 2 \cdot 11 &+& 4 \\ 11 &=& 2 \cdot 4 &+& 3 \\ 4 &=& 1 \cdot 3 &+& 1 \end{eqnarray}$$

Now that we have reached a remainder of $1$, we rewrite each equation as follows:

$$\begin{eqnarray} 4 &=& 26 &-& 2 \cdot 11 \\ 3 &=& 11 &-& 2 \cdot 4 \\ 1 &=& 4 &-& 1 \cdot 3 \end{eqnarray}$$

Now we work backwards, substituting and simplifying along the way:

$$\begin{eqnarray} 1 &=& 4 - 1 \cdot 3 = 4 - 1 \cdot \left( 11 - 2 \cdot 4 \right) \\ &=& -1 \cdot 11 + 3 \cdot 4 = -1 \cdot 11 + 3 \cdot \left( 26 - 2 \cdot 11 \right) \\ &=& -7 \cdot 11 + 3 \cdot 26 \end{eqnarray}$$

Now we see that $-7 \cdot 11 \equiv 1 \mod 26$. This means that $-7$ is the inverse of $11\mod 26$. Since we have a negative number, we add $26$ to get $19$!

If you have difficulty following this, I strongly suggest that you review modular arithmetic and the Euclidean algorithm.

-