Dec 31 2015

Modular Addition Rule Proof

Addition in modular arithmetic is much simpler than it would first appear thanks to the following rule:

This says that if we are adding two integers and and then calculating their sum modulo , the answer is the same as if we added modulo to modulo and then calculated that sum modulo . Note that this equation can be extended to include more than just two terms.

Example
To show how this saves time and the use of a calculator, let’s look at a simple example. Suppose we needed to add a list of large numbers, but were only interested in the value of units the digit, aka the ones column, of the solution. Take:

That problem is too large to do in my head, but I could work it out on paper fairly easily. I could also hunt up a calculator, but there is a quicker  way still using the rule above.

In a decimal system, the units digit is really modulo 10 in disguise. Counting from 0:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …

So when we are looking at the units digit of a decimal number of any length, we are really calculating that number modulo 10. BUT, the addition rule tells us that we don’t even to add up the whole list of numbers as they are to calculate the sum modulo 10. Instead, we first calculate each term modulo 10, and then sum those numbers. So,

Now, that’s addition I can do in my head!

But wait! The sum is greater than 9 which is the reason for having to the sum modulo 10, one last time:

If you’d worked the original addition problem out by hand or by calculator, you would have come to the same answer. The units digit is 7.

Proof

If you’ve read any of my math-related posts, you already know that it is not enough for me to know equations, but I also need to feel like I know how and why they work. In keeping with that neurotic tendency, I offer a proof for the modular addition rule.

Again, our equation is:

and our goal is to prove that the two sides of the equals sign are indeed equal to each other.

The key to doing this is the quotient remainder theorem, aka the Euclidean division algorithm. It tells us that we can rewrite and as:

where  this means that
where this means that

Examining the left hand side of the addition equation first, we have:

Since we are taking , we can eliminate multiples of , leaving us with:

Now we move over to the right hand side of the equation.

Well, that was easy! The two sides of the equation are equal. The proof is done.

There is a similar rule and proof for modular subtraction. If I can keep my momentum, I will post it soon. But if you understood this one, working out the subtraction proof should be no problem at all.