Find modulo inverse if two number are not relatively prime for Hill cipher

cryptography

While practicing for Hill Cipher I choose a random Key matrix of $ 2*2 $ given as follows :
$ K = \begin{bmatrix}3&2\\1&0\\\end{bmatrix} $

Say the Text to Encrypt is ATTACK
By using the Following Equation $ C=K * P \mod 26 $ I got the encrypted Text as MAFTAC, where

$C$ is Cipher Text Matrix

$K$ is Key Matrix

$P$ is Plain Text Matrix

Now while decrypting the Cipher text using equation $ P= K ^{-1} * C \mod 26 $.

I need to find $ K^{-1} = |K|^{-1} Adj A $
But The Multiplicative Inverse $ |K|^{-1}$ exist only if $ 26 $ and $|K|$ are relatively Prime. But In this case $|K|=-2= 24 \mod {26}$.

But 24 and 26 are not relatively Prime. Does That Mean The following Key Can't be used To Encrypt The Text?

Best Answer

Your $K$ has determinant $-2$ which has a zero-divisor modulo $26$, hence $K$ has no inverse. It cannot be used as the key for a Hill cipher.

The function defined by $K$ is not injective: e.g. the plaintexts $\begin{bmatrix} 0 \\ 13\\ \end{bmatrix}$ and $\begin{bmatrix} 0 \\ 0\\ \end{bmatrix}$ give the same ciphertext, so we cannot go back to the plain text from the ciphertext.