Harry Potter and the Cryptography with Matrices
Chua, Boon Liang, Australian Mathematics Teacher
Cryptography, the science of encrypting and deciphering messages written in secret codes, has played a vital role in securing information since ancient times. Julius Caesar employed what has become known as the Caesar Shift Cipher when encoding messages to communicate with his generals. Under this form of encryption technique, each letter in a message is substituted with the letter that was a certain number of places further down the alphabet. Caesar used a shift of three places, and so A is replaced by D, B is replaced by E, and so on. In modern history, the Nazis continued to use the presumably highly sophisticated Engima machine to encrypt their messages when they communicated, still unaware that three Polish mathematicians had already cracked the unbreakable codes of the Engima machine and had provided the Allied Forces with the means to gain access to their top secrets. More recently, with millions of financial transactions conducted over the Internet daily, cryptography has become more important than ever. Companies have begun to make online transactions more secure by installing encryption software to prevent sensitive information such as credit card numbers from falling into the wrong hands.
There are several cryptographic techniques and many make extensive use of mathematics to secure information. This article describes an activity built around one of the techniques that illustrates an application of matrices. Secondary school teachers may use this activity to consolidate their students' learning of certain concepts of matrices such as the algorithm for matrix multiplication and the concept of the multiplicative inverse of a matrix.
To capitalise on the popularity of the Harry Potter series by J. K. Rowling, the entire activity is framed in the context of the Harry Potter story with the aim of stimulating and heightening students' interest. The activity begins with the following scenario:
Harry Potter is in deep trouble. He is being pursued by Lord Voldemort and is presently hiding in a secret location to escape from being captured by him. He needs to send messages to his two good friends, Ron and Hermione, to tell them about his situation and whereabouts. Of course, he has to send the messages in code, just in case they are intercepted and cracked by Lord Voldemort along the way. So he composes his first message "Please save me!" by replacing each letter in the message by a number according to the code in Table 1.
Then students are asked to translate Harry's plain message into code, which appears as follows when completed:
P L E A S E S A V E M E ! 16 12 5 1 19 5 0 19 1 22 5 0 13 5 27
The activity continues with the story of the clever, but devious, Harry using a super hi-tech LOCK to encrypt his message to make it unbreakable by others, except for Ron and Hermione. The super hi-tech LOCK used is
Here, students are told that the LOCK is a rectangular array of numbers in rows and columns, and are asked to write down the special name of such an array of numbers, as well as its order.
Next, the story proceeds to describe the encryption technique that Harry uses. First, he writes his encoded message in groups of three numbers as shown below:
Second, he pre-multiplies each group of numbers by his super hi-tech LOCK. To reinforce the students' learning of matrix multiplication, they are instructed to apply the second step to the five groups of numbers. For instance, the first group,
yields the result:
Now what has happened is that the letters P, L and E, which are originally given the codes 16, 12 and 5 respectively, have now ended up being correspondingly represented by the codes 21, -4 and 22. …