Skip to content

Mathematics · Ch 1 — Applications of Matrices and Determinants

Application of Matrices to Cryptography

1.2.5

Application of Matrices to Cryptography

A striking use of the inverse of a non-singular square matrix is in cryptography -- the art of communicating so that the message stays hidden from everyone except the intended receiver. Two steps are involved: encryption, which turns the readable plain message into an unreadable coded form, and decryption, which recovers the original message from the code. Both sender and receiver share a secret called the key.

A convenient key is a non-singular matrix. The sender encodes the message with this encoding (encryption) matrix; the receiver decodes it using the matrix's inverse, the decoding (decryption) matrix. Because the chosen matrix is non-singular its inverse exists, so the original message is recovered exactly.

Example. Let the letters AA--ZZ be numbered 11--2626 and let a blank space be 00. Take the encoding matrix (applied by post-multiplication)

A=[1−112−10100].A = \begin{bmatrix} 1 & -1 & 1 \\ 2 & -1 & 0 \\ 1 & 0 & 0 \end{bmatrix}.

To send the message WELCOME, cut it into blocks of three letters: (W E L), (C O M), (E _ _)(W\,E\,L),\ (C\,O\,M),\ (E\,\_\,\_), padding the last block with two blanks. As row matrices of numbers these are

[23  5  12],[3  15  13],[5  0  0].[23\ \ 5\ \ 12],\quad [3\ \ 15\ \ 13],\quad [5\ \ 0\ \ 0].

Encrypt by post-multiplying each row matrix by AA:

[23 5 12] A=[45  −28  23],[3 15 13] A=[46  −18  3],[5 0 0] A=[5  −5  5].[23\ 5\ 12]\,A = [45\ \ -28\ \ 23],\quad [3\ 15\ 13]\,A = [46\ \ -18\ \ 3],\quad [5\ 0\ 0]\,A = [5\ \ -5\ \ 5].

So the transmitted (coded) sequence is 45, −28, 23, 46, −18, 3, 5, −5, 545,\,-28,\,23,\,46,\,-18,\,3,\,5,\,-5,\,5. …