Modular arithmetic studies the remainders produced when integers are divided by a positive integer n. The expression a mod n represents the remainder when a is divided by n. For example, 17 mod 5 = 2 because 17 = 3 × 5 + 2. In this system, numbers that differ by a multiple of n are treated as equivalent. For example, 7, 12, 17, and 22 all have the same remainder when divided by 5. Modular arithmetic is especially useful for describing repeating patterns, cyclic processes, divisibility, and number-theoretic relationships. A common everyday example is a clock: after 12 hours, the hour hand returns to its starting position. This can be represented using arithmetic modulo 12.
Introduction to Modular Arithmetic
Modular arithmetic is a system of arithmetic in which numbers are considered equivalent when they have the same remainder after division by a fixed positive integer called the modulus.
a mod n = r, where a = qn + r and 0 ≤ r < n
Explanation
Variables
A
The integer being divided.
N
The positive modulus.
Q
The quotient in the division algorithm.
R
The remainder, satisfying 0 ≤ r < n.
Example or application
Problem
Find 29 mod 6.
Solution
Divide 29 by 6: 29 = 4 × 6 + 5. Therefore, the remainder is 5.
Answer
29 mod 6 = 5
Text
For a positive integer n, modular arithmetic considers the remainder after division by n. Every integer has exactly one remainder from 0 to n − 1. Thus, calculations can be performed within a finite system of residue classes.
Key Points
The modulus is a positive integer that determines the size of the modular system.
The possible remainders modulo n are 0, 1, 2, ..., n − 1.
Two integers are equivalent modulo n when their difference is divisible by n.
Modular arithmetic describes cyclic and repeating patterns.
The notation a mod n commonly represents the remainder of a divided by n.
Applications
Representing time on clocks and calendars.
Studying divisibility and remainders.
Analyzing repeating patterns in mathematics.
Developing cryptographic algorithms.
Solving problems involving cyclic schedules and periodic processes.
Learning Outcomes
Define modular arithmetic and identify its modulus.
Calculate the remainder of an integer modulo n.
Identify the possible residues in a modular system.
Explain why modular arithmetic is useful for cyclic patterns.
Practice Questions
Calculate 23 mod 7.
List all possible remainders modulo 6.
Explain why 8 and 20 are equivalent modulo 4.
Represent 15 o'clock on a 12-hour clock using modular arithmetic.
What is the difference between an integer and its residue modulo n?
Related Concepts
Division Algorithm
Congruence Relations
Remainders
Divisibility
Cyclic Groups
Common Mistakes
Confusing the modulus with the remainder.
Assuming that the remainder can be equal to or greater than the modulus.
Treating modular equivalence as ordinary equality.
Forgetting that the standard remainder is nonnegative.
Sources and verification
Sources are shown as provided in the project data. Not every source has yet been independently verified. Please report errors or missing citations.
- Kenneth H. Rosen, Elementary Number Theory and Its Applications
- David M. Burton, Elementary Number Theory
Suggest a correction or source · More in Arithmetic & Number Theory