Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Modular arithmetic is arithmetic that wraps around after reaching a fixed number called the modulus. It is the math behind clocks, calendars, repeating patterns, and many digital systems. Instead of keeping every integer distinct, modular arithmetic groups numbers by the remainder they leave after division.

This makes it a powerful way to study cycles and repeated behavior.

Understanding Math: Modular Arithmetic

A useful way to think about this subject is that each remainder labels a whole family of numbers. In modulo seven, the numbers one, eight, fifteen, and twenty two belong to the same family because each is one step past a multiple of seven. Their actual sizes differ, but their positions in a repeating cycle match.

This is why congruence is more than an ordinary equality sign. It says two values behave identically after the cycle length is taken into account.

When checking a congruence statement, subtract the two numbers. If the difference can be divided evenly by the modulus, the statement is true.

Subtraction works in cycles too, but negative answers need care. Suppose a calculation on a twelve hour clock gives negative four. Add twelve once to get eight, so negative four has the same clock position as eight.

Adding the modulus never changes the position. You can add it repeatedly until the result lies in the usual set of residues. This idea helps with dates.

If today is Wednesday, moving back five days gives Friday. A calendar does not treat negative five as a strange new day.

It moves backward through the same seven positions. Students often make errors by stopping after ordinary subtraction instead of returning the answer to the chosen cycle.

Division is the part that needs the most caution. In ordinary arithmetic, a common factor can usually be cancelled from both sides. In modular arithmetic, cancellation is valid only when that factor has a multiplicative inverse for the chosen modulus.

An inverse is a number that multiplies with a value to leave remainder one. Modulo seven, three has inverse five because three times five is fifteen, which leaves remainder one when divided by seven. Therefore, an equation where three times an unknown leaves remainder one modulo seven has the solution with remainder five.

Modulo twelve, four has no inverse. Every product of four leaves a remainder that is a multiple of four, never one. This happens because four and twelve share a factor.

For a prime modulus, every nonzero residue has an inverse. That fact makes prime moduli especially useful.

These rules appear whenever a system has limited positions or fixed-size storage. A computer may keep only a certain number of bits, so very large calculations effectively keep the final remainder after a fixed power of two. Check digits in identification numbers use remainder rules to catch common typing mistakes.

Public key encryption uses powers and remainders because huge powers can be reduced step by step without writing the huge number itself. When learning, state the modulus every time. The same number can have different residues in different systems.

Reduce numbers during a long calculation to keep it manageable, but preserve the operation carefully. Most importantly, do not assume division or cancellation behaves like it does with ordinary fractions.

Key Facts

  • a ≡ b mod n means n divides a - b.
  • The possible residues mod n are 0, 1, 2, ..., n - 1.
  • To add modulo n, add normally and take the remainder: (a + b) mod n.
  • To multiply modulo n, multiply normally and take the remainder: (ab) mod n.
  • If a ≡ b mod n and c ≡ d mod n, then a + c ≡ b + d mod n and ac ≡ bd mod n.
  • Clock example: 8 + 7 = 15, and 15 ≡ 3 mod 12, so 8 + 7 ≡ 3 mod 12.

Vocabulary

Modulus
The modulus is the positive integer that sets the size of the repeating cycle in modular arithmetic.
Residue
A residue is the remainder left after dividing an integer by the modulus.
Congruence
Congruence means two integers have the same remainder when divided by the same modulus.
Remainder
The remainder is the amount left over after division by a whole number.
Check digit
A check digit is an extra digit calculated with arithmetic rules to help detect errors in numbers such as barcodes or identification codes.

Common Mistakes to Avoid

  • Writing a ≡ b mod n when a and b only look close. Congruence depends on whether a - b is divisible by n, not on how near the numbers are.
  • Forgetting to reduce the final answer. In modular arithmetic, answers are usually written as residues from 0 to n - 1.
  • Treating division like ordinary division modulo n. Modular division only works when the divisor has a multiplicative inverse modulo n.
  • Using the wrong modulus in a clock problem. A 12-hour clock uses mod 12 for hour positions, while a 24-hour clock uses mod 24.

Practice Questions

  1. 1 Compute 19 + 28 mod 12 and write the answer as a residue from 0 to 11.
  2. 2 Compute 7 × 9 mod 13.
  3. 3 A check digit system uses remainders mod 10. Explain why two numbers that differ by a multiple of 10 would have the same check digit in this simple system.