Real World Maths Busters

The Maths Behind Everyday Life

The story, the formula and a worked example — see exactly where this maths shows up in the world around you.

Back to all stories
Technology 3 min read

The hidden digit that catches typos

The last number on every barcode exists only to tell when the others are wrong.

Every product barcode ends in a "check digit". It carries no product information at all. Its only job is to be mathematically consistent with the digits before it, so a scanner can instantly spot a misread or a mistyped number.

A weighted sum that must land on a round number

In a 13-digit barcode, the digits are multiplied alternately by 1 and 3 and added up. The check digit is chosen so the grand total is a multiple of 10. If a scan does not divide cleanly by 10, something was read wrong.

(weighted sum+check)≡0(mod10)(\text{weighted sum} + \text{check}) \equiv 0 \pmod{10}

Finding the missing digit

Take the first 12 digits 4 0 0 6 3 8 1 3 3 3 9 3 and work out what the 13th must be.

Check digit for 400638133393?

  1. 1

    Weighted sum (×1, ×3 alternating)

    4+0+0+18+3+24+1+9+3+9+9+9=894+0+0+18+3+24+1+9+3+9+9+9 = 89
  2. 2

    Next multiple of 10

    90−89=190 - 89 = 1
  3. 3

    Check digit

    The barcode must end in 1 for the total (90) to be divisible by 10.

Answer

The check digit is 1 — any single mistyped digit breaks the divisibility and is caught instantly.

The takeaway

Check digits use modular arithmetic to police themselves. The same idea guards credit-card numbers, ISBNs and bank accounts — a tiny bit of maths that quietly prevents millions of errors.

Back to all stories