## Activity Summary

When sending a message between two people, or two computers, the message can often be distorted in the process. One person can mishear another and likewise the signal being transferred between computers can be distorted by electrical interference. Humans can often detect errors when presented with new information if the information doesn’t make sense or doesn’t fit the context. However, computers do not possess this intuition and require methods of error checking when transferring information; the simplest of these methods is called “bit parity”. This activity explores distortion of messages transferred between humans and between computers and how each can evaluate if the message sent is the same as that received.

Learn more in this video!

## Activity Procedure

**Big Ideas**

- As humans, we can often tell if when a message is distorted in transmission.
- Computers don’t have an intuitive sense of what is a reasonable message is - they need a way of checking if it makes sense.
- Computers rely on simple mathematical concepts to verify information.

### Opening Hook: Telephone

- The first person in the line or circle whispers a word or phrase into the ear of the person sitting or standing to their right. The game continues by players whispering the phrase to their neighbors until it reaches the last player in line.
*Ask*the participants if the final message matches the original (it likely will not) - why not?*Explain*the messages can also be distorted when they are passed between computers.*Ask*how participants think computers can verify if a message has been distorted or not (we need to tell a computer how to do this).

### Section 1: Parity Magic

1. Introduce this activity by describing how communications have “loss” or “noise” associated with them, and that we need a way to ensure that our messages (email, text messages, phone calls etc.) get from the sender to the receiver without errors.

2. Announce that the class will send a coded message to one instructor, who is sent out of the room

- Introduce the parity magic cards, which have Url on one side and Bitsy on the other
- Set out the cards so that everyone can see in a 4x4 grid, make sure that there is a mix of Url and Bitsy cards
- Go around the class and let each student take a turn flipping a card
- Once everyone has had a turn, announce that this is the class’ message to the other instructor
- Lay out one more row and column (the parity row and column - making it so that there is an even number of Url icons in each row and column)
- Choose one camper as the “interference” and let them flip one final card
- Call in the instructor who has been patiently waiting outside and watch as they can instantly tell which card was interfered with (they simply match up the row with an odd number of Urls with the column that has an odd number of Urls)

3. Try this trick several times with the entire group. After a few times, assure them it’s not magic.

- Instead say it's MATH and it's exactly how a computer verifies incoming messages!

4. Ask to see if the group can determine how you are able to always figure out which card was flipped.

- Keywords/phrases are “pattern”, “even and odd”, “parity”.

5. If the group has not figured it out, introduce the concept of parity in the context of communications as a hint, repeat the trick and see if that helps them.

- Draw on the board a 4x4 grid of 0s and 1s and see if the class can determine what the extra row and column should be (to make an even number of 1s in each row and each column)

6. Eventually describe how the card trick works.

- Ground the “answer” in the context of parity and error checking for computers communicating.

7. Allow the group to try it themselves in pairs or small groups.

8. As an extension for older groups, ask them to tell you whether they think there are errors that bit parity cannot detect? Could they detect an even number of errors?

- Note the limitations of pure parity schemes for error detection, explain we have more advanced methods that rely on checksums.
- Note that computers use bit parity to check if a byte has been correctly transmitted but they cannot detect which bit has been changed, the entire byte needs to be resent

9. Additionally, ask how students think you could correct errors using parity? Refer to the magic trick.

- Since the cards represent binary numbers they only have two values. If you know a particular card is not correct, it must be the other value.
- Are there any limitations to error correction using parity?
- Yes, we can only be guaranteed to correct one error if only one error is present.
- Depending on how the errors are distributed in the card game we might be able to correct more than one error, but this is not true in every case, therefore we cannot make that assumption.

## Reflection & Debrief

- Review the concept of parity.
- Describe how all messages in computers are reduced to 1’s and 0’s that represent the message. Describe how parity bits can be computed and sent with the message
- Describe how these messages can be sent over communication mediums that have an error rate. Describe how errors can be created by noise.
- Review how we can catch errors in a message if we know the parity, just like in the magic trick. Ask about limitations of error detection schemes using parity.

## Extensions & Modifications

### Extensions

- Participants can work in defined groups, or do a whole-group version of the card trick (Parity Magic) with the entire class.
- Increase the number of rows and columns in the card trick.
- Participants can make their own parity cards.

### Modifications

- Try changing the number of errors introduced in the card game to two - can you detect all errors?