An interesting concept to encode and decode text messages
Date : 18/05/2024
(This article is published in the author's blog and is published here with permission)
This is a secret message. Can you crack it?
Let us use the key to open this secret message. That is, let us multiply it with the key matrix.
We have now completed the first level of decoding. We have to now convert the numbers in the resultant matrix into the characters.
This is similar to the method described in Sherlock Holmes’ “Adventure of the dancing men” by Arthur Conan Doyle.
Here
0 represents space ” ”
1 represents A
2 represents B
3 represents C
…
26 represents Z
Using this to decode the resultant matrix we get the original text message as
Didn’t I say from the beginning that “THIS IS A SECRET MESSAGE”.
You must be wondering how does all this work?
To understand this, let us first consider an algebraic equation:
Provided a is not equal to 0, we can multiply both sides of the equation with the reciprocal of a. We have,
Similarly, let us now consider the matrix equation:
Here, A is a square coefficient matrix, X is the matrix of variables, and b is the matrix of constants.
Now, let us multiply both sides of the equation with the inverse of matrix A:
Multiplying a matrix with its inverse gives an Identity matrix. Hence, we have
Therefore, we have
We can use this concept to encode and decode our text messages. We can multiply our code matrix with the message matrix to encode it. And multiply the inverse of the code matrix, that is, the key matrix with the encoded message matrix to decode it.
Let us encode our message matrix by multiplying it with a code matrix as given below:
Multiplying a matrix with its inverse gives us an Identity matrix. We have
Converting the matrix A into an identity matrix using elementary row operations, we have
Using this concept we convert our code matrix into its inverse the key matrix given below:
Multiplying this key matrix with the encoded message matrix gives us our original message matrix, as shown below.
Replacing the numbers in the message matrix with equivalent characters we get
Image Credits: pixabay.com
Tags :
Note: Your email address will not be displayed with the comment.