Matrix CodeReference > Mathematics > Codes and Secret Messages
The Matrix Code is a complex method for creating and decoding secret messages. I won't go into all the details here, because it is very confusing if you haven't learned about matrices and determinants in your math class. And if you aren't in high school or college yet, you probably haven't!
But just a simple explanation. Most of the codes you've looked at here change the message one letter at a time. First, letter number one gets changed (into a number, a symbol, or another letter), then the second letter, and the third, and so on. But in a matrix code, the letters get changed ingroups! So it's much harder to decode the message.
Do you want a little more information? Then keep reading...
A matrix is a two-dimensional array of numbers, grouped together inside a pair of brackets. A Matrix might be described as a 3x3 matrix if it has numbers in three rows and three columns. Here's an example:
| 3 5 7 |
| 0 2 1 |
| 1 7 9 |
Now, if you were going to use this Matrix to encode your message, you would have to group your message into groups of three letters (because it's a 3x3 matrix). If you don't have the right number of letters, just add some spaces at the end to make it come out even.
Now you have to assign a number to each letter/symbol in the message. One easy way to do this is to use the same numbers that the computer uses (A = 65, B = 66, etc). Another way would be to say A = 1, B = 2, C = 3, and so on. That might be easier, because you're going to do a lot of multiplying, so keeping the numbers small is a good idea.
Once you've got your "encoding matrix", and you've divided your message up into groups of three, and converted them all into numbers, you start combining the groups with the matrix in a way that is wholly confusing and distressing for people who haven't studied matrices. So, if you get easily confused and distressed, you may want to stop reading here.
You're still reading??!? Wow! Good for you. Okay, take a deep breath, and let's do this
Let's say your first group of letters (numbers now!) was 1, 14, and 4 (if A = 1, B = 2, etc, then those three letters spell the word "AND").
Here's what you'll do with those numbers: you'll multiply and add them down the first column of the matrix. Like this:
(1 x 3) + (14 x 0) + (4 x 1) = 7. (the 1, 14, and 4 come from my first group of three, and the 3, 0 , and 1 come from the first column of the matrix.)
Now we multiply and add down the second column of the matrix:
(1 x 5) + (14 x 2) + (4 x 7) = 61
Then we multiply and add down the third column of the matrix:
(1 x 7) + (14 x 1) + (4 x 9) = 57
Phew! We've finished with our first group of three letters. The first three letters in our encrypted message are: 7, 61, and 57. BUT (and here's the cool thing) the 7 does NOT represent the letter A, the 61 does NOT represent the letter N, and the letter 57 does NOT represent the letter D!
Instead, all three numbers together represent all three letters. Much harder to decode!
When you've done all that, you've finished with the first group of three letters. Now you can move on to the next group!
I'm sure you can imagine, it would be very nice to have a computer do this for you!
How do you decode this message? Well, you have to have the inverse matrix of the one you started with - and if you don't know what that means, you've got some math to learn before you can decode a matrix message!
You're probably wondering why this page doesn't have an encoder or decoder. Well, it's not because I didn't make one. In fact, I made one several years ago. But I'm not putting it on my website. Because matrix codes are very difficult to decode (you need to be able to guess what the original matrix was, and then find its inverse), and sometimes people use coded messages to help them do illegal things. All the other codes on this site are very easy to decode, but not matrix codes, so I don't want people using this site to help them do illegal things!
Educators can get a free membership simply by sharing an original lesson plan on our Articles for Educators page!