← Mathematics

Lesson 2 · 45 min

Modular arithmetic and repeating cycles

Calculate with remainders, recognise congruence and handle division only when it is justified.

Talk to Live Tutor about this lesson

Work with the remainder of an integer

For a positive integer modulus m, division of an integer a can be written, with an integer quotient q and remainder 0 ≤ r < m. Modulo m arithmetic tracks the remainder rather than the entire integer. For example, so 23 has remainder 3 modulo 5. We write 23 ≡ 3 (mod 5). The three-part notation states a relationship; it does not claim the ordinary integers 23 and 3 are equal.

Key equation
a=mq+r
23=5×4+3

Two integers a and b are congruent modulo m when a − b is divisible by m. Thus 18 ≡ 4 (mod 7) because 18 − 4 = 14 is a multiple of 7. Many integers belong to the same remainder class: ..., −10, −3, 4, 11, 18, ... are all congruent to 4 modulo 7. A question often expects the least nonnegative representative, which here is 4. State that representative when the wording simply asks for the remainder.

Normalise negative and large results

For a negative integer, choose a quotient that makes the remainder nonnegative. Since, the least nonnegative residue of −3 modulo 7 is 4. A calculator or programming language may display a negative remainder under a different convention, so use the mathematical condition < m to check it. Similarly, 101 modulo 6 is 5 because. Every result can be reduced by adding or subtracting multiples of the modulus.

Key equation
−3=7(−1)+4
0≤r
101=6×16+5

Under modulo m arithmetic, addition, subtraction and multiplication can be performed on representatives and then reduced. Modulo 7, 5 + 6 = 11 ≡ 4, 2 − 5 = −3 ≡ 4, and 4 × 6 = 24 ≡ 3. Working with small representatives makes a calculation simpler without changing its final remainder. The modulus stays fixed during a problem unless a new one is explicitly introduced. A residue modulo 5 cannot be combined with a residue modulo 7 as though both describe the same class system.

Use congruences without carrying large numbers

If a ≡ b (mod m) and c ≡ d (mod m), then a + c ≡ b + d and ac ≡ bd modulo m. For example, 103 ≡ 5 and 96 ≡ 5 modulo 7, so their product has the same remainder as 25, which is 4. The actual product is 9,888, and dividing it by 7 also gives remainder 4. Congruence properties explain why the small-number method works; it is not a special trick for one chosen pair.

Nonnegative integer powers also preserve a congruence. To find the remainder of 2¹⁰ on division by 5, observe the cycle 2, 4, 3, 1 for successive positive powers. The cycle repeats every four exponents. Since 10 leaves remainder 2 on division by 4, 2¹⁰ has the same residue as 2², namely 4. Alternatively, 2⁴ ≡ 1, so ≡ 1 × 4. Explain the split before replacing a large .

Key equation
2¹⁰=(2⁴)²×2²

Understand arithmetic tables and their identities

The residue classes modulo 5 can be represented by {0, 1, 2, 3, 4}. Adding two representatives and reducing always returns a representative in this set, which is closure. Addition is commutative and associative, with identity 0. Each residue a has an additive inverse that combines with it to give 0; the inverse of 2 modulo 5 is 3. Multiplication is also closed, commutative and associative, with identity 1 for a modulus greater than 1, and distributes over addition.

Construct a small table by applying the same rule to each row-column pair. For an addition table modulo 4, the row for 3 across columns 0, 1, 2, 3 is 3, 0, 1, 2. For multiplication modulo 4, the row for 2 is 0, 2, 0, 2. Notice that a product can be congruent to zero even when neither factor is represented by zero. This feature is one reason ordinary cancellation and division need extra care.

Divide only when an inverse exists

A multiplicative inverse of a modulo m is a residue u such that au ≡ 1 (mod m). For 3 modulo 7, the inverse is 5 because 3 × 5 = 15 ≡ 1. Multiplying 3x ≡ 1 (mod 7) by 5 gives x ≡ 5. A residue has an inverse exactly when it is coprime to the modulus, meaning their greatest common divisor is 1. A simple small table or trial multiplication can find the inverse in elementary examples.

The residue 2 has no multiplicative inverse modulo 6: its products have only residues 0, 2 or 4, never 1. From 2x ≡ 2 (mod 6), it is therefore unsafe to cancel 2 and conclude only x ≡ 1 (mod 6). Both x = 1 and x = 4 work, and more generally x ≡ 1 (mod 3). Ordinary integer division has changed the modulus condition. At this level, verify candidate residues directly whenever the factor being cancelled is not invertible.

Apply repeating cycles to everyday models

A twelve-hour clock cycles after twelve hours. Starting at 10 o'clock, seven hours later gives 10 + 7 = 17 ≡ 5 (mod 12), so it is 5 o'clock. Residue 0 is displayed as 12 on this clock. Days of the week cycle modulo 7: ten days after a Friday is three weekday steps later, which is Monday. Define the starting point and whether the count includes it. “Ten days after” normally means ten full advances, not counting the starting day as day one.

Last digits follow arithmetic modulo 10. Powers of 7 end in 7, 9, 3, 1 and repeat, so 7²⁰⁰ ends in 1 because 200 is divisible by 4. This method concerns the last digit only, not the whole number. Self-check: find the least nonnegative residues of −8 modulo 5 and 47 modulo 6, then solve 3x ≡ 1 (mod 7). Answers are 2, 5 and x ≡ 5 (mod 7). Check the last result by multiplication. A complete solution states the modulus, reduces to the requested representative, and checks that any cancellation was justified.

Topic revision bank

Key rules & principles

  • a ≡ b (mod m) means m divides a − b.
  • Least nonnegative residues lie from 0 to m − 1.
  • Add, subtract or multiply representatives, then reduce.
  • A multiplicative inverse exists only for a residue coprime to the modulus.
  • Clock and digit cycles require a clear starting point.

Worked examples

Find the least nonnegative residue of 103 × 96 modulo 7.
  1. 103 ≡ 5 (mod 7) and 96 ≡ 5 (mod 7).
  2. Multiply small residues: 5 × 5 = 25.
  3. Reduce 25 modulo 7 to 4.

Answer: 4.

Solve 3x ≡ 1 (mod 7).
  1. Find an inverse of 3: 3 × 5 = 15 ≡ 1 (mod 7).
  2. Multiply the congruence by 5.
  3. Then x ≡ 5 (mod 7).
  4. Check: 3(5) = 15 leaves remainder 1.

Answer: x ≡ 5 (mod 7), or x = 5 + 7k for any integer k.

Explain why 2x ≡ 2 (mod 6) has two residue solutions modulo 6.
  1. Test x = 0, 1, 2, 3, 4, 5.
  2. The residues of 2x are 0, 2, 4, 0, 2, 4.
  3. Residue 2 occurs at x = 1 and x = 4.
  4. Cancellation by 2 is invalid modulo 6 because 2 has no multiplicative inverse there.

Answer: x ≡ 1 or 4 (mod 6).

Related videos and resources

Videos load only when you choose, to save data.

Congruences & Modular Arithmetic ← Number Theory

Socratica

Congruence classes, remainders and clock arithmetic. Inverse existence and exam calculations are developed in the original reading.

[Discrete Mathematics] Modular Arithmetic

TrevTutor

Remainders and equivalence classes as modular-arithmetic foundations; further discrete-mathematics material is optional extension.

Sign in to take the topic quiz and track your progress.

Sign in
Next lesson

Fractions, percentages and financial arithmetic →