Study materials · photonresources.comClasses with our teachers · Photon AcademyFor IB Diploma students worldwide

Maths IA · Algebra and functions · topic 9 of 97

Check digits: how do barcodes catch mistakes? · IB Maths IA idea: guide, sample graph and step-by-step plan

prove it, then test it

Every barcode ends in a digit that checks the others. Swap two digits and the scanner usually shouts, but sometimes it stays quiet. You're going to prove exactly when it stays quiet.

Difficulty●●○ Medium
KitA few books or packs with barcodes, Python or a spreadsheet, pen and paper
TimeAbout 12 to 15 hours
FitsAA SL2 of 3AA HL3 of 3AI SL2 of 3AI HL2 of 3
  • ✓ you like proving that something is always true
  • ✓ you want a topic where the maths is hidden inside everyday objects
  • ✓ you enjoy finding the case that breaks a rule

The big idea

A check digit is chosen so that a weighted sum of all the digits fits a rule, for example a multiple of 10 or of 11. Barcodes, book numbers and bank accounts all work this way. A mistake is caught when it breaks the rule. For a single wrong digit and for two neighbouring digits swapped, you can say exactly when the sum changes, using nothing more than remainders. The weights and the modulus decide everything. Some schemes catch every swap of neighbours and some miss a whole family of them. Prove which is which, test your claims on numbers you generate yourself (never real ones), and work out how often each scheme misses an error when the mistakes are random.

Make it yours: pick one twist

Copying a classic won't show your choices. Pick one of these (or invent your own) and your IA becomes yours.

Swipe for more twists →

Prove ISBN-10 catches everything

Show that changing one digit, or swapping two neighbours, always changes the weighted sum modulo 11.

→ A proof about remainders. Explain why 11 matters: what goes wrong if the modulus is 10 or 12?
Find the barcode blind spot

Show which neighbour swaps leave the weighted sum modulo 10 unchanged when the weights are 1 and 3.

→ A short proof gives a list of digit pairs. Count them and say what share of swaps they are.
Check a card-number rule

Work through the doubling-and-adding check used on payment cards, with numbers you invent, and find its blind spots.

→ A rule with a conditional step. You must prove what it catches, not only try examples.
Compare detection by simulation

Generate valid codes for each scheme, make random mistakes and count how many are caught.

→ A probability result to set against your proofs. Where they disagree, one of them is wrong.
Design a better scheme

Choose new weights and a modulus and show your scheme catches more swaps, then say what it costs.

→ An optimisation with trade-offs: length, ease of use and which errors people really make.
Long codes with a big prime

Study the 97 check used for bank account numbers: write the rule and test its detection rate.

→ Big numbers and remainders. The prime gives strong guarantees, which you can prove.

Your Maths IA research question: run the check

which scheme? which mistake?

Write your own question first. Then make sure it ticks every box:

  • Names the scheme or schemes and the kinds of mistake you will test: one wrong digit, a swap or something else.
  • Says which results you will prove and which you will check by simulation, and how many codes you will test.
  • Defines the modulus and every weight, so someone can rebuild a valid code from your page.
  • Uses made-up or self-generated numbers only. No real card, account or ID numbers appear anywhere.
  • Says what a 'miss' means and how the rate is measured, over which errors.
Stuck on your question?Get an RQ Check: each question is scored on 5 points, with what to fix. Your first one is free.
Get an RQ Check

The set-up

Multiply each digit by its weight, add them up and ask whether the total fits the rule. Draw the scheme you study, with made-up digits.

a made-up 13-digit code: 12 digits + 1 check digit3×137×3213×136×3184×147×3213×130×302×126×3186×169×3274×14total = 130valid when the total is a multiple of 10 (total mod 10 = 0)weights alternate 1, 3, 1, 3...the check digit is chosen to makethe total fit. Which slips get through?

How your Maths IA could be laid out

The usual order for a topic like this, what each part needs to show, and roughly how much of your 12 to 20 pages it takes. The words are all yours.

Aim and context~1 page
Where check digits are used, which schemes you will study and which mistakes you expect them to catch.
Remainders you need~1.5 pages
What 'mod' means, how remainders add and multiply, and why a prime modulus helps. Every rule you use is stated.
One scheme in full~2 pages
The weights, the rule, how the check digit is found, and two worked examples with made-up numbers.
What it catches~3 pages
A proof for a single wrong digit and for a swap of neighbours, step by step.
What it misses~2 pages
The blind spots as a list or a grid, with the reason, and a count of how many there are.
Testing by simulation~2 pages
Your code or spreadsheet, the number of codes tested and a table of detection rates next to your proofs.
Conclusion~1 page
Back to your aim: what each scheme catches and misses, with numbers.
Evaluation~2 pages, the biggest part!
Which mistakes people really make, which you did not test, and whether stronger schemes would be worth the cost. Say which limit matters most.
Bibliographynot counted
Where each scheme's rules came from.

What your Maths IA graph could look like

mark 10, 11 and 97

A made-up result to show the form of a strong graph, not the answer: the share of swaps of neighbours caught by a weighted check against how large the modulus is. Yours will look different. example only

2224262820102030405060Modulus m of the checkRandom errors missed / %model: about 100/m % missedyour simulation (made-up)bigger modulus,fewer random missesILLUSTRATIVE · MADE-UP DATA
  • A good graph here compares your formula for the miss rate with a simulation. Plot both.
  • Axis labels say what is being counted: a percentage of errors, and the modulus as a plain number.
  • Mark the moduli the real schemes use: 10, 11 and 97.
  • Plot the simulated points. If they sit off the curve, work out why before you write the conclusion.
  • Another graph to consider: misses against the kind of error, one bar for each scheme.

The maths in action

worked through, not sketched!

The graph above was a sketch with made-up numbers. This figure works the idea through from the model itself, so you can see what a finished figure looks like. The source line under it says where every number comes from.

Left: a 10 by 10 grid with red cells where the two digits differ by 5, and two rings at 0 and 9. Right: bars showing 0 percent missed for ISBN-10 and mod 97, about 11 percent of adjacent swaps missed by EAN-13, and 100 percent of swaps two apart missed by EAN-13 and Luhn.
(a) The 10 of 90 digit pairs whose swap EAN-13 cannot detect (difference 5); Luhn misses only 0 and 9. (b) Simulated share of errors missed: none for ISBN-10 and mod 97; EAN-13 misses 11% of adjacent swaps; swaps two apart always pass EAN-13 and Luhn.Source: Computed here: 2000 randomly generated valid codes per scheme with every single-digit error and every swap tried (no real numbers).

Your game plan

Tick steps off as you go. We'll remember on this device.

0 of 10 done

  1. Read and predictLook at the check digit on a book or a pack. Before calculating, guess which kinds of mistake it catches.
  2. Learn the remainder rulesPractise remainders until you can state and use the rules for adding and multiplying them. Say which you will use.
  3. Work one code by handTake one scheme and compute the check digit of a made-up number by hand. Check it against the rule.
  4. Trial run (1 lesson)Write code or a spreadsheet to compute check digits and test whether a changed number is caught. Compare with your hand work on three numbers.
  5. Prove the catchesProve that a single wrong digit is always caught and find the condition for a swap of neighbours to be caught.
  6. Find the missesList the swaps that slip through, and prove the list is complete, not just that your examples work.
  7. SimulateGenerate many valid codes, apply random mistakes and count what is caught. Compare each rate with your proof.
  8. Go further, with a reasonCompare two schemes, or design your own and test it. HL: say why your choice of modulus and weights makes the proofs work.
  9. Reflect as you goAfter every result, write one line on what it means for a shop or a bank, and what you assumed. These lines become your evaluation.
  10. Cut, check, then sendCheck every proof is complete, every table has labelled rows and columns and the conclusion answers your aim. Then send your teacher one draft.

The maths you'll use

  • Remainders and weighted sums – Write the rule as and use that remainders add and multiply to find how a change moves the sum.
  • Proof by direct argument – Show a change cannot be a multiple of 11 for , so every single error is caught.
  • Counting cases – Count the digit pairs with a multiple of 10, giving the 10 swaps EAN-13 misses of 90.
  • Probability – Treat random errors as equally likely, find detection rates as fractions of cases and compare with simulation.
  • Technology – A short program or spreadsheet that builds valid codes, introduces errors and counts catches.

Key equations

Syllabus links

  • 1.6Simple deductive proof
  • 1.15Proof by induction, contradiction and counterexampleHL
  • 4.5Basic probability and expected frequency
  • 4.6Venn and tree diagrams, combined events

Read up first

Data and sources to start from

Codes you generate yourself with a program, plus the published rule for each scheme. Use made-up numbers only.

References to cite

  1. GS1. (2026). Check digit calculator and barcode specifications. https://www.gs1.org/
  2. International ISBN Agency. (2026). ISBN users' manual. https://www.isbn-international.org/
  3. Gallian, J. A. (1991). The mathematics of identification numbers. The College Mathematics Journal, 22(3), 194-202.

Cite what you actually use, in your own format, and say where each number came from.

Traps to avoid in this Maths IA

made-up numbers only
  • Testing a few examples and calling it a proof. Show the argument works for every digit.
  • Using a modulus that is not prime and not saying what that costs.
  • Using a real card, account or ID number in the working. Generate your own numbers.
  • Forgetting that the weights depend on position, and counting positions from the wrong end.
  • Reporting a detection rate with no sample size or no definition of which errors were tried.
  • Treating every mistake as equally likely when real typing errors are not.

More Maths IA ideas like this

Make sure it's yours

This guide shows how a topic like this is usually approached. It is not an IA. Your question, choices, data, analysis and words must be your own: change something, tell your teacher where the idea came from, and follow your school's rules on outside help.

Get your RQ checked · first one free