## Introduction: Encrypt a Message Using Matrixes

Well, it seems that you can use matrices to encode a secret message. That is pretty self-explanatory, so I'll stop writing here and go on to step 1.

Oh, wait, I came back to the introduction. You don't need a graphing calculator, but if you just so happen to have a TI 84+, I have a program that may help you out.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?

Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Letters to Numbers

Actually, two things happen in this step. First off, you need to find a message worthy of undergoing this encryption. This may be difficult if you are just here because you find secret codes awesome, but have no secrets.

Ok, now that you have your message, you need to convert it to numerical format. An underbar (_) is a space ( ).

0 = _

1 = A

2 = B

3 = C

4 = D

5 = E

6 = F

7 = G

8 = H

9 = I

10 =J

11 = K

12 = L

13 = M

14 = N

15 = O

16 = P

17 = Q

18 = R

19 = S

20 = T

21 = U

22 = V

23 = W

24 = X

25 = Y

26 = Z

For my message, I will use "send help".

So it would look like, SEND_HELP_

Notice the space on the end. This is because you *must* have an even number of characters, because of how the encryption works (in groups of two letters).

When the letters are changed to numbers, my message reads as:

19,5,14,4,0,8,5,12,16,0

But remember, we are doing this with matrixes and letters in groups of two, so it will be better if you write it in this format:

[19 5] [14 4] [0 8] [5 12] [16 0]

## Step 2: The Key

We now need a four integer key. For example,

[4 3]

[5 -3]

I don't think you can use zeroes. Otherwise, you can use any integer, but the bigger the numbers, the harder it will be to multiply out by hand.

## Step 3: Multiply

Now, you have to multiply. This involves math.

We have the message:

[19 5] [14 4] [0 8] [5 12] [16 0]

and the key:

[4 3]

[5 -3]

To make this easier to write, lets name our matrices.

We will call the key [K].

[19 5] can be [A1]

[14 4] can be [A2]

[0 8] can be [A3]

[5 12] can be [A4]

and [16 0] can be [A5]

We will call the results [B''n''], where *n* matches the [A''n''] matrices.

Now, we multiply like this:

[A''n''] * [K] = [B''n'']

[A1] * [K] = [B1]

[B1] = [101 42]

This is not the time to realize you don't know how to multiply matrices, as that is not what this instructable teaches. If you have no idea how I did what I just did, go learn how to multiply matrices, or get a graphing calculator (like the TI 84+). Remember, order *is* important here.

Once you multiply out you matrixes, you get the encoded results.

[B1] = [101 42]

[B2] = [76 30]

[B3] = [40 -24]

[B4] = [80 -21]

[B5] = [64 48]

The picture in this step demonstrates how matrix multiplication works.

## Step 4: Rewrite

From the previous step, we got:

[B1] = [101 42]

[B2] = [76 30]

[B3] = [40 -24]

[B4] = [80 -21]

[B5] = [64 48]

You can rewrite this as:

101, 42, 76, 30, 40, -24, 80, -21, 64, 48

Now you have an encrypted message!

## Step 5: Decryption

Recall that to encrypt your message, we used:

[A''n''] * [K] = [B''n'']

Well, to decrypt it, we use

[B''n''] * [K]^{-1} = [A''n'']

[K]^{-1} is the inverse of [K]. This Instructable doesn't teach you how to find the inverse of a matrix either. Google it or get a graphing calculator.

## Step 6: TI 84+ Program

If you have a TI 84+ you could multiply the matrices with it, or you could use the nifty program I wrote to do it all for you.**I have uploaded the program in zip format. It exceeded even my expectations! You can quickly and easily encrypt and decrypt messages with any sized key. Full documentation is included.**

### Attachments

## 2 People Made This Project!

- marks399 made it!
- NerdAlert1101 made it!

## 32 Discussions

Question 1 year ago on Step 1

If I have 2*2 matrix and I got message that got an odd number ex:

2 4 23 3 2 6

3 5 12 4 4

So,what should I do with 6?

Question 1 year ago on Step 2

Please how do we choose the key matrix, is it selected randomly to fit in with the encryption matrix?

4 years ago

I can't open that document? How should I do this? .zip file?

7 years ago on Introduction

Is your program compatible with a TI-83 Plus?

9 years ago on Step 6

would it be possible to put the test of the program on instructables, so that it can be adapted to other calculators?

Reply 8 years ago on Step 6

I meant text

8 years ago on Introduction

Great Instructable!!! I learned how to do this and math and thought this was pretty cool. :D

9 years ago on Introduction

I made a program similar to this one. Only my program took a string of letters and changed it first into a list of numbers and then into a matrix of 0's and 1's I later made another program that does the same thing and then takes the matrix and reads it inverted, generates a string of numbers which were easier to send as a message and much more secure but much harder to decode without the program. If anyone wants, I may post an ible on this exact program and share the program as well.

9 years ago on Introduction

Could you post the actual code for the TI program?

9 years ago on Introduction

A graphing calculator.

9 years ago on Step 2

If you have a TI 84, you could just use my program. It gets it.

9 years ago on Introduction

If anyone is interested, I have just uploaded the TI 84 program.

9 years ago on Introduction

It's just simply sophisticated?!?! I think I'll start something a bit less...

9 years ago on Introduction

I don't understand the formula?!?!

10 years ago on Introduction

Can Somebody write a code for a batch file to encrypt like this?

Reply 10 years ago on Introduction

I am not sure if that is possible. Even though batch and TI BASIC are very similar, TI BASIC has more math-related commands, making it very easy to multiply matrices from a program. Batch doesn't have that functionality.

10 years ago on Step 6

I know a way with out if .. then statements.

Reply 10 years ago on Step 6

I asked a friend at school, and he told me to use the sub( command. I have it fixed on my calculator, I just need to update the instructable.

10 years ago on Step 3

i give up!

Reply 10 years ago on Step 3

Do you want help?