1. Home
  2. Explore
  3. Mathematics
  4. Modular Arithmetic and Divisibility

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Modular Arithmetic and Divisibility

Speaker 1Speaker 2

Modular Arithmetic and Divisibility

7:17
0:00-7:17
  1. Corey

    Today we’re building a practical understanding of modular arithmetic, starting with divisibility. The key definition is this: for integers a and b, and a positive integer m, a is congruent to b modulo m if and only if m divides a minus b. We write that as a ≡ b mod m.

  2. Anna

    And the phrase “mod m” is really about remainders. Let’s use mod 4. When an integer is divided by 4, its remainder can only be 0, 1, 2, or 3. A remainder of 4 would just be another way of getting remainder 0, because 4 divides evenly.

  3. Corey

    So as we move along the number line, the remainders cycle: 0, 1, 2, 3, then 0, 1, 2, 3 again. For example, 4 has remainder 0 when divided by 4, 5 has remainder 1, and 6 has remainder 2. Going in the negative direction, negative 1 has remainder 3, since negative 1 can be written as negative 4 plus 3.

  4. Anna

    That cycle makes it easy to see why 2 and 6 are congruent modulo 4: both leave remainder 2. But the definition gives us a quicker test than listing remainders. Subtract the numbers and check whether 4 divides the difference.

  5. Corey

    Here, 2 minus 6 is negative 4, and 4 divides negative 4, so 2 ≡ 6 mod 4. Notice what we are not claiming: we’re not saying that 2 or 6 is divisible by 4. We’re saying their difference is divisible by 4, which means they have the same remainder.

  6. Anna

    Try 24 and 14 modulo 6. Their difference is 10, and 6 does not divide 10 evenly. So 24 is not congruent to 14 modulo 6. You can also check the remainders: 24 leaves 0, while 14 leaves 2.

  7. Corey

    That leads to a useful theorem: a is congruent to b modulo m if and only if a and b have the same remainder when divided by m. In notation, that means a mod m equals b mod m. The remainder viewpoint and the divisibility-of-the-difference viewpoint describe the same idea.

  8. Anna

    Let’s connect that theorem to the division algorithm, which writes a number as a multiple of the divisor plus a remainder. For 2 divided by 4, we have 2 = 4 times 0 plus 2, so the remainder is 2. For 6 divided by 4, we have 6 = 4 times 1 plus 2, so its remainder is also 2.

  9. Corey

    So 2 mod 4 and 6 mod 4 are both 2, confirming that the numbers are congruent. For the other example, 24 = 6 times 4 plus 0, while 14 = 6 times 2 plus 2. The remainders differ, so 24 mod 6 is not equal to 14 mod 6, and the numbers are not congruent.

  10. Anna

    Here’s another way to express congruence, and it’s especially useful in proofs: a ≡ b mod m if and only if there is an integer k such that a = b + km. Why does that work? If m divides a minus b, then by the definition of divisibility, a minus b equals km for some integer k. Add b to both sides and you get a = b + km.

  11. Corey

    And the reverse direction matters too, because this is an “if and only if” statement. If a = b + km, subtract b to get a minus b = km. That means m divides a minus b, which by the definition tells us a ≡ b mod m. So each direction follows by reversing the same steps.

  12. Anna

    Now we can prove two important rules for doing arithmetic with congruences. If a ≡ b mod m and c ≡ d mod m, then a plus c is congruent to b plus d modulo m, and a times c is congruent to b times d modulo m. These are implications: given the two starting congruences, we show each conclusion.

  13. Corey

    Use the equation form of congruence. From a ≡ b mod m, write a = b + km for some integer k. And from c ≡ d mod m, write c = d + lm for some integer l. For addition, substitute those expressions: a plus c equals b plus km plus d plus lm.

  14. Anna

    Rearrange that as b plus d plus m times the quantity k plus l. So a plus c minus the quantity b plus d is a multiple of m. That means m divides the difference, and therefore a plus c ≡ b plus d mod m.

  15. Corey

    For multiplication, substitute again: a times c equals the quantity b plus km times the quantity d plus lm. Expanding gives bd plus blm plus kmd plus klm squared. All the terms after bd are multiples of m, so we can factor m out of their sum.

  16. Anna

    That shows ac minus bd is divisible by m, which is exactly the definition we need to conclude ac ≡ bd mod m. The addition and multiplication rules let us replace numbers by simpler congruent numbers before calculating.

  17. Corey

    Let’s see that in action with 7 plus 11 modulo 5. Directly, 7 plus 11 is 18, and 18 leaves remainder 3 when divided by 5. So 7 plus 11 is congruent to 3 modulo 5.

  18. Anna

    Or reduce the terms first: 7 is congruent to 2 modulo 5, and 11 is congruent to 1 modulo 5. The addition rule gives 7 plus 11 congruent to 2 plus 1, which is 3 modulo 5. Same answer, using the theorem.

  19. Corey

    For multiplication, 7 times 11 is 77, which leaves remainder 2 modulo 5. Reducing first gives 7 congruent to 2 and 11 congruent to 1, so their product is congruent to 2 times 1, or 2, modulo 5.

  20. Anna

    You may also see special notation for these operations: a plus-subscript-m b means addition modulo m, and a times-subscript-m b means multiplication modulo m. It signals that we’re doing the operation while working with remainders modulo m.

  21. Corey

    For example, 4 plus 5 modulo 3 can be computed by adding first: 4 plus 5 is 9, and 9 is congruent to 0 modulo 3. For 4 times 5, the ordinary product is 20, and 20 is congruent to 2 modulo 3.

  22. Anna

    So the central habits are: understand congruence through equal remainders, use divisibility of the difference as the definition, and use the equation a = b + km when you need to prove results. Then the addition and multiplication rules let you simplify calculations by reducing numbers modulo m.

  23. Corey

    That gives us the foundation for the next topic: representing integers in different bases, beginning with decimal expansions and moving on to binary, octal, and hexadecimal.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent