Tuesday, October 23, 2012

Encryption and Inverse Functions: First Draft

Here's what kids usually see when they walk in to my room:

Here's what they saw today:

 
I told them to break the code. It didn't take long, especially because there was a huge hint up there. But the point was that I wanted to talk about codes, encryption and reversible functions today.

After they broke the code, I asked them to explain the encryption process in terms of functions. We ended up with G(a), which takes letters and spits out numbers, and f(n), which takes a number and gives you three more than that.

Then I gave them another encryption.
This time I told them the key. It was g(n) = absolute value(n - 10).

"Wait, it could be two letters."
"It's 'HELLO' but it could've been 'FILLO'."

It's a lousy code, because it's ambiguous. The information about the starting letter is ambiguous. 

The rest of the lesson was sort of lousy, with some good moments. I teachernated that if a function is reversible, then it makes a good code. And another way to say that it's reversible is that it has an inverse function. Most of the rest of class was spent trying to figure out if various functions had inverses. But there were some highlights:
  • "It's only a bad code if you use all the alphabet." We talked about restricting the domain artificially.
  • "So any code that has two different letters with the same number is lousy." Nailed it, kid.
Basically, I'm sold on the idea of using encryption as a context for motivating the distinction between one-to-one and non-one-to-one functions, and I'm also sold that this can motivate functions versus non-functions. (Just try imagining what the inverse of one of those non-invertible functions would look like.)

But I feel like I didn't nail this lesson. The concept seems solid, but I don't think I made it really interesting or especially challenging. Any ideas on how to improve it? I'm giving it another shot next week with 11th graders.

5 comments:

  1. I've also used cryptology in a similar manner to work on the concept of an inverse function and whether a function has an inverse. I did not discuss at the time the notion of restricting the domain in this context, but it is an interesting idea. I spent more about a week on the subject and it allowed me to introduce the idea of numbers mod 26 which then allowed us to first look at "shifts" which always had an inverse. (Adding 5 had an inverse which was "subtracting 5" but could also be thought of as adding 21). Finally we got to looking at ciphers which multiplied by n. I let the students explore when this function has an inverse, and what is that inverse. The temptation is to say "divide", but what does that mean when working mod 26. It's been a few years since I've done this as I've tried to coordinate more with other teachers, but I recall the students found it interesting and gained a better understanding of what an inverse function is, why it matters, and what we need for a function to have an inverse.

    ReplyDelete
  2. I like this idea and the nice way that it uses the idea of 1-1 and invertable. But, the lesson seems to be lacking a "problem". It is realtively easy to understand which functions make good keys and which don't - that is the point of using codes to get at the idea of invertable and 1-1.

    It would be nice if there was something in the lesson that was less easy to figure out - either about codes or about invertability/1-1 or both. I can't think of anything right now, but it feels like there is a lot of promise with your idea.



    ReplyDelete
  3. The idea of multiplication (mod 26) as the encoding system definitely leads to problems that are not so easy to figure out. Namely
    1) Which numbers can we use? That is for which integers, k, is multiplication by k (mod 26) a one-to-one function, and for which integers, k, does multiplication fail to be one-to-one? (This is fascinating as when we are dealing with real numbers only multiplication fails to be one-to-one which is why we can "divide" by any number other than zero)
    2) If we determine that multiplication by k does lead to a one-to-one function, how can we find the inverse function? Can that inverse function be expressed as multiplication by some number, and if so, how can we find that number? (This can get students to really think about the idea that division is the same as multiplication by a reciprocal, and what is really meant by reciprocal. If you say that 7x=19 (mod 26) it's not so meaningful to say that x=19/7 as that doesn't tell you what letter the 19 is really standing for in the cipher. Instead we have to think about 19/7 as meaning 19 times the reciprocal of 7, and the reciprocal of 7 is 15 because 7 * 15 = 1 (mod 26).

    If some students want to pursue this idea further, you can ask what would happen if we didn't work with just 26 letters, but with 26 letters and 14 other symbols (such as period, comma, etc.) If we work mod 40 which numbers have reciprocals. You can also discuss why a multiplicative cipher might be better than just a random permutation of the alphabet.

    ReplyDelete
  4. Update: This worked really well on a quiz day, when it lasted about half a period. I think that I would follow this up with just trying to figure out whether various graphs represent reversible functions.

    ReplyDelete
  5. Michael, I like this approach - using a code students are more familiar with than the more abstract numerical functions. I think you have a great start to inverse functions here, but I'm concerned that students (my students, anyways) would then have a hard time transferring their understanding to numerical functions such as the ones you had on your first slide. Can you tell us how the next lesson(s) have gone, whether the students are building on their understanding from that first lesson?

    ReplyDelete