Big Maths Ideas · Beta

Modular arithmetic

Wrap numbers around a clock and investigate when division has an inverse.

Choose a modulus and select a clock position for a. Change b to add or multiply.

5+9≡2(mod12)5+9\equiv2\pmod{12}
Choose a modulus and select a clock position for a. Change b to add or multiply.01234567891011result 2

Adding b wraps around the clock and always permutes its positions.

Result residue
2
gcd(b, n)
3
Multiplicative inverse of b
None
All residues under this rule
aResult
09
110
211
30
41
52
63
74
85
96
107
118

Residues run from 0 to n − 1. Modular division means multiplying by an inverse; an inverse exists exactly when gcd(b, n) = 1.

Read more about this ideaCornell Maths: modular inverses
Predict, test and explain

Step 1 of 3

Predict

Does 4 have a multiplicative inverse modulo 12?

InvestigateWhen does multiplication visit every position exactly once?

Explore and compare

Choose the investigation above. Predict what will change before you move a control.

Try it in the simulation. Change one thing at a time.

Notes and saved values stay in this tab. They disappear when you reload.

Hints, self-check and connections
Try a self-check

Fixed values, separate from the diagram controls.

Does 4 have a multiplicative inverse modulo 12?

5×5≡1(mod12)5\times5\equiv1\pmod{12}

Hint

An inverse exists exactly when the multiplier and modulus are coprime.

Reveal answer

gcd(4, 12) = 4. Multiplication by 4 repeats residues, so it cannot be undone uniquely.

5−1≡5(mod12)5^{-1}\equiv5\pmod{12}

Build an explanation

Hint 1

An inverse exists exactly when the multiplier and modulus are coprime.

Hint 2

gcd(4, 12) = 4. Multiplication by 4 repeats residues, so it cannot be undone uniquely.

Hint 3

Compare the result with the model, then explain why it occurs.

Worked example

This example uses fixed values, separate from the diagram controls.

Find the inverse of 5 modulo 12.

  1. Multiply 5 × 5 = 25.
  2. 25 leaves remainder 1 when divided by 12.
  3. So multiplication by 5 undoes itself.

Answer: 5.

Connect this idea

Watch out: gcd(4, 12) = 4. Multiplication by 4 repeats residues, so it cannot be undone uniquely.