In a 2x2 case and due to the fact that hill ciphers are linear, we only need to find two bigram (2 letter sequences) to determine the key. A pretty simple way to break a hill cipher is if the code breaker knows words in the message. Lets say we have this ciphertext:
Lets also say the code breaker knows that there is a "of the" in the message somewhere. This means one of the following must be true because the hill cipher enciphers pairs of letters:
If the second line were correct (which is only an guess), then we would PC encrypted ft and MT encrypted to he. We can now set up equations to go with this information.
Now we want to determine the matrix D (the decryption key). Now we need to combine the above equations.
Now we need both matrices on the same side.
Now we need to remember how to decrypt a hill cipher and invert the second matrix. We need to find the determinate by evaluating using the following function
When we apply this algebraic equation to the matrix:
Now we need to find the inverse of the determine which is 1, because 1 is it's own inverse. Now we to find the adjugate matrix.
When we apply this to our matrix and use mod 26 we get:
Now we have to go back and use this matrix and the one earlier to find the decryption key.
But when we try to decrypt the message it is still gibberish. We check all of our mathematical computations and they seem correct so our mistake was our first assumption. "Of the" was not in fact on the second position, but it was on the 18th position leading to this new matrix that lead to the right plaintext.
After using this new matrix, the plaintext is reviled as:
*If we do not know any words in the message, instead of dragging this 5-letter sequence across the ciphertext, we can use common quadgrams, or 4 letter words, like THAT,THEY,or THER to find the correct start position for the matrix.