Worked examples
The question
Question: work out 17 mod 5.
17 mod 5
Mod 5 means: the remainder after dividing by 5.
It is always a whole number from 0 to 4.
mod 5 = the remainder after ÷ 5
always 0 to 4
1 Divide by 5
Divide 17 by 5: 5 goes 3 times, that is 15, and 2 is left over.
17 = 5 × 3 + 2
Careful!
3 is how many times 5 goes in.
Mod asks for what is left over: 2.
Careful: not 17 mod 5 = 3 ✗
2 On the clock
Think of a clock with 5 numbers, 0 to 4.
So 17 mod 5 = 2.
17 mod 5 = 2
3 Check
Multiply back: 5 times 3, plus 2, is 17.
5 × 3 + 2 = 15 + 2 = 17
And 2 is from 0 to 4.
Right!
0 ≤ 2 < 5
Let's look back.
First: divide by 5.
Then: on the clock.
Last: check.
▶ Watch it solved
The question
Question: work out −7 mod 3.
−7 mod 3
Mod 3 means: the remainder after dividing by 3.
It is always a whole number from 0 to 2.
mod 3 = the remainder after ÷ 3
always 0 to 2
1 Divide by 3
Divide −7 by 3.
For a negative number we go down to the multiple of 3 just below it: 3 × (−3) = −9.
Then up 2.
−7 = 3 × (−3) + 2
Careful!
A remainder is never negative.
We go down to the multiple just below, then count up.
Careful: not −7 mod 3 = −1 ✗
2 On the clock
Think of a clock with 3 numbers, 0 to 2.
So −7 mod 3 = 2.
−7 mod 3 = 2
3 Check
Multiply back: 3 times (−3), plus 2, is −7.
3 × (−3) + 2 = −9 + 2 = −7
And 2 is from 0 to 2.
Right!
0 ≤ 2 < 3
Let's look back.
First: divide by 3.
Then: on the clock.
Last: check.
▶ Watch it solved
The question
Question: is 38 ≡ 14 (mod 6)?
38 ≡ 14 (mod 6) ?
This sign means: they leave the same remainder when we divide by 6.
We say congruent.
≡ (mod n): the same remainder after ÷ n
1 Each remainder
Divide 38 by 6: 6 goes 6 times, that is 36, and 2 is left over.
38 = 6 × 6 + 2
14 is 6 × 2, plus 2.
14 = 6 × 2 + 2
Careful!
38 and 14 are different numbers.
The question is only about their remainders.
Careful: compare the remainders, not the numbers
2 Compare the remainders
Both leave 2.
The same remainder.
= 2 = 2
So yes: 38 ≡ 14 (mod 6).
= yes: 38 ≡ 14 (mod 6)
3 Check
Another way: the difference 24 is a multiple of 6.
Same remainders always give a difference that 6 goes into.
Right!
38 − 14 = 24 = 6 × 4
Let's look back.
First: each remainder.
Then: compare the remainders.
Last: check.
Answer = yes: 38 ≡ 14 (mod 6)
▶ Watch it solved