Skip to content
doubtly

1 answer

In one line

A message is turned into number columns, scrambled by multiplying with an invertible matrix \(A\), and unscrambled by multiplying with \(A^{-1}\).

Explained simply

Imagine passing secret notes in class. If you just write numbers for letters (A = 1, B = 2...), anyone can crack it. If you first mix the numbers using a matrix, the pattern disappears. Your friend, who knows the matrix, uses its inverse to undo the mixing. This is the idea behind the Hill cipher, a classic matrix-based code.

Technically, if the message vector is \(X\) and the encoding matrix is \(A\) (with \(|A|\ne0\)), the coded vector is \(Y=AX\). The receiver computes \(X=A^{-1}Y\). Matrices with \(|A|=\pm1\) and integer entries are convenient because \(A^{-1}\) also has integer entries. This is a self-learning topic in the syllabus.

How it works

  1. Assign numbers to letters (e.g. A = 1, …, Z = 26, space = 0).
  2. Split the message into blocks of length \(n\) (the size of \(A\)) and write each block as a column vector.
  3. Encode: multiply each column by \(A\).
  4. Send the coded numbers.
  5. Decode: multiply each received column by \(A^{-1}\) and convert numbers back to letters.

Key formula

Encoding \(Y=AX\); decoding \(X=A^{-1}Y\), with \(A^{-1}=\dfrac{\mathrm{adj}\,A}{|A|}\). For \(A=\begin{bmatrix}a&b\\c&d\end{bmatrix}\): \(A^{-1}=\dfrac1{ad-bc}\begin{bmatrix}d&-b\\-c&a\end{bmatrix}\).

Quick example

Encode "HI" with \(A=\begin{bmatrix}1&2\\1&3\end{bmatrix}\) (\(|A|=1\)). H = 8, I = 9, so \(X=\begin{bmatrix}8\\9\end{bmatrix}\).

\(Y=AX=\begin{bmatrix}8+18\\8+27\end{bmatrix}=\begin{bmatrix}26\\35\end{bmatrix}\). Send 26, 35.

Decode: \(A^{-1}=\begin{bmatrix}3&-2\\-1&1\end{bmatrix}\), \(A^{-1}Y=\begin{bmatrix}78-70\\-26+35\end{bmatrix}=\begin{bmatrix}8\\9\end{bmatrix}\) = "HI".

Common mistakes

  • Using a singular matrix (\(|A|=0\)); the message can then never be decoded uniquely.
  • Multiplying \(XA\) instead of \(AX\) (the sizes do not even match for column vectors).
  • Splitting the message into blocks of the wrong length.

How MU asks it

Being self-learning, it is unlikely to be a long exam question; it may appear in tutorials or as a short application part: "Encode the message ... using the matrix \(A\) and decode it". Show the letter-number table, the column vectors, each multiplication, and the decoded word.

Doubtly AI · 25 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.