## Saturday, December 15, 2012

### Matrix Multiplication Cryptography

This post is a part of a series of guest-posts on the applications of matrix multiplication. These posts were written by my pre-calc students:

Matrix Cryptography
by David Stanley

Cryptography, put simply, is the art of encoding messages.  It serves to answer the simple question of how you get a message to a friend without your enemy being able to read it.  Cryptography has been used for centuries by militaries and intelligence agencies to send important messages, while insuring that the information the messages contain does not fall into enemy hands.
Although there are many forms of cryptography, one of the simplest yet most effective forms of encryption still utilizes the simple matrix.The message is placed in matrix form, and then multiplied by a random square matrix or encoding matrix

The first step is to write down the message that you wish to send.  I will use this completely true and totally non-brown nosing message as an example:

Mr Roer is the best math teacher ever in the history of humanity.

Secondly, you must create an encoding matrix.  This matrix must be a square matrix. An example of this would be:

In this kind of encryption, letters are assigned numbers for their place in the alphabet.  A would be 1, B would be 2, C would be 3 and so on.  Spaces are assigned the number 27, as their are only 26 letters in the alphabet.  So the message in matrix form would be:

Notice how my encoding matrix has the same amount of columns as the message matrix does rows.  This is required or else they cannot be multiplied.  All that is left to do is to multiply the encryption matrix by the message matrix.  This gives you:
Now if you received this in the mail, you would have no idea at all what it said.  In order to figure this out in a timely manner, you would have to have the decoding matrix.  The decoding matrix is the inverse of the encoding matrix.  This can easily be found on your calculator.  The decoding matrix for this problem is quite long, so I will round to four decimal places.

The exact elements in the decoding matrix have more digits and would give the exact numbers as the original message. Using this rounded decryption matrix gives numbers that can all be rounded to the original message, though occasionally a letter might be slightly off.

In summary, the encoding process written in calculator language when
[A] is the encoding matrix,
[B] is the original message,
and [C] is the encoded message is [A]x[B]=[C].
The process of decoding the message is ([A]^-1)x[C]=[B].

And there you have it.  That is matrix cryptography in a nutshell.