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

36.36% Correct | 63.64% Incorrect
Last Solution submitted on Dec 28, 2022

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers10

Suggested Problems

More from this Author92

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!