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 Secret Maths in Every Barcode

The last digit of a barcode catches scanning errors.

Every product barcode (EAN-13) ends with a check digit calculated from the other 12 digits. If a scanner misreads one digit, the check will fail — catching the error.

Check Digit Algorithm

Multiply alternate digits by 1 and 3, sum them, then the check digit makes the total a multiple of 10.

Check=(10−(S mod 10)) mod 10\text{Check} = (10 - (S \bmod 10)) \bmod 10

S = weighted sum of first 12 digits

Barcode 978014028033?

  1. 1

    Weighted sum

    9×1+7×3+8×1+0×3+1×1+4×3+0×1+2×3+8×1+0×3+3×1+3×3 = 9+21+8+0+1+12+0+6+8+0+3+9 = 77

  2. 2

    Check digit

    (10−77 mod 10) mod 10=(10−7) mod 10=3(10 - 77 \bmod 10) \bmod 10 = (10 - 7) \bmod 10 = 3
Answer

Check digit is 3

The takeaway

That last barcode digit isn’t random — it’s a mathematical safety net that catches scanning mistakes.

Back to all stories