No history yet

Introduction to Modular Arithmetic

Thinking in Circles

Imagine a clock. If it's 10 o'clock now, what time will it be in 5 hours? It won't be 15 o'clock. Instead, you'd say it will be 3 o'clock. You instinctively know that once you pass 12, the count starts over.

This is the core idea of modular arithmetic. It's a system where numbers "wrap around" after reaching a certain value. That value is called the modulus.

On a standard clock, the modulus is 12. We count up to 12, and then we loop back to 1. For a 24-hour clock, the modulus is 24. This wrap-around logic isn't just for telling time; it's a fundamental concept in mathematics.

The key is the remainder. In modular arithmetic, we only care about the remainder after dividing by the modulus. For example, 15÷1215 \div 12 is 1 with a remainder of 3. So, in modulo 12, the number 15 is treated as 3. This is why 15 hours past midnight is 3 a.m.

Speaking Modulo

Mathematicians use a specific notation for this relationship. Instead of using an equals sign, we use the congruence symbol, which is \equiv. It means two numbers have the same remainder when divided by a particular modulus.

The formal way to write this is:

ab(modn)a \equiv b \pmod{n}

This is read as "aa is congruent to bb modulo nn." It means that aa and bb have the same remainder when you divide them by nn. The number nn is our modulus.

Let's go back to our clock example. We can say that 15 is congruent to 3 modulo 12.

153(mod12)15 \equiv 3 \pmod{12}

This is true because 15÷1215 \div 12 leaves a remainder of 3, and 3÷123 \div 12 also leaves a remainder of 3. They are equivalent in this system.

Here are a few more examples with a different modulus, say, 5.

CongruenceWhy It's True
100(mod5)10 \equiv 0 \pmod{5}10÷510 \div 5 has a remainder of 0.
72(mod5)7 \equiv 2 \pmod{5}7÷57 \div 5 has a remainder of 2.
183(mod5)18 \equiv 3 \pmod{5}18÷518 \div 5 has a remainder of 3.
14(mod5)-1 \equiv 4 \pmod{5}1÷5-1 \div 5 has a remainder of 4. (Think of it as one step before 0 on the circle.)

Modular Operations

You can perform familiar operations like addition, subtraction, and multiplication in modular arithmetic. The process is simple: do the operation as you normally would, then find the remainder with respect to the modulus.

Let's work in modulo 7. This is like a week, where day 0 could be Sunday, day 1 Monday, and so on, wrapping around after day 6 (Saturday).

Rule: Perform the operation, then divide by the modulus and take the remainder.

Addition What is 5+45 + 4 in modulo 7?

First, add normally: 5+4=95 + 4 = 9. Then, find the remainder when 9 is divided by 7. The remainder is 2. So, 5+42(mod7)5 + 4 \equiv 2 \pmod{7}.

If it's Friday (day 5) and you have an event in 4 days, it will be on a Tuesday (day 2).

Subtraction What is 363 - 6 in modulo 7?

First, subtract normally: 36=33 - 6 = -3. Finding the remainder of a negative number can be tricky. An easy way is to keep adding the modulus until you get a positive number. Here, we add 7: 3+7=4-3 + 7 = 4. So, 364(mod7)3 - 6 \equiv 4 \pmod{7}.

If today is Wednesday (day 3) and you want to know what day it was 6 days ago, it was a Thursday (day 4).

Multiplication What is 6×46 \times 4 in modulo 7?

First, multiply normally: 6×4=246 \times 4 = 24. Then, find the remainder when 24 is divided by 7. Since 24=(3×7)+324 = (3 \times 7) + 3, the remainder is 3. So, 6×43(mod7)6 \times 4 \equiv 3 \pmod{7}.

These basic operations are the building blocks of modular arithmetic. By focusing on remainders, we open up a different way of looking at numbers, one that's surprisingly useful in many areas.

Now, let's test your understanding of these new concepts.

Quiz Questions 1/6

What is the fundamental concept behind modular arithmetic?

Quiz Questions 2/6

What does the congruence symbol (\equiv) signify in the expression ab(modn)a \equiv b \pmod{n}?

With these basics, you can now see numbers not just on an infinite line, but also on a repeating circle.