next home previous previous

4.1 Equations - Coding

Did you ever make up codes so that you could pass secret notes to your friends? See if you can figure out this coded phrase: 69 108 130 159 -50 -86 -96 -124 . Don't worry if you don't know it now; by the end of this chapter, you will be able to figure out the word. What sort of codes did you use? A very popular code is to give each letter of the alphabet a number.

A = 1 J = 10 S = 19
B = 2 K = 11 T = 20
C = 3 L = 12 U = 21
D = 4 M = 13 V = 22
E = 5 N = 14 W = 23
F = 6 O = 15 X = 24
G = 7 P = 16 Y = 25
H = 8 Q = 17 Z = 26
I = 9 R = 18 space = 27

Unfortunately, this code is so well-known, that your message would not be very secretive. Some people choose to shift the code above so that A = 10, B = 11, ..., R = 1, ..., Z = 9 or something similar. However, since each letter is represented by a particular number and that number always stands for the same letter, this type of code is easily broken. We need a code that is more difficult to break but is still easy to encode and decode. Let's look at one way to do this.

In order to send a secret message, you and your friend need to pick a matrix that has an inverse to be your secret coding matrix. For this example, let's use matrix Therefore, matrix

Now we need to pick a message to send. Let's send the word "Smiles". We will derive our secret code by multiplying AB where B is our message. Since A has two columns, B must have two rows (in order for matrix multiplication to work). Therefore, B must be a 2 by 3 matrix matrix Notice that we chose to write our message across the rows. We need to let our friend know this when we choose the secret coding matrix because we could have just as easily written our letters down the columns. Since we want this message to be coded, we need to pick numbers for each letter. We will stick with the standard A = 1, B = 2, etc. Therefore,

matrix

To code our message, we need to multiply AB. So

matrix

Since we want to add one more layer of secrecy to our code, we will write out the code in a line so that we don't give our "enemy" a clue that we used matrices to code and that our coding matrix had 2 rows. Now we can broadcast 43 23 47 105 59 103 in a public place if we want, and our message will be safe.

When our friend receives our message 43 23 47 105 59 103, she will want to decode it. She knows that our coding matrix was  matrix and she knows our method of coding (writing across the rows, AB = our code, and A = 1, B = 2, etc.). Since our coding matrix has two rows, our code, C, must also have two rows. Therefore, she can convert our message back into the matrix

matrix


To solve AB = C, she multiplies on the left by A-1 to get B = A-1C. Therefore,

matrix


  She can convert this back into the matrix   matrix   to get the message SMILES.

If we use the same coding matrix to code the word SMIRK, we get

matrix


  If we look at all three words we have coded with this same coding matrix, we see

SMILES43234710559103
SMIRK55356312983135
MILE37198747

Notice that although these words share many letters, their codes are not similar at all. Also notice that the number 47 represents the letter I in SMILES and the letter E in MILE. These are some of the features that make this sort of code so difficult to break. Even if our "enemy" knew that we were coding using matrices, he would not know what size coding matrix we used or which numbers were in that coding matrix. Since the numbers in the coding matrix can be any real numbers (even negative numbers and fractions), it would take a LONG time to guess the correct matrix even with the help of a very fast computer.

The matrix

matrix


was used to code the message 42 62 96 53 63 166 68 97 165. So to decode the message, we need to find A-1. Since we computed it earlier in the chapter, we know that

matrix


Because we coded using a 3 by 3 matrix, we need to break our message into 3 rows. Therefore, our message should be written as

matrix


When we multiply A-1, we get

matrix


which translates into the word "education." Now can you decode the message from the beginning of this section? It was encoded using the same format as the other and we used the coding matrix matrix

Coding is a fun way to use matrices and their inverses, but it also has important practical applications when governments and other organizations try to transmit private messages over public systems such as radio or satellite.

next home previous go to the top previous

Send comments on material to Tamara Carter

These pages are maintained by Hilena Vargas (hvargas@rice.edu)
Updated: August 18, 2000

 Copyright ©1995 - 2000 Tamara Lynn Anthony