Cryptograph is the study of writing in secret code that goes back to ancient times. Modern cryptography intersects the disciplines of mathematics, computer science, and engineering. Applications of cryptography include ATM cards, computer passwords, and electronic commerce. The first documented use of cryptograph in writing dates back to circa 1900 B.C. when an Egyptian scribe used nonstandard hieroglyphs in an inscription. One of the earliest and easiest methods of coding message is the substitution cipher, in which each letter in the alphabet is substituted for another letter/number/symbol.
Caesar’s cipher is one of the easiest method of coding messages where each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. This lesson called "Code Crackers" is in publication Illuminations published through NCTM (National Council of Teachers of Mathematics). For more information, please go to the following link:
http://illuminations.nctm.org/LessonDetail.aspx?ID=L587
This project outlines a method using matrices that makes a more secure secret code. Also, it combines students' knowledge of operations of matrices while investigating and designing secret codes.
Encoding Messages into Matrices
Message to encode: “One small step for man”
1) Write the message down the columns of matrices with three rows. We will use 3x4 matrix to encode the message.
(The number of columns in the matrix is not relevant. However, using more than one matrix may be convenient)
2) Make sure you leave empty spaces in the matrix to indicate a space. The message can be written horizontally or vertically.
The example provided in this website will write it vertically.
3) Using the encoding chart provided, translate the matrix letters into their numerical equivalents.
A 
B 
C 
D 
E 
F 
G 
H 
I 
J 
K 
L 
M 
N 
O 
P 
Q 
R 
S 
T 
U 
V 
W 
X 
Y 
Z 

0 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
4) Multiply each of the matrices on the left by the following matrix:
5) To get the numbers in the code range (0, 26), reduce the numbers in the matrices to their equivalents mod 27. If students have a hard time understanding equivalents mod 27, tell them to either add or subtract 27 until you get the numbers in the code range.
6) After the calculation, you should have two matrices with new numbers. Using the coding chart again, write an equivalent letter to its number. You should get a new message.
Example of Encoding the Message: ONE SMALL STEP FOR MAN
After writing a message vertically into two 3x4 matrices, we will convert the message with the number given by the encoding chart.
After multiplying each matrix by matrix C on the left, you should get:
After reducing the numbers to mod 27:
Coded Message: NZSIAEWRQIVLHMTGLLXMELXP
Decoding Messages using Matrices
When you're decoding a message using matrices, the steps are similar to encoding a message except that you multiply by the inverse matrix of C.
Example of Decoding a Message
Message to decode: HJOCODTKHHSIJVRDXAHE
Write the message into 3x4 matrices.
Multiply each of the matrices on the left using the inverse matrix of C.
After multiplying, you should get:
Make sure you reduce the numbers to equivalent mod 27:
Using the coding chart, the decoded message is: HAVE FUN HAPPY CODING
Questions to ask...
What is the determinant of matrix C? What is the determinant of the inverse of matrix C?
1. If the determinant of matrices is another number, then we will have a hard time reducing the number in mod 27.
Can you find other matrices that will work in the same way as matrix C? What are the necessary conditions for matrix C to encode a message?
Many other matrices will work. The determinant of C must have an inverse mod 27 (1 x 1 = 1 mod 27).
To find other matrices with determinant 1, use row and column operations on the identity matrix
If the code has more than 27 characters, what must change in the procedure above?
The number of determinant of C must have an inverse mod n where n is the number of characters in the code.
Can you use matrices with more than three rows?
Yes. The matrix C will be the square matrix with the same number of rows you designed to use.
Designing a project
Spend a day explaining how to encode/decode a message with students. Explain/Review the mathematical concepts behind the procedure.
Include other characters such as period, comma, quotation mark, exclamation mark, question mark, etc in the coding chart.
Each student will make up a message and encode it using the coding chart. Also, each student should come up with their own matrix C.
Each student will present their encoded message and the inverse of matrix C to the class to decode the message.
If the message is decoded successfully, then the work has been done correctly.
If the students are not using calculators, keep the number of row as 3.
For highly gifted students, let them use a matrix with rows bigger than 3.
This project idea came from Mission Mathematics II: Grades 912 pages 197198.