Matrix multiplication can be used to encode and decode messages.
Translate each letter in your message into a number (A=1, B=2, C=3, space=0). For example:
BEETLE becomes 2 - 5 - 5 - 20 - 12 - 5
Put the numbers into a 3x2 matrix:
|
|
|
|
|
| ||
|
|
Multiply our encoding matrix by this matrix:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||
|
|
|
|
|
|
|
|
|
Add or subtract 26 from each number in the new matrix until the result is between 0 and 26. For example:
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
And finally, translate these numbers back into letters:
Translate letters to numbers and put them back into a 3x2 matrix:
|
|
|
|
|
| ||
|
|
Multiply our decoding matrix by this matrix:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||
|
|
|
|
|
|
|
|
|
Add or subtract 26 from each number in the new matrix until the result is between 0 and 26:
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||
|
|
|
|
|
And finally, translate these numbers back into letters: