Card Flip Magic #
The world is noisy place, and errors can occur whenever information is stored or transmitted. Error detection techniques add extra parity bits to data to determine when errors have occurred.
This activity is a magic trick which most audiences find intriguing. In the trick the demonstrator is “magically” able to figure which one out of dozens of cards has been turned over, using the same methods that computers use to figure out if an error has occurred in data storage.
Activity description (PDF) #
Translations and other versions #
- Arabic language version
- Chinese language version
- French language version
- Greek language version
- Hungarian language version
- Italian language version
- Polish language version
- Portuguese (Brazil) language version
- Russian language version
- Slovenian Language Translation
- Turkish language version
See our video page.
Related Resources #
An older version of this activity can be downloaded in PDF format here. The content is similar to the current version, but there’s some extra technical information.
More activities and lessons #
- Centre for Innovation in Mathematics Teaching has the following resources on bar codes developed for their Maths Curriculum:
- The Mathmaniacs web site has a similar activity (lesson A)
- The Magic of Computer Science book, a collection of magic tricks based on Computer Science (including the one in this activity), available as part of CS4FN
- Try Engineering has an activity called Cracking the Code which explores the concept of how computerized barcoding has simplified distributing and pricing of products. Students learn about encoding and decoding, the barcoding system, and how a mathematical formula is embedded in barcoding to safeguard against errors. Students use websites to identify product barcodes, test codes from everyday product, and work as an “engineering team” to come up with the next generation of information embedding systems.
- Frances M. Gasman at Center for Discrete Mathematics & Theoretical Computer Science at Rutgers University has an fully developed lesson plan in Hamming Codes: Detecting and Correcting Errors.
If you want to find out more #
- Wikipedia: Parity Bit
- Wikipedia: Error Correction
- The ISBN example in the books uses the ISBN-10 code. A new code, ISBN-13, started use on 1 January 2007. ISBN-13 also uses a checksum, but has a simpler formula. For details, see the Wikipedia article on ISBN
- Error Correction – Computerphile
- Error Detection and Flipping the Bits – Computerphile
- A TED talk on the prisoner hat riddle, put in a slightly more family-friendly format involving alien overlords who are hungry but logical. The optimal solution relates to parity as described in this activity.
Additional resources #
- Mordechai (Moti) Ben-Ari from the Weizmann Institute of Science, Israel has programmed the Error Detection and Parity Unplugged activity in Scratch which can be downloaded in a zip file of the complete set of activities. Please read the
Curriculum Links #
Great Principles of Computer Science #
ACM K12 Curriculum #
- Level I (Grades K2) Topic 11: Understand how 0s and 1s can be used to represent information, such as digital images and numbers.