Cryptography with Matrices

Cryptography with Matrices

#Cryptography #Matrices

Well hello and welcome to the third tutorial on applications of matrices this time we’re going to be looking at our third objective which is the encoding and decoding of secret messages using matrices so let’s go through our lesson here here is our area of a triangle and here is our collinear

Points so here we are on cryptography and cryptography is the study of codes and code breaking code breaking so if you’re interested in cryptography matrices might be a good thing to go and study I am going to just choose a random 2×2 matrix right here and I’m gonna call

This the encoder matrix in fact I’ll go ahead and call it matrix e for encoder what we need to do is use that to find our decoder matrix to find our decoder matrix we’re simply going to take the inverse of this encoder matrix so since our decoder matrix is an inverse I’m

Going to use the symbol for inverse and I know that this is going to be 1 divided by the determinant times our switch it up matrix so I need to find the determinant first and that’s going to be doing our little fish thing here so we’ve got this diagonal which is 4

Times 0 is 0 minus this diagonal which is 2 times negative 5 is negative 10 0 minus negative 10 is positive 10 so that’s the determinant and then to switch this matrix up the 4 and the 0 will switch places and the 2 and the negative 5 will stay where they are but

They will become the opposite so a negative 2 and a positive 5 this is our decoder matrix and again the relationship between these two matrices is that they are inverses these are inverse matrices okay and these are the matrices that you definitely want to keep secret if you’re trying to encode

And decode messages you do not want to give either of these two matrices out because then somebody’s going to be able to break your code so let’s talk about a basic code that we’re going to be using for basic code here let me choose a good color

Basic code we would assign each letter to a number if we want to use a space we might assign that to a zero and a since it’s the first letter would be one and B would be the second letter so two and C is three and that M would be equal to 13

That down to Z which would be equal to 26 this will be there but the basic code that we use so zero through 26 if you want to use a period or an exclamation point or even quotation marks you can assign different numbers to them but

This is just our basic code and we’ll go ahead and use that so let’s figure out how to encode this secret message which is adv spaced alg a fascinating secret message to encode first what we need to do is assign a number to each of these

Letters so since a is the first letter of the alphabet that’s going to be a 1 D is the fourth letter so it’s a 4 V is the 22nd letter so that’s 22 we have a space here so I’m going to put a 0 a

Again as the one L is the 12th letter and G abcdefg is the 7th letter in our alphabet so here’s our numbers and we’re going to put these into a matrix now this matrix that we’re going to put them into is eventually going to be multiplied to our encoder matrix and

Since our encoder matrix is a 2 by 2 we need to have 2 columns in the matrix that we choose so that we are able to do the matrix operation because remember the the inner numbers have to be the same so I know that I’m going to be

Using 2 columns for my matrix so I’m gonna go ahead and draw this I don’t know how long it’s going to be in terms of how long these columns are but I do know that it’s going to be 2 columns and I’m just going to start putting the

Numbers into my matrix in order so a 1 and then a 4 and then the 22 and then the 0 and then the 1 and the 12 and then the 7 now obviously our matrix is not yet complete because there’s something missing here but since we are at the end of our

Message what should we put here we can just put a random space so I’ll put a zero there just to fill out the rest of our matrix now I’m able to multiply that set of numbers which is our our message that we want to encode times our encoder

Matrix which was 4 negative 5 2 & 0 again this is a 4 by 2 and I can multiply that to my 2 by 2 and needed to have 2 columns so that I could do that okay so let’s do our actual multiplication I know that a 4 by 2

Times a 2 by 2 is going to result in another 4 by 2 so I’m going to go ahead and put that here I like to put little spaces here to put my math this is my middle step this is a review of multiplying matrices and then ultimately

I will have my finished answer so I’ll put that here so let’s multiply remember we multiply rows by columns so I like to circle as a visual the first row of the first matrix and the first column of the second Matrix so I can begin my multiplication this row times this

Column we’ve got 1 times 4 which is 4 & 4 times 2 which is 8 I add those together and I’ve got 12 I stick with this same row but I moved to the second column the first element 1 times negative 5 is negative 5 the second

Element 4 times the second element 0 4 times 0 is 0 I add those up and I’ve got negative 5 and I’m finished with my first row now I’ll go to my second row if you like to Circle it go ahead I’m not going to 22 times 4 is 88 and the

Next element 0 times 2 is 0 so that of course adds up to 88 sticking with the second row 22 times negative 5 is negative 110 and 0 times 0 is 0 add those together we’re at negative 110 now I’m to my third row my first element

One times four is four and move across to 12 times to end down two to 12 times 2 is 24 add those up and we’ve got 28 sticking with the third row the first element 1 times negative 5 is negative 5 and the second element 12 times the

Second element 0 is 0 so that’s negative 5 and finally our last row the 7 and 0 will multiply to the 4 and the 2 so 7 times 4 is 28 0 times 2 is 0 28 and then finally 7 times negative 5 is negative

35 and 0 times 0 is 0 add that up and we’ve got negative 35 so what we did was we took our message assigned numbers to each of the letters put those numbers into this matrix and then encoded it by multiplying by the encoder matrix which

Again was just some random matrix that I keep secret from everybody once I’ve done that math this is my encrypted message this I can send over an email or write it on a node and give it to somebody I don’t mind if anybody gets this because you cannot figure out what

These numbers mean unless you have the decoder so this is really basically you know nonsense white noise to somebody unless they have the N coder so let’s figure out how to encode excuse me how to decode this message and figure out what the message is let’s say that

Somebody sends you this code and we need to figure out what they’re trying to tell you let’s figure out how to do that on the next slide ok so here we are on our next page and we have our encrypted message here that we’re trying to decode

So we need our decoder matrix I’m going to go back to our previous page here’s our decoder matrix 1/10 times 0 5 negative 2 or 1/10 times zero 5 negative 2 4 so I’m going to put that right here 1/10 times 0 5 negative 2 4 2 decode our message we

Simply need to multiply these two matrices together for right now I’m going to leave the scalar alone I’ll multiply that in at the end I really don’t want to create fractions in the middle of my work so I’m gonna leave the 1/10 alone for right now so okay I’ve

Got the 1/10 here I know that again a 4 by 2 times a 2 by 2 is going to be that 4 by 2 so I’m gonna put my my middle step here and that’s going to result in I’m gonna keep that 1/10 there that and then I’ll finally have my answer right

Here once I put the 1/10 into that so let’s do our matrix multiplication again I’m gonna circle the first row and the first column and here we go we’ve done this a few times now 12 times 0 negative 5 times negative 2 12 times 5 is 60

Negative 5 times 4 is negative 20 that subtracts to 40 next row Oh big numbers here 88 times zero well that’s not too bad 0 negative 110 times negative 2 is positive 220 so that’s 220 right here 88 times 5 I see 80 times five is four

Hundred and eight times five is forty so that’s 440 negative 110 times 4 is negative 440 well that just cancels out to 0 I’m moving on to the third row 28 times 0 is 0 negative 5 times negative 2 is 10 twenty-eight times five again I see 20

Times five is 180 times 5 is 40 so 140 negative 5 times 4 is negative 20 that subtracts to 120 and then finally our last row 28 times 0 is 0 negative 35 times negative 2 is positive 70 so that’s a 70 and again 28 times 5 is 140

Negative 35 times 4 is negative 140 and that cancels that again to 0 so these are the answers after the multiplication remember we still have to multiply the one tenth to each of these which basically knocking off a zero so this

Becomes a 1 a 4 a 22 a 0 a 1 a 12-7 and a 0 this is our encoded numbers excuse me our decoded numbers now we just have to assign those numbers one for 2201 12 7 and 0 and assign letters so that’s the first letter that’s the

Fourth letter that’s the 22nd letter 0 means that there’s a space we’re down to the first letter again the 12th letter is L the seventh letter is G and then there’s another space but that’s kind of a nonsense space we’ve figured out what the secret message is it’s advanced

Algebra I hope you had fun with this bye-bye

Like it? Share with your friends!


What's Your Reaction?

hate hate
confused confused
fail fail
fun fun
geeky geeky
love love
lol lol
omg omg
win win


Choose A Format
Voting to make decisions or determine opinions
Formatted Text with Embeds and Visuals
Youtube and Vimeo Embeds
Soundcloud or Mixcloud Embeds
Photo or GIF
GIF format