A Guide to Modular Arithmetic

Modular arithmetic sounds like a mathematical subject that will make your head spin. In fact, the term draws images of a math nerd scribbling foreign symbols on a blackboard, but in reality it isn’t that difficult. Anybody can master modular arithmetic with a little bit of practice. In fact, many students apply modular arithmetic every day in the real world. Once it becomes apparent at home, it will be super easy to finish in the classroom.

Feeling restless about modular arithmetic? Relax! Read on to find out more about this crazy math subject to find out how easy it really is!

What is Modular Arithmetic?

Think of time when attempting to understand modular arithmetic. Time keeps going on forever, which means it has no end. However, clocks do not measure time with infinite numbers. A normal clock has a total of 12 numbers, starting at 1 and ending with 12. In other words, our clocks measure time on a 12-hour timetable before starting over again at 1. The numbering of hours goes in a cycle, making time a cyclical concept when using a clock as an instrument. Clocks also measure minutes and seconds in a cyclical pattern.

Humans use cyclical counting in many ways. In fact, cyclical counting falls into a specific type of math called modular arithmetic. You are probably familiar with a linear number line with integers that fall onto a straight line. Think of modular arithmetic as a system of arithmetic for integers that curve around into a circle. In other words, modular arithmetic involves addition, subtraction, multiplication, and division with integers that curve around a circular number line instead of continuing on for infinity.

The length of a linear number line can have a starting and ending number or it can go on forever in either direction. In modular arithmetic, the length of a circular number line is called the modulus. For example, the modulus for a 12-hour clock is 12 because it has 12 different numbers for the number of hours. In addition, the modulus for minutes and seconds is 60 because the clock has 60 different numbers that the hands swing through before turning each minute or hour. So that’s the idea of modular arithmetic in a nutshell.

How to Perform Modular Addition

Let’s talk about how to actually do modular arithmetic. Keep the idea of the clock in mind when performing modular addition. For modular arithmetic with a modulus of 12, also known as arithmetic modulo of 12, think of an actual clock with its’ 12 numbers. For example, 7 + 1 modulo 12 equals 8 because it involves moving forward 1 hour on the clock. In this case, 8 is less than the modulus of 12, making it the same answer in normal math. Easy!

It starts to get tricky when adding numbers that exceed the modulo. For instance, 7+8 equals 15 in normal math. What happens when 7+8 includes the modulo of 12? In non-modular arithmetic the number always equals 15, but it does not work that with modular arithmetic. A modulus of 12 means the numbers wrap around after counting up to 12. So to find 7+8 modulo 12, we need to count forward 8 hours from 7. Remember to start over when getting to 12 and moving onto 1. The answer to 7+8 modulo 12 is 3. Using a clock to help visualize this example, we start at 7 and count forward 8: 8, 9, 10, 11, 12, 1, 2, and finally 3.

How to Perform Modular Subtraction

Modular subtraction works opposite of modular addition. Apply the same concept of counting forward in a clockwise direction, except reversing it around the face of the “clock.” Modular subtraction works by counting backwards around the “clock,” or in a counter-clockwise fashion. For example, (3-7)(mod 12) equals 8. We come up with this answer by starting at 3 on the “clock” and then moving backwards 7 to arrive at 8. Remember that “equals” actually refers to congruency and not equality as in normal arithmetic.

How to Perform Modular Multiplication

Believe it or not, we have already nailed down the hardest part of modular arithmetic. After mastering modular addition and subtraction, the rest comes easy if you understand how to do non-modular multiplication. In fact, modular multiplication involves finding out the multiplication problem using non-modular math and then converting it to its modular form. For instance, (2×9) equals 18 in non-modular math. Now that we’ve figured out the answer the multiplication problem, we can convert it to its modular form. You can find out the answer by starting at 0 on the “clock” and then counting forward 18 to find the answer. For this equation, (2×9)(modulo 12) is congruent to 6.

How to Perform Modular Division

Modular division works in the same way as modular multiplication. Apply non-modular division and then convert to the modular form for the answer. For example, (25/5) equals 5 in non-modular math. When working with a modulo of 12, convert it to modular form by starting at 0 on a 12-hour “clock” and then moving clockwise 5 hours to arrive at the answer.

Follow these links to learn more about modular arithmetic:

by .

Previous post:

Next post: