Step 8 / 64

Middle school

Comparing remainders

Two integers can differ while having the same remainder.

Start with a concrete example

Share eight sweets among three people. Each gets two, with two sweets left. Now change the number of sweets.

Groups of 32Left: 2

8 = 3 × 2 + 2. Remainder 2.

How this example differs from the definition

This is ordinary division of whole numbers. The proof also uses more structured arithmetic objects.

A small check: try the idea

Compare the numbers in the question with the diagram you are moving. You can try again.

What remains when 8 sweets are shared in whole pieces among 3 people?

Read the answer and reasoning

2 sweets. Give each person 2: 6 are used, and 8 − 6 = 2 remain. In the diagram, set the number to 8.

Build the idea in three steps

  1. Divide an integer by a positive integer n and retain its remainder.
  2. Two integers are congruent modulo n when their difference is divisible by n; for ordinary integers this is the same remainder test.
  3. ZMod n packages arithmetic modulo n. When n is prime, every nonzero residue can be used as a divisor.

A small example

7 and 2 both leave remainder 2 on division by 5. Their difference 5 is divisible by 5.

Lean definition · original excerpt

Mathlib · db584cd · Defs.lean

def ZMod : ℕ → Type  | 0 => ℤ  | n + 1 => Fin (n + 1)

How to read this Lean

For n + 1, Fin (n + 1) provides the finite set of residues. The special case ZMod 0 is ℤ; the remainder example above uses a positive modulus.

Where this idea is used

2. The case of three5. The suspicious parcel6. The scissors incident7. The veterans’ cabinet8. The secret duet9. Two doors to the concert10. A three-note audition11. Borrow a better passport12. The workshops agree13. Pip’s impossible quilt14. The shrinking reservation15. The concert of absolute silence16. The room with no room
I’m lost · Help

Mika’s help desk

Comparing remainders

One thing at a time

Read the three explanation steps first. The Lean source is there for a closer look afterwards; you do not have to read it first.

In simpler words

Two integers can differ while having the same remainder.

Earlier ideas are listed under “Start with these ideas” on this page.

A small clue

7 and 2 both leave remainder 2 on division by 5. Their difference 5 is divisible by 5.

Close this panel to return to the exact place you were reading. These are prepared hints for this page.

Start with the first small story →