Abstract Algebra – How to Solve a System of Equations with Mod

abstract-algebramodular arithmetic

I'm trying to solve for $a$ and $b$:
$$5 \equiv (4a + b)\bmod{26}\quad\text{and}\quad22\equiv (7a + b)\bmod{26}.$$
I tried looking it up online, and the thing that seemed most similar was the Chinese remainder theorem; however, I couldn't find an instance where it fit something more like what I want to solve. A simple explanation or a reference to one would be most appreciated.

With my (limited) knowledge of algebra, I figured out that $x\ \textrm{mod}\ 26 = x – 26\lfloor\frac{x}{26}\rfloor$, so I tried substituting that into my equations:
$$5=(4a+b)-26\left\lfloor\frac{4a+b}{26}\right\rfloor\quad\text{and}\quad 22=(7a+b)-26\left\lfloor\frac{7a+b}{26}\right\rfloor.$$

And I figured I could do something with that since I got rid of the mod, but… I have never solved an equation with a floor function before.

Best Answer

Since everything is $\bmod{26}$, you can use most of the methods for solving other simultaneous equations. Instead of dividing to get fractions, use modular division (which involves the Euclideam Algorithm).

For example, let's use Gaussian elimination for this problem $$ \begin{align} 12&=2a+b\pmod{26}\\ 15&=9a+b\pmod{26} \end{align} $$ Subtracting the first from the second gives $$ 3=7a\pmod{26} $$ Using the Euclidean Algorithm, we get that $15\times7=105\equiv1\pmod{26}$. So, multiplying both sides by $15$ we get $$ 19=a\pmod{26} $$ Subtracting $2$ times the second from $9$ times the first yields $$ 78=7b\pmod{26} $$ Since $78\equiv0\pmod{26}$, multiplying both sides by $15$ yields $$ 0=b\pmod{26} $$

Using the Euclid-Wallis Algorithm

As described in this answer, we can use the Euclid-Wallis Algorithm to invert $7\bmod{26}$: $$ \begin{array}{rrrrrrr} &&\color{orange}{3}&\color{orange}{1}&\color{orange}{2}&\color{orange}{2}\\ \hline \color{#00A000}{1}&\color{#00A000}{0}& 1&-1&\color{red}{3}&\color{blue}{-7}\\ \color{#00A000}{0}& \color{#00A000}{1}& -3&4&\color{red}{-11}&\color{blue}{26}\\ \color{#00A000}{26}&\color{#00A000}{7}&5& 2& \color{red}{1}&\color{blue}{0} \end{array} $$ This says that $3\times26-11\times7=1$, which says that $-11\times7\equiv1\pmod{26}$. Since $-11\equiv15\pmod{26}$, we also get $15\times7\equiv1\pmod{26}$.

Related Question