Parity magic
A card trick shows how a computer adds one extra row and column so it can find and fix a single mistake.
Steps
- Ask: have you ever had a disc or QR code that would not work? Computers often correct such mistakes automatically.
- Lay out a 5 by 5 square of black and white cards with no pattern.
- Add a sixth row and a sixth column so every row and every column has an even number of black cards. (This extra card is called a parity bit.)
- While everyone looks away, flip exactly one card.
- Find the one row and the one column that now have an odd number of black cards. The card where they cross is the flipped one.
- Pairs practise. Then try flipping two cards. What happens?
Talk about it
- Why does the trick work?
- What happens if two cards flip?
- Where do computers use this idea?
CC BY-SA 4.0
Adapted from CS Unplugged by the University of Canterbury Computer Science Education Research Group (CS Unplugged), licensed CC BY-SA 4.0.
Original lesson, with pictures · License: CC BY-SA 4.0
There are no pictures here. The original lesson has the pictures and printables.
Changes made: Simplified, shortened and translated by Open Cosmos with AI
This adapted lesson is shared under the same license (CC BY-SA 4.0).