OER.ai

← Error Detection (Parity Magic Trick)

Kindergarten–Grade 1 reading level

Error Detection (Parity Magic Trick)

Adapted with AI from the original open resource by CS Unplugged. Nothing is invented — only the reading level changes.

Card Flip Magic — Finding and Fixing Mistakes

What Is This About?

Sometimes we send information from one computer to another.
Sometimes we save information on a disk.
We want it to stay the same.

But sometimes something goes wrong.
The information changes by accident.

This activity uses a magic trick.
It shows how to find a mistake.
It shows how to fix it too.

What You Need

  • 36 cards.
  • Each card has color on one side.
  • A metal board, like a whiteboard.
  • Pairs of kids need their own set of 36 cards.

The Magic Trick

Let's be magicians!

First, lay out cards in a square.
Make 5 rows and 5 columns.
Flip some cards up. Flip some cards down.
Mix them any way you like.

Now add one more row.
Add one more column too.
This makes it "a bit harder"!

These extra cards are special.
Pick them so each row has an even number of colored cards.
Pick them so each column does too.

Remember: zero counts as even!

Now close your eyes.
Have a friend flip one card.
Open your eyes.

Look for a row with an odd number of colored cards.
Look for a column with an odd number too.
That row and column show you the flipped card!

Learning the Trick

  1. Lay out your cards, 5 rows and 5 columns.
  2. Count colored cards in each row.
  3. Is the count odd or even?
  4. Add a 6th card to each row.

Make each row's count even.
This new card is called a "parity" card.

  1. Add a 6th row at the bottom.

Make each column's count even too.

  1. Now flip one card.

What happens?
One row turns odd.
One column turns odd.
That's how you find the mistake!

  1. Take turns doing the trick with a friend.

Try More Things!

You can use other objects too.
Anything with two sides works.
Try playing cards.
Try coins — heads or tails.
Try cards with "0" and "1" on them.

What if you flip two cards?
Sometimes you can't tell exactly which two.
But you can tell something changed.
You can guess it's one of two pairs.

What about the bottom corner card?
If it's correct for its column...
It will also be correct for its row!
This always works.

We used "even parity" here.
That means we always keep counts even.
You can also try "odd parity."
Then you always keep counts odd.
This works if both rows and columns are odd count, or both are even count.

A Real Example: Book Numbers

Books have special number codes.
These are called ISBNs.
You can find them on the back cover.

The last digit is special.
It's called a check digit.
It works like our parity cards!

This check digit helps stores know
if a mistake was made
when someone orders a book.

How to find the check digit:

Multiply each digit by a number.
Start with the first digit times 10.
Then the next digit times 9.
Keep going down to times 2.

Add all these answers together.

Example: ISBN 0-13-911991-4

(0×10) + (1×9) + (3×8) + (9×7) + (1×6) + (1×5) + (9×4) + (9×3) + (1×2) = 172

Now divide by 11.

172 ÷ 11 = 15, remainder 7

If the remainder is 0, the check digit is 0.
If not, subtract the remainder from 11.

11 − 7 = 4

Look at the last digit of the ISBN.
It's 4! It matches!

If it didn't match, we'd know there was a mistake.

Sometimes the check digit works out to 10.
Then we use the letter "X" instead.

Grocery items have codes too.
These are called bar codes.
They use a different check method.
If a bar code doesn't match, the scanner beeps.
The worker scans it again.

Be a Book Detective!

Look for real books.
Check their ISBN numbers.
Are the check digits correct?

Common mistakes people make:

  • Changing one digit
  • Swapping two digits next to each other
  • Adding an extra digit
  • Leaving out a digit

Try to find a book with "X" as its check digit.
About 1 in 11 books should have one!

Can you change a digit and still get the same check digit?
What if you swap two digits?
Would the mistake be caught?

Why Does This Matter?

Imagine putting $10 into your bank account.
The worker types in the amount.
It gets sent to a big computer.

But what if something goes wrong on the way?
What if $10 becomes $1,000 by mistake?
That's a big problem for the bank!

We need to catch mistakes in data.
Computers check if data got messed up.

Sometimes we can just send the data again.
But sometimes we can't.
Maybe a disk got damaged.
Maybe it got too hot.
Maybe it got hurt somehow.

What about signals from space?
It takes over 30 minutes for a signal
to travel from Jupiter to Earth!
Waiting to resend would take too long.

So we need two things:

  1. Find the mistake (error detection).
  2. Fix the mistake (error correction).

Computers use the same idea as our card game!
They put bits in rows and columns.
They add parity bits to each row and column.
This helps them find mistakes.
It even shows exactly where the mistake is!
Then they can fix it.

Computers often use even fancier systems.
These can fix many mistakes at once.
Hard disks use lots of extra space for this.
It helps them keep working even if some parts break.

A joke for you:

Q: What do you call this: "Pieces of nine, pieces of nine"?
A: A parroty error! (Like "parity" — get it?)

Original licensed under CC BY-NC-SA 4.0. This adaptation is provided free by OER.ai.