Modular Arithmetic Practice Sheet

(Click here for answer sheet)

Solve the following for x

Solution of Linear Algebraic Equations in Modular Arithmetic

Solving linear algebraic equations in a modulo arithmetic system is nearly identical to solving algebraic equations using ordinary arithmetic.

  1. We first must gather our x terms together on one side of the equation by addition or subtraction of x terms.
  2. Next, we combine all constant terms together on the other side of the equation by adding and subtracting.
  3. Finally, if x is multiplied by a constant we must multiply both sides of the equation by the inverse of that constant.

A simple example:

2x + 3 = 4 mod 5

In this example, we have only one x term so step 1. is already completed.
Next, we add the additive inverse of 3 mod 5 (that is 2) to both sides of the equation yielding
2x + 3 + 2 = 4 + 2 (mod 5)

2x + 0 = 6 mod 5

2x = 1 mod 5

Finally, we multiply both sides of the equation by the mutiplicative inverse of 2 mod 5 (that is 3)

3*2x = 3 mod 5

6x = 3 mod 5

x = 3 mod 5 (since 6 = 1 mod 5)

We now check our answer by substituting 3 for x in the original equation, yielding

2*3 + 3 = 4 mod 5

6 + 3 = 4 mod 5

9 = 4 mod 5

Another example

2x - 6 = 2 - x mod 7

x + 2x - 6 = 2 - x + x mod 7 (add x to both sides of the equation)

3x - 6 = 2 mod 7

3x - 6 + 6 = 2 + 6 mod 7 (add 6 to both sides of the equation)

3x = 8 mod 7

5*3x = 5*8 mod 7
(multiply both sides by the multiplicative inverse of the coefficient of x)
15x = 40 mod 7

x = 5 mod 7

check our answer by substituting 5 for x in the original equation, yielding
2*5 - 6 = 2 - 5 mod 7

10 - 6 = -3 mod 7

4 = -3 mod 7

Thus x = 5 is the correct answer since -3 does, in fact, = 4 mod 7