Problem 45279. Cryptography with A Square Matrix : Encoding
Matrix inverse operation can be used to encode or decode of a message. For example
text = 'matlab & cody'.
numeric equivalent is
num = [109 97 116 108 97 98 32 38 32 99 111 100 121]
let
key = magic(3);
key is an arbitrary square matrix and its inverse is exist.
reshape the vector num so it has the same number of rows with key matrix
numMatrix = [109 108 32 99 121; 97 97 38 111 32; 116 98 32 100 32];
Note that last two elements are filled with 32 which is the numeric equivalent of blank character ' '.
Finally multiply key with numMatrix (and reshape it) to obtain an encoded vector.
encodedVector= [1665 1624 1541 1549 1495 1501 486 510 534 1503 1552 1595 1192 747 836]
if you multiply inverse of key with reshaped encodedVector you can obtain the ascii numbers of secret message.
Next Problem : Cryptography with A Square Matrix : Decoding
Inspired from:
Barnett, R.A., Ziegler, M.R. and Byleen, K.E. (2015). Finite Mathematics for Business, Economics, Life Sciences, and Social Sciences. Pearson, 13th (Global) Edition. p:245-247.
Solution Stats
Problem Comments
-
3 Comments
it's a bit unclear why padding is necessary in the first two test cases, where the number of characters (15) is already a multiple of the key size (3 or 5, respectively)
I agree with Alfonso.
+1
@Mehmet can you explain why?
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Remove any row in which a NaN appears
8605 Solvers
-
620 Solvers
-
Generate N equally spaced intervals between -L and L
872 Solvers
-
Is the paranthesis sequence balanced ?
174 Solvers
-
15008 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!