Fair(ish) Use: Parity Error Trick

As I’ve mentioned in our Hangouts I’m preparing to teach AP Computer Science Principles this coming 2016-2017 school year. So, when I’m not doing work for ED 654, I’m in the depths of a computer science crash course. Luckily for all of you, there are some pretty cool topics I’m learning about and I picked my current favorite to share for this assignment.

The Parity Error Magic Trick

Cartoon animation showing steps of the parity error trick. Teacher closes eyes while student flips a random tile. Teacher turns around and examines the grid. Teacher correctly identifies which tile the student flipped over.

Image Source: CS Unplugged

To perform the parity error magic trick hand the stack of cards over to a student and ask them to lay out the cards face-up or face-down however they’d like in a grid pattern (or have them flip cards in a pre-set grid). Once the students are done, the teacher uses the remaining cards to create an extra row and column of cards on the grid. The teacher then turns their back, and the student flips any card in the grid. When the teacher turns around they should be able to spot which card in the grid has been changed.

This video demonstration of CS Unplugged’s “Error Detection Card Trick” activity was created by Jennifer Rosato for the Mobile CSP lesson on Error Detection:

Memory, magic, or some good ol’ parity error detection?

Solution: First, face-down cards are assigned 0s, and face-up cards are assigned 1s (see how we’re working those binary digits in?). For each row and column there are either going to be an even number of 1s or an odd number of 1s. The teacher decides whether they are going to run an “even parity” or an “odd parity.” For the sake of this example let’s assume it’s an even parity. The trick is in the extra row and column that the teacher adds to “make it more difficult” which actually isn’t random at all. If the students has placed 3 face-up cards in a row then the row is odd, but since we’re working with an even parity the teacher will make the row even by placing an extra face-up card in that row. Every row and column are made even with the extra parity cards that the teacher lays down.

When the student flips one of the cards while the teacher’s back is turned it creates a parity error. Now there will be a row and column that no longer have an even number of 1s. All the teacher has to do is locate where the odd row and the odd column intersect to correctly find the flipped card.

Parity error detection can also be used to help solve riddles like the one in this animation created by Alex Gendler for TED-Ed:

Parity Error Detection in Coding

I only understand parity error detection in its simplest form, so what follows is the entirety of what I know. If everything is made of transmitted bits (1s and 0s), there’s bound to be an error once in a while. Adding redundant parity bits to a code, allows for a basic form of error detection without altering original code. In a 1-bit parity, the redundant bit is placed in the leftmost position. Originally the redundant parity bit was added to a 7-bit string, making an 8-bit byte: 0011 1010. 1-bit redundancy (like putting a card at the end of a row) is able to detect an error but is unable to locate and correct it. The information would need to be retransmitted. Another downside of 1-bit redundancy is that it only flags an odd number of errors. For example, if it were an even parity byte 1010 0101 and two of those bits were flipped 1010 1111 it wouldn’t flag an error because the even parity is still true.

But fear not! 1-bit redundancy is not the only kind of parity error detection. Say hello to the Hamming Code. The Hamming Code uses a 3-bit redundancy for every 4 bits of code. Not only does this code allow for error detection, but also error correction. Through this technique three of the original bits are checked against each of their corresponding parity bits, and if they don’t fulfill the parity, the error in the original data bits can be corrected. This video from Khan Academy does an excellent job of breaking this down:

“NOTE: All Khan Academy content is available for free at www.khanacademy.org”

Error correction: How can we communicate in the presence of noise?

Fair Use of Materials:

I’m always especially nervous about using videos I find online, so I pushed myself to use more videos in this assignment and do a little digging to see how the owners would like them to be used.

Card Trick Cartoon – At the bottom of the CS Unplugged site they had posted “The CS Unplugged material is shared under a Creative Commons BY-NC-SA 4.0 licence.” I clicked on it to see what that actually meant, and I felt that I could work with those terms so that I could use the image in my post. I made sure to include attribution with the image.

Four Factors of Fair Use

Purpose & Character: I used the image for non-commercial purposes in an educational post that was meant to elicit new commentary. It was also placed in a broader conversation about parity error detection beyond the card trick.

Nature of the Copyrighted Work: This image was a creative work, but because it was posted as CS Unplugged material it falls under their CC license, so I’m still in the clear.

Amount and Substantiality of the Portion Taken: I used the whole image that was provided on the site, but again their CC license allows for this.

Effect of the Use upon the Potential Market: CS Unplugged doesn’t make a profit off of their online curriculum, and I’m not making any money from my blog.

Error Detection Card Trick (video) – It took me a while to figure out how exactly to use this video fairly. I first saw the video in a lesson on Error Detection in the Mobile CSP online curriculum (which is open source). But, when I went to the video itself to embed it, the owner of the video was one of my mentors for the course and I received a warning that looks like this: Screenshot of a YouTube warning saying "This video is unlisted. Be considerate and think twice before sharing."

So, of course, I thought twice before sharing. First I checked to see what kind of license the online Mobile CSP material has, which ended up being a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license. I knew that I should be able to use the video because it had been uploaded onto the Mobile CSP site and was covered by the CC license. But, I still felt weird about it, so I wrote an email to my mentor to get her permission to use the video in this post.

Four Factors of Fair Use

Purpose & Character: I used the video for non-commercial purposes in an educational post that expanded the discussion around the content and elicited new commentary.

Nature of the Copyrighted Work: I wouldn’t consider this video to be creative because it is a demonstration of a card trick, and doesn’t contain original material.

Amount and Substantiality of the Portion Taken: I included the entire video in my post.

Effect of the Use upon the Potential Market: Mobile CSP curriculum is open source and does not sell their material so there was no profit lost from my use of the video.

Can you solve the prisoner hat riddle? (video) – To see how I could use this video I first checked out the TED Video Usage Policy. It looks like TED Talks are under a Creative Commons license Attribution – NonCommercial – NonDerivative. But, then after that section was information specifically about TED-Ed, which doesn’t fall under CC, but instead under YouTube’s Standard Policy. I’m not sure why they have some of their videos hosted on the TED site and other hosted through YouTube. How can they really support their tagline of “Ideas Worth Sharing” if their whole education outfit isn’t under CC?

Four Factors of Fair Use

Purpose & Character: I used the video for a non-commercial purpose in a way that expanded on the ideas in the video and brought it to a new group of people for commentary.

Nature of the Copyrighted Work: The idea in the video isn’t creative as it is a well known riddle, but the art in the video was creative. I provided adequate attribution to the creator and to TED-Ed.

Amount and Substantiality of the Portion Taken: I used the whole video (because using half of a riddle kind of takes the fun out of it…). But since the other TED videos are non-derivative, I think it may actually be in my favor that I used the whole video.

Effect of the Use upon the Potential Market: As the video was already being shared through TED-Ed who encourages their videos to be distributed, the creator would not have been making a profit from the video. Unless he was making money through YouTube, in which case I’m just providing more hits for him. I’m not making a profit by having the video embedded in my blog.

Error correction (video) – Khan Academy has a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States license for all of their online material. They also have a thorough FAQs section about how/when/where you can use their material. I specifically looked at “I would like to embed your videos on my site. Is that allowed?” Along with adhering to their CC license, they also asked that embedded videos use the Khan Academy player and to include their “NOTE” about all Khan Academy material being free on their website.

Four Factors of Fair Use

Purpose & Character: My use of the video was non-commercial. There was value added to the video by placing it in conversation with the other parity bit information contained in the post, and made it accessible for new commentary.

Nature of the Copyrighted Work: While the information wasn’t creative (non-fiction) the video animation certainly was creative, but the video is covered under Khan Academy’s CC license.

Amount and Substantiality of the Portion Taken: I used the whole video that was posted on the Khan Academy site, but again, the material is covered under CC.

Effect of the Use upon the Potential Market: Khan Academy makes it very, very clear that their material/curriculum is free and want it to remain free (hence posting the NOTE before the content). So neither of us make any money off of posting the video.