Modular Arithmetic on a Clock

Category: Number Theory   Level: 201

9 + 5 = 14 ≡ 2 (mod 12)

Counting mod 12 wraps around a circle of 12 spots, like a clock. Numbers that land on the same spot are congruent: they leave the same remainder after dividing by 12.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Count around a circle

Put 0 to 11 around a circle. After 11 the count wraps back to 0, the way a clock goes from 11 back to 12. Mod 12 just means: count on this circle.

spots: 0, 1, 2, …, 11

Step 1: Count around a circle

Step 2: Start at 9 and add 5

Take 5 hops clockwise from 9. The hops pass 0 and land on 2. Nine o'clock plus five hours is two o'clock.

9 + 5 → 2

Step 2: Start at 9 and add 5

Step 3: Keep counting: the second lap

Write the second lap, 12 to 23, on an outer ring. 14 sits just outside 2. So 14 and 2 are the same spot on the circle.

14 = 1 × 12 + 2

Step 3: Keep counting: the second lap

Step 4: Numbers on one spoke are congruent

Add a third lap. The spoke through 2 holds 2, 14, 26, and so on, plus −10 if you walk backward. They all leave remainder 2 after dividing by 12. That set is a congruence class.

… ≡ -10 ≡ 2 ≡ 14 ≡ 26 (mod 12)

Step 4: Numbers on one spoke are congruent

Step 5: Every number lands on one of 12 spokes

Each spoke is its own class, so the integers split into exactly 12 classes. Two numbers are congruent when 12 divides their difference. For example, 24 and 0 share the top spoke.

a ≡ b (mod 12) ⇔ 12 divides a - b

Step 5: Every number lands on one of 12 spokes

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render modular-clock --out /tmp/modular-clock

Source: svgmath/diagrams/modular.py