# Modular Arithmetic/What is a Modulus?

In modular arithmetic, 38 can equal 14 — what??

You might be wondering how so! (Or you might already know how so, but we will assume that you don't.) Well, modular arithmetic works as follows:

Think about military time which ranges from 0000 to 2359. For the sake of this lesson, we will only consider the hour portion, so let us consider how hourly time works from 0 to 23. After a 24 hour period, the time restarts at 0 and builds again to 23. So, using this reasoning, the 27th hour would be equivalent to the third hour in military time, as the remainder when 27 is divided by 24 is 3 (make sure you understand why this is true as it is vital to understanding everything that follows in this book). So to get any hour into military time we just find the number's remainder when divided by 24. What we really are doing is finding that number modulo 24.

To write the earlier example mathematically, we would write:

which reads as "27 is congruent to 3 modulo 24". Let us try one more example before setting you loose: what is 34 congruent to modulo 4, which can also be written as "34 (mod 4)" which is read as "what is 34 congruent to modulo 4?". We find the remainder when 34 is divided by 4; the remainder is 2. So, .

Now, try some on your own:

Exercises: Definition of Modular Arithmetic Replace the '?' by the correct value. |

Challenge: Definition of Modular Arithmetic These two are a lot harder. Simplify: You do not need to work out what (9 |