>> double (s) ans = Columns 1 through Columns 13 through

Size: px
Start display at page:

Download ">> double (s) ans = Columns 1 through Columns 13 through"

Transcription

1 3. Encryption A cryptosystem is a way of encoding and decoding messages so that only certain people are able to read them. This case presents a cryptosystem based on matrix algebra and implemented using Matlab. It is much more secure than simple systems you may have seen, such as replacement of each letter by a different letter. Although it is not secure enough for serious commercial or diplomatic use, it does serve to introduce some features also found in more sophisticated systems. We ll introduce the cryptosystem by showing how it encrypts and then decrypts a simple 15-character message, stored in a variable s: >> s = 'This is a test!' s = This is a test! Then we ll suggest some ways in which you can write more general functions for encrypting and decrypting. Finally, we ll use the ideas of this case to introduce the concept of a public-key cryptosystem. Encrypting a message. The first step of disguising the message is to convert it into an array of numbers. The Matlab function double does exactly this when applied to a variable containing the message: >> double (s) Columns 1 through Columns 13 through Matlab uses the standard computer character code (the so-called ASCII code) to assign a different number to each letter and punctuation mark. A space is also regarded as one of the characters of the message, and is translated as you can see in our example to its own number, namely 32. To apply a matrix-algebra encryption scheme to this numerical form of the message, we begin by arranging the array of numbers into a 3 5 matrix. Matlab s reshape function does exactly this: >> nnumb = reshape (double(s), 3, 5) nnumb = For convenience, we have here stored the resulting matrix in a new variable, nnumb. We now arrive at the crucial step of the encryption, in which we transform 15

2 this matrix to another 3 5 matrix. The transformation is effected by multiplying our matrix on the left by a 3 3 matrix. Not any such matrix will do, however. To make decryption possible, we must multiply by a 3 3 matrix whose entries are all integers (whole numbers), and whose inverse has entries that are all integers. For example, the integer matrix >> m = [1 5 3; ; ] m = can be seen to meet our requirements for its inverse by applying Matlab s inv function: >> inv(m) Later in this case, we ll have more to say about how such a matrix can be constructed. We re now almost ready to multiply by m. But because the printable characters have ASCII codes in the range 32 to 126, we must first adjust the 3 5 message matrix by subtracting 32 from every element: >> nnumb Now the matrix must contain values in the range 0 to 94, and it is ready to be transformed by matrix multiplication: >> m*(nnumb-32) This transformed matrix does not contain printable ASCII codes, but we can take care of that via the following further adjustment: >> ncode = mod (m*(nnumb-32), 95) + 32 ncode =

3 Here we have used the mod function to divide each element by 95 and keep only the remainder, and then we have added 32 so that the values again range from 32 to 126. All that remains to be done is to convert these numbers back to an array of characters. We use Matlab s char function to convert the numbers to characters, and reshape again to put them back into a 1 15 array: >> scode = reshape (char(ncode), 1, 15) scode = ]WQ1u\x5rYSM?Uy The last line gives the coded message to be sent. Notice that the same letter in two different places in the original message can go into two different letters in the coded message. For example, the i in this becomes a Q while the i in is becomes a \. Decrypting a message. If you were to receive the message ]WQ1u\x5rYSM?Uy, you would have to reverse the above steps to decrypt it and recover the original. Fortunately, a way of doing this is not hard to figure out, because the reversed steps of decryption are much the same as the original steps of encryption. The only poentially hard step is the reversal of the multiplication by the matrix m and that is where some elementary linear algebra comes in. To see how the encryption steps would be reversed, it helps to write them down completely. In words, the steps can be described as follows: 1. Translate the 15-character message to a 3 5 matrix of ASCII character codes. 2. Transform the matrix to an encrypted 3 5 matrix of ASCII character codes, by: (a) subtracting 32 from each element of the matrix; (b) multiplying the matrix by a given 3 3 matrix; (c) reducing each matrix element to its remainder modulo 95; (d) adding 32 to each element of the resulting matrix. 3. Translate the encrypted 3 5 matrix of ASCII character codes to an encrypted 15-character message. If you like descriptions that have a more mathematical flavor, then you might prefer the following: 1. Translate a message string s toa3 5 matrix A. 2. Use the given 3 3 matrix M to compute the encrypted matrix A = M(A 32) mod Translate A to an encrypted string s. Either way, these steps can be implemented as three Matlab statements: nnumb = reshape (double(s), 3, 5) ncode = mod (m*(nnumb-32), 95) + 32 scode = reshape (char(ncode), 1, 15) 17

4 These are exactly the three assignments that we have already derived in the course of illustrating the encryption procedure. To reverse the encryption steps, we must first undo step 3, then step 2, then step 1. Observe however that steps 1 and 3 merely translate a message between two representations, one as a string of characters and one as a matrix of numbers. Thus step 1, applied to encrypted string ]WQ1u\x5rYSM?Uy, undoes step 3. Furthermore step 3, applied to a decrypted matrix, will undo step 1. It remains for us to say how to reverse step 2. The essential idea here is that, since the given 3 3 matrix has an inverse, the way to undo multiplication by that matrix is simply to multiply by that matrix s inverse. (There are faster ways that we ll get to later, but multiplication by the inverse will do fine for now.) As for the other work of step 2, it turns out that exactly the same operations in the same order will undo the original encoding. This is the one aspect of the decryption procedure whose correctness is a bit tricky to establish, so we won t interrupt the presentation to give the proof here. In summary, our analysis shows that decryption consists of basically the same operations as encryption, with a few minor changes. We can thus proceed to describe the decryption procedure in much the same terms that we used for the encryption: 1. Translate the 15-character encrypted message to a 3 5 matrix of ASCII character codes. 2. Transform the encrypted matrix back to the original 3 5 matrix of ASCII character codes, by: (a) subtracting 32 from each element of the matrix; (b) multiplying the matrix by the inverse of a given 3 3 matrix; (c) reducing each matrix element to its remainder modulo 95; (d) adding 32 to each element of the resulting matrix. 3. Translate the original 3 5 matrix of ASCII character codes back to the original 15-character message. If you prefer the more mathematical description, you can think of the decryption procedure as working in this way: 1. Translate an encoded string s toa3 5 matrix A. 2. Use the given 3 3 matrix M to compute the original matrix A = M 1 (A 32) mod Translate A to the original string s. With these steps being almost the same as the encryption steps, we can use almost the same Matlab code. The only major changes are to replace the string s by the encrypted string scode at the beginning, and to multiply by the inverse matrix inv(m) rather than by m: ncode = reshape (double(scode), 3, 5) nnumb = mod (inv(m)*(ncode-32), 95) + 32 sorig = reshape (char(nnumb), 1, 15) 18

5 It remains only to type these statements into Matlab to check that they work. The first one, >> ncode = reshape (double(scode), 3, 5) ncode = produces the same encoded matrix that we saw before. The second, >> nnumb = mod (inv(m)*(ncode-32), 95) + 32 nnumb = undoes the matrix multiplication to return the same unencoded matrix that we saw before. And the third, >> sorig = reshape (char(nnumb), 1, 15) sorig = This is a test! turns the unencoded matrix back into the original string. M-files for encryption and decryption. It would be a nuisance to have to type all of the Matlab statements we have developed so far, every time a message was to be encrypted or decrypted. You could speed things up by creating a Matlab M-file called, say, encrypt.m, containing the three encryption statements: nnumb = reshape (double(s), 3, 5); ncode = mod (m*(nnumb-32), 95) + 32; scode = reshape (char(ncode), 1, 15) Similarly, an M-file called decrypt.m could contain the three decryption statements: ncode = reshape (double(scode), 3, 5); nnumb = mod (inv(m)*(ncode-32), 95) + 32; sorig = reshape (char(nnumb), 1, 15) Using these files, our entire previous example looks like this: >> s = 'This is a test!'; >> m = [1 5 3; ; ]; >> encrypt scode = cfu4 oz<%_bqd`3 >> decrypt sorig = This is a test! 19

6 Notice that, to avoid lengthy output, we have terminated most statements with a ; so as to suppress the output of their results. These M-files are reasonably convenient, but you do have to remember to set up an appropriate matrix in m and string in s or scode before typing the M-file s name to run the encryption or decryption procedure. A better alternative is to define function M-files for the encryption and decryption procedures. You are already familiar with function calls to builtin procedures, such as double(s), mod (m*(nnumb-32), 95), and reshape (char(ncode), 1, 15). Each function takes certain arguments in the commaseparated list within parentheses after the function name and returns a result value that can be displayed or used in larger expressions. In effect, a function acts as a black box that can take Matlab expressions of any complexity as its inputs (arguments) and that computes a corresponding output (result) without requiring the programming to know any of its internal details. The idea of a function M-file is to define your own functions through M-files that you write. In particular, to implement our cryptosystem we would like to call an encryption function through an expression like encrypt ('This is a test!', m) where the first argument is the string to be encrypted, and the second is the matrix that serves as the key. We would also want to be able to use a decryption function, decrypt ('cfu4 oz<%_bqd`3', m) where the first argument is a string previously encrypted using the given key. Our previous M-files can be made into function M-files by adding just one statement at the beginning. For example, our encryption M-file, encrypt.m, becomes the following function M-file: function scode = encrypt (s, m) nnumb = reshape (double(s), 3, 5); ncode = mod (m*(nnumb-32), 95) + 32; scode = reshape (char(ncode), 1, 15) The word function identifies this to Matlab as an M-function. It is followed by the name of the variable, scode, that represents the result value. Then, after the = sign, comes the name of the function, encrypt. At the end, in parentheses, are the names of the variables, s and m, for the function s arguments. When the function is called, the actual value of its first argument is assigned to s and the actual value of its second argument is assigned to m. Then the remaining lines of the M-file are executed in the usual way. Finally, the value of the result variable scode at the end of execution is passed back as the result of the function call. A similar line at the beginning of decrypt.m makes it into a function M-file: function sorig = decrypt (scode, m) ncode = reshape (double(scode), 3, 5); nnumb = mod (inv(m)*(ncode-32), 95) + 32; sorig = reshape (char(nnumb), 1, 15) 20

7 Here s an example of how these functions could be used. The person sending the message could compute the coded string and store it in a variable msgstring as follows: >> m = [1 5 3; ; ]; >> msgstring = encrypt ( This is a test!, m) msgstring = cfu4 oz<%_bqd`3 The recipient of the coded string might decode it like this: >> msgstring = cfu4 oz<%_bqd`3 ; >> decrypt (msgstring, [1 5 3; ; ]) This is a test! As you can see, it is up to the user of a function to decide how to express its argument values, and how to handle its result value. The user does not need to know the names of the variables the represent the arguments and result within the function M-file. Encryption keys. Our cryptosystem requires an integer matrix m whose inverse is also an integer matrix. In general, there is no easy way to identify matrices that have this property. Certain simple matrices having the property are easy to construct, however. You would not want to use such matrices as encryption keys, because the resulting coded messages might be too easy for unintended recipients to crack by guessing the key. However, you might use a product of such matrices. Specifically, if M 1, M1 1 and M 2, M2 1 are all integer, then M 1 M 2 and (M 1 M 2 ) 1 = M2 1 M 1 1 must also be integer, because matrix multiplication involves only the addition and multiplication of the integer elements. One easy choice for M 1 is to make it all integers below the diagonal, 1 s on the diagonal, and 0 s above the diagonal. For example: >> m1 = [1,0,0; 2,1,0; 4,4,1] m1 = M 2 could be defined similarly, but with the 0 s below the diagonal and the integers above: >> m2 = [1,5,3; 0,1,2; 0,0,1] m2 = Lower-triangular and upper-triangular matrices of these kinds are easily shown to have integer inverses, while their product is more general in nature: 21

8 >> m = m1 * m2 m = This is in fact how m was determined for use in our example. Suppose now that you want to apply these ideas to permit someone to send you coded messages that no one else can read. You would first pick any two triangular matrices like m1 and m2 and multiply them to get m. Then you would give m together with encrypt.m to your correspondent. The two of you would then go through the following steps in sending each message: 1. The other person executes code = encrypt(m,'text'), where text is the message written as a character string. 2. The other person sends you code, the resulting encoded string, by any reliable means. 3. You execute text = decrypt(m,'code') to recover the string text that contains the original message. This works because you have a copy of the key that was used to encrypt the message. Others could intercept the message, but without the key they would have a much harder time decrypting it. The weakness of this scheme lies in having to give your correspondent the key. There is a danger that the key will be intercepted and used by people from whom you are trying to hide your messages. You can reduce this danger by changing keys frequently; you might also want to translate (or compile) your encryption M-file into a form that is harder for others to understand. Even so, there is some danger in this approach, as there are many examples of hiddenkey cryptosystems that have been broken. As an alternative, you could make your key m public, and invite anyone to send you messages encrypted using that key. For security, you could rely on the difficulty of decryption. The most time-consuming step in encryption or decryption is computing inv(m)*(ncode-32) in decrypt.m, but this work can be greatly reduced if the triangular factors m1 and m2 are known. Specifically, for a matrix of n rows and columns, knowing the triangular factors reduces the work from a small multiple of n 3 to a small multiple of n 2. Thus, if you could use a large enough key matrix, it would not matter that you made it public, as long as you kept the original factors m1 and m2 to yourself. Others could use the public key to efficiently encrypt messages for you, but using the same key to decrypt your messages might take so much time as to be impractical. Only you would have the factors that would make decryption fast. This kind of public-key cryptosystem could be defeated if the factors m1 and m2 were easy to compute from m. But the work of computing the factors turns out to be roughly the same a small multiple of n 3 as the work of computing inv(m) or inv(m)*(ncode-32). Encryption thus remains much more difficult for people who know only the key than for the person who formed the key from its factors. 22

9 Given the speed and sophistication of current computers and software, a public-key cryptosystem based on triangular matrix factorizations is not really so secure. There are practical cryptosystems that rely on the same principles, however. They use a key that is the product of two very large prime numbers; their coding scheme can efficiently encrypt a message using just the key, but can efficiently decrypt the message only through a knowledge of the prime factors. They rely on the fact that finding and multiplying two large primes is much easier than recovering the two prime factors given only their product. Enhancements. All of our examples have assumed a 15-character message and a 3 3 key matrix. There are a number of enhancements that offer good practice in the programming of M-files. Most obviously, it would be desirable to have encode and decode functions that take as their arguments strings of any length, and key matrices of any dimension. Matlab s size function enables function M-files to determine the sizes of their arguments. A function M-file for choosing keys would also be useful. It could randomly generate the below-diagonal elements of a lower-triangular matrix and the above-diagonal elements of an upper-triangular matrix, then multiply them and return the result. Because Matlab uses ' characters to delimit strings, any encrypted string that contains a ' character will be hard to deal with. The encryption and decryption functions could be enhanced to circumvent this problem. Finally, short messages may be more vulnerable to unauthorized decryption than longer ones. To avoid short messages, the encryption function could be enhanced to automatically inflate the size of messages before encrypting them. The decryption function would then require a corresponding extention to deflate the message after decrypting it. A prime number is evenly divisible only by itself and 1. 23

Hill s Cipher: Linear Algebra in Cryptography

Hill s Cipher: Linear Algebra in Cryptography Ryan Doyle Hill s Cipher: Linear Algebra in Cryptography Introduction: Since the beginning of written language, humans have wanted to share information secretly. The information could be orders from a

More information

RSA Encryption. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles October 10, 2003

RSA Encryption. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles October 10, 2003 RSA Encryption Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles October 10, 2003 1 Public Key Cryptography One of the biggest problems in cryptography is the distribution of keys.

More information

K80TTQ1EP-??,VO.L,XU0H5BY,_71ZVPKOE678_X,N2Y-8HI4VS,,6Z28DDW5N7ADY013

K80TTQ1EP-??,VO.L,XU0H5BY,_71ZVPKOE678_X,N2Y-8HI4VS,,6Z28DDW5N7ADY013 Hill Cipher Project K80TTQ1EP-??,VO.L,XU0H5BY,_71ZVPKOE678_X,N2Y-8HI4VS,,6Z28DDW5N7ADY013 Directions: Answer all numbered questions completely. Show non-trivial work in the space provided. Non-computational

More information

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Module No. # 01 Lecture No. # 05 Classic Cryptosystems (Refer Slide Time: 00:42)

More information

Solutions to Problem Set 1

Solutions to Problem Set 1 YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467b: Cryptography and Computer Security Handout #8 Zheng Ma February 21, 2005 Solutions to Problem Set 1 Problem 1: Cracking the Hill cipher Suppose

More information

An Introduction to Hill Ciphers Using Linear Algebra

An Introduction to Hill Ciphers Using Linear Algebra An Introduction to Hill Ciphers Using inear Algebra Brian Worthington October 26, 2010 University of North Texas MATH 2700.002 1 Contents 1 Introduction 3 1.1 Substitution Ciphers.........................

More information

1. The RSA algorithm In this chapter, we ll learn how the RSA algorithm works.

1. The RSA algorithm In this chapter, we ll learn how the RSA algorithm works. MATH 13150: Freshman Seminar Unit 18 1. The RSA algorithm In this chapter, we ll learn how the RSA algorithm works. 1.1. Bob and Alice. Suppose that Alice wants to send a message to Bob over the internet

More information

3 Some Integer Functions

3 Some Integer Functions 3 Some Integer Functions A Pair of Fundamental Integer Functions The integer function that is the heart of this section is the modulo function. However, before getting to it, let us look at some very simple

More information

Lecture 3: Finding integer solutions to systems of linear equations

Lecture 3: Finding integer solutions to systems of linear equations Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture

More information

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may Number Theory Divisibility and Primes Definition. If a and b are integers and there is some integer c such that a = b c, then we say that b divides a or is a factor or divisor of a and write b a. Definition

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

Lab 4.4 Secret Messages: Indexing, Arrays, and Iteration

Lab 4.4 Secret Messages: Indexing, Arrays, and Iteration Lab 4.4 Secret Messages: Indexing, Arrays, and Iteration This JavaScript lab (the last of the series) focuses on indexing, arrays, and iteration, but it also provides another context for practicing with

More information

Solving simultaneous equations using the inverse matrix

Solving simultaneous equations using the inverse matrix Solving simultaneous equations using the inverse matrix 8.2 Introduction The power of matrix algebra is seen in the representation of a system of simultaneous linear equations as a matrix equation. Matrix

More information

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule.

Sequences. A sequence is a list of numbers, or a pattern, which obeys a rule. Sequences A sequence is a list of numbers, or a pattern, which obeys a rule. Each number in a sequence is called a term. ie the fourth term of the sequence 2, 4, 6, 8, 10, 12... is 8, because it is the

More information

Math Content by Strand 1

Math Content by Strand 1 Math Content by Strand 1 Number and Operations with Whole Numbers Multiplication and Division Grade 3 In Grade 3, students investigate the properties of multiplication and division, including the inverse

More information

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1. MATH10212 Linear Algebra Textbook: D. Poole, Linear Algebra: A Modern Introduction. Thompson, 2006. ISBN 0-534-40596-7. Systems of Linear Equations Definition. An n-dimensional vector is a row or a column

More information

Solution to Homework 2

Solution to Homework 2 Solution to Homework 2 Olena Bormashenko September 23, 2011 Section 1.4: 1(a)(b)(i)(k), 4, 5, 14; Section 1.5: 1(a)(b)(c)(d)(e)(n), 2(a)(c), 13, 16, 17, 18, 27 Section 1.4 1. Compute the following, if

More information

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving

Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving Section 7 Algebraic Manipulations and Solving Part 1 Expressions, Equations, and Inequalities: Simplifying and Solving Before launching into the mathematics, let s take a moment to talk about the words

More information

Stupid Divisibility Tricks

Stupid Divisibility Tricks Stupid Divisibility Tricks 101 Ways to Stupefy Your Friends Appeared in Math Horizons November, 2006 Marc Renault Shippensburg University Mathematics Department 1871 Old Main Road Shippensburg, PA 17013

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

Cyber Security Workshop Encryption Reference Manual

Cyber Security Workshop Encryption Reference Manual Cyber Security Workshop Encryption Reference Manual May 2015 Basic Concepts in Encoding and Encryption Binary Encoding Examples Encryption Cipher Examples 1 P a g e Encoding Concepts Binary Encoding Basics

More information

Introduction to Hill cipher

Introduction to Hill cipher Introduction to Hill cipher We have explored three simple substitution ciphers that generated ciphertext C from plaintext p by means of an arithmetic operation modulo 26. Caesar cipher: The Caesar cipher

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS Systems of Equations and Matrices Representation of a linear system The general system of m equations in n unknowns can be written a x + a 2 x 2 + + a n x n b a

More information

8 Square matrices continued: Determinants

8 Square matrices continued: Determinants 8 Square matrices continued: Determinants 8. Introduction Determinants give us important information about square matrices, and, as we ll soon see, are essential for the computation of eigenvalues. You

More information

Greatest Common Factor and Least Common Multiple

Greatest Common Factor and Least Common Multiple Greatest Common Factor and Least Common Multiple Intro In order to understand the concepts of Greatest Common Factor (GCF) and Least Common Multiple (LCM), we need to define two key terms: Multiple: Multiples

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

DERIVATIVES AS MATRICES; CHAIN RULE

DERIVATIVES AS MATRICES; CHAIN RULE DERIVATIVES AS MATRICES; CHAIN RULE 1. Derivatives of Real-valued Functions Let s first consider functions f : R 2 R. Recall that if the partial derivatives of f exist at the point (x 0, y 0 ), then we

More information

5.5. Solving linear systems by the elimination method

5.5. Solving linear systems by the elimination method 55 Solving linear systems by the elimination method Equivalent systems The major technique of solving systems of equations is changing the original problem into another one which is of an easier to solve

More information

Session 7 Fractions and Decimals

Session 7 Fractions and Decimals Key Terms in This Session Session 7 Fractions and Decimals Previously Introduced prime number rational numbers New in This Session period repeating decimal terminating decimal Introduction In this session,

More information

CHOOSING A COLLEGE. Teacher s Guide Getting Started. Nathan N. Alexander Charlotte, NC

CHOOSING A COLLEGE. Teacher s Guide Getting Started. Nathan N. Alexander Charlotte, NC Teacher s Guide Getting Started Nathan N. Alexander Charlotte, NC Purpose In this two-day lesson, students determine their best-matched college. They use decision-making strategies based on their preferences

More information

Direct Methods for Solving Linear Systems. Matrix Factorization

Direct Methods for Solving Linear Systems. Matrix Factorization Direct Methods for Solving Linear Systems Matrix Factorization Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c 2011

More information

Chapter 3. if 2 a i then location: = i. Page 40

Chapter 3. if 2 a i then location: = i. Page 40 Chapter 3 1. Describe an algorithm that takes a list of n integers a 1,a 2,,a n and finds the number of integers each greater than five in the list. Ans: procedure greaterthanfive(a 1,,a n : integers)

More information

Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix multiplication).

Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix multiplication). MAT 2 (Badger, Spring 202) LU Factorization Selected Notes September 2, 202 Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix

More information

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

Discrete Mathematics, Chapter 4: Number Theory and Cryptography Discrete Mathematics, Chapter 4: Number Theory and Cryptography Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 4 1 / 35 Outline 1 Divisibility

More information

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system 1. Systems of linear equations We are interested in the solutions to systems of linear equations. A linear equation is of the form 3x 5y + 2z + w = 3. The key thing is that we don t multiply the variables

More information

8.2. Solution by Inverse Matrix Method. Introduction. Prerequisites. Learning Outcomes

8.2. Solution by Inverse Matrix Method. Introduction. Prerequisites. Learning Outcomes Solution by Inverse Matrix Method 8.2 Introduction The power of matrix algebra is seen in the representation of a system of simultaneous linear equations as a matrix equation. Matrix algebra allows us

More information

Thinking of a (block) cipher as a permutation (depending on the key) on strings of a certain size, we would not want such a permutation to have many

Thinking of a (block) cipher as a permutation (depending on the key) on strings of a certain size, we would not want such a permutation to have many Fixed points of permutations Let f : S S be a permutation of a set S. An element s S is a fixed point of f if f(s) = s. That is, the fixed points of a permutation are the points not moved by the permutation.

More information

The application of prime numbers to RSA encryption

The application of prime numbers to RSA encryption The application of prime numbers to RSA encryption Prime number definition: Let us begin with the definition of a prime number p The number p, which is a member of the set of natural numbers N, is considered

More information

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system CHAPTER Number Theory FIGURE FIGURE FIGURE Plus hours Plus hours Plus hours + = + = + = FIGURE. Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter described a mathematical

More information

Matrices 2. Solving Square Systems of Linear Equations; Inverse Matrices

Matrices 2. Solving Square Systems of Linear Equations; Inverse Matrices Matrices 2. Solving Square Systems of Linear Equations; Inverse Matrices Solving square systems of linear equations; inverse matrices. Linear algebra is essentially about solving systems of linear equations,

More information

Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan

Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan 3 Binary Operations We are used to addition and multiplication of real numbers. These operations combine two real numbers

More information

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 7, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic skills.

More information

Computing exponents modulo a number: Repeated squaring

Computing exponents modulo a number: Repeated squaring Computing exponents modulo a number: Repeated squaring How do you compute (1415) 13 mod 2537 = 2182 using just a calculator? Or how do you check that 2 340 mod 341 = 1? You can do this using the method

More information

Chapter 2 Homework 2-5, 7, 9-11, 13-18, 24. (9x + 2)(mod 26) y 1 1 (x 2)(mod 26) 3(x 2)(mod 26) U : y 1 = 3(20 2)(mod 26) 54(mod 26) 2(mod 26) c

Chapter 2 Homework 2-5, 7, 9-11, 13-18, 24. (9x + 2)(mod 26) y 1 1 (x 2)(mod 26) 3(x 2)(mod 26) U : y 1 = 3(20 2)(mod 26) 54(mod 26) 2(mod 26) c Chapter 2 Homework 2-5, 7, 9-11, 13-18, 24 2. The ciphertext UCR was encrypted using the affine function (9x + 2)(mod 26) Find the plaintext. First, we find the numerical values corresponding to UCR. U

More information

Here are some examples of combining elements and the operations used:

Here are some examples of combining elements and the operations used: MATRIX OPERATIONS Summary of article: What is an operation? Addition of two matrices. Multiplication of a Matrix by a scalar. Subtraction of two matrices: two ways to do it. Combinations of Addition, Subtraction,

More information

Linear Programming Problems

Linear Programming Problems Linear Programming Problems Linear programming problems come up in many applications. In a linear programming problem, we have a function, called the objective function, which depends linearly on a number

More information

1 Solving LPs: The Simplex Algorithm of George Dantzig

1 Solving LPs: The Simplex Algorithm of George Dantzig Solving LPs: The Simplex Algorithm of George Dantzig. Simplex Pivoting: Dictionary Format We illustrate a general solution procedure, called the simplex algorithm, by implementing it on a very simple example.

More information

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6 Number Systems No course on programming would be complete without a discussion of the Hexadecimal (Hex) number

More information

159.334 Computer Networks. Network Security 1. Professor Richard Harris School of Engineering and Advanced Technology

159.334 Computer Networks. Network Security 1. Professor Richard Harris School of Engineering and Advanced Technology Network Security 1 Professor Richard Harris School of Engineering and Advanced Technology Presentation Outline Overview of Identification and Authentication The importance of identification and Authentication

More information

Solving Equations. How do you know that x = 3 in the equation, 2x - 1 = 5?

Solving Equations. How do you know that x = 3 in the equation, 2x - 1 = 5? Question: Solving Equations How do you know that x = 3 in the equation, 2x - 1 = 5? Possible answers to the question are: 1. If you use guess and check, the only number that works for x is 3. 2. Why should

More information

MOVIES, GAMBLING, SECRET CODES, JUST MATRIX MAGIC

MOVIES, GAMBLING, SECRET CODES, JUST MATRIX MAGIC MOVIES, GAMBLING, SECRET CODES, JUST MATRIX MAGIC DR. LESZEK GAWARECKI 1. The Cartesian Coordinate System In the Cartesian system points are defined by giving their coordinates. Plot the following points:

More information

Lecture Notes 2: Matrices as Systems of Linear Equations

Lecture Notes 2: Matrices as Systems of Linear Equations 2: Matrices as Systems of Linear Equations 33A Linear Algebra, Puck Rombach Last updated: April 13, 2016 Systems of Linear Equations Systems of linear equations can represent many things You have probably

More information

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

More information

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS 1. SYSTEMS OF EQUATIONS AND MATRICES 1.1. Representation of a linear system. The general system of m equations in n unknowns can be written a 11 x 1 + a 12 x 2 +

More information

1.2 Solving a System of Linear Equations

1.2 Solving a System of Linear Equations 1.. SOLVING A SYSTEM OF LINEAR EQUATIONS 1. Solving a System of Linear Equations 1..1 Simple Systems - Basic De nitions As noticed above, the general form of a linear system of m equations in n variables

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

An Introduction to the RSA Encryption Method

An Introduction to the RSA Encryption Method April 17, 2012 Outline 1 History 2 3 4 5 History RSA stands for Rivest, Shamir, and Adelman, the last names of the designers It was first published in 1978 as one of the first public-key crytographic systems

More information

Operation Count; Numerical Linear Algebra

Operation Count; Numerical Linear Algebra 10 Operation Count; Numerical Linear Algebra 10.1 Introduction Many computations are limited simply by the sheer number of required additions, multiplications, or function evaluations. If floating-point

More information

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10 Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

More information

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2. Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given

More information

Welcome to Basic Math Skills!

Welcome to Basic Math Skills! Basic Math Skills Welcome to Basic Math Skills! Most students find the math sections to be the most difficult. Basic Math Skills was designed to give you a refresher on the basics of math. There are lots

More information

THE DIMENSION OF A VECTOR SPACE

THE DIMENSION OF A VECTOR SPACE THE DIMENSION OF A VECTOR SPACE KEITH CONRAD This handout is a supplementary discussion leading up to the definition of dimension and some of its basic properties. Let V be a vector space over a field

More information

Storing Measurement Data

Storing Measurement Data Storing Measurement Data File I/O records or reads data in a file. A typical file I/O operation involves the following process. 1. Create or open a file. Indicate where an existing file resides or where

More information

7 Gaussian Elimination and LU Factorization

7 Gaussian Elimination and LU Factorization 7 Gaussian Elimination and LU Factorization In this final section on matrix factorization methods for solving Ax = b we want to take a closer look at Gaussian elimination (probably the best known method

More information

Use of Linear Algebra in Cryptography

Use of Linear Algebra in Cryptography Use of Linear Algebra in Cryptography Hong-Jian Lai Department of Mathematics West Virginia University Morgantown, WV p. 1/?? Creating a Matrix Problem: To create a matrix A = 1 2 3 4 5 6 7 8 10. p. 2/??

More information

Working with whole numbers

Working with whole numbers 1 CHAPTER 1 Working with whole numbers In this chapter you will revise earlier work on: addition and subtraction without a calculator multiplication and division without a calculator using positive and

More information

SECTION 5: Finalizing Your Workbook

SECTION 5: Finalizing Your Workbook SECTION 5: Finalizing Your Workbook In this section you will learn how to: Protect a workbook Protect a sheet Protect Excel files Unlock cells Use the document inspector Use the compatibility checker Mark

More information

Factoring Whole Numbers

Factoring Whole Numbers 2.2 Factoring Whole Numbers 2.2 OBJECTIVES 1. Find the factors of a whole number 2. Find the prime factorization for any number 3. Find the greatest common factor (GCF) of two numbers 4. Find the GCF for

More information

Public Key Cryptography: RSA and Lots of Number Theory

Public Key Cryptography: RSA and Lots of Number Theory Public Key Cryptography: RSA and Lots of Number Theory Public vs. Private-Key Cryptography We have just discussed traditional symmetric cryptography: Uses a single key shared between sender and receiver

More information

Number Theory and Cryptography using PARI/GP

Number Theory and Cryptography using PARI/GP Number Theory and Cryptography using Minh Van Nguyen nguyenminh2@gmail.com 25 November 2008 This article uses to study elementary number theory and the RSA public key cryptosystem. Various commands will

More information

Linear Programming. March 14, 2014

Linear Programming. March 14, 2014 Linear Programming March 1, 01 Parts of this introduction to linear programming were adapted from Chapter 9 of Introduction to Algorithms, Second Edition, by Cormen, Leiserson, Rivest and Stein [1]. 1

More information

International Journal of Advanced Research in Computer Science and Software Engineering

International Journal of Advanced Research in Computer Science and Software Engineering Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:

More information

8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

More information

Ready, Set, Go! Math Games for Serious Minds

Ready, Set, Go! Math Games for Serious Minds Math Games with Cards and Dice presented at NAGC November, 2013 Ready, Set, Go! Math Games for Serious Minds Rande McCreight Lincoln Public Schools Lincoln, Nebraska Math Games with Cards Close to 20 -

More information

Vector Math Computer Graphics Scott D. Anderson

Vector Math Computer Graphics Scott D. Anderson Vector Math Computer Graphics Scott D. Anderson 1 Dot Product The notation v w means the dot product or scalar product or inner product of two vectors, v and w. In abstract mathematics, we can talk about

More information

Using row reduction to calculate the inverse and the determinant of a square matrix

Using row reduction to calculate the inverse and the determinant of a square matrix Using row reduction to calculate the inverse and the determinant of a square matrix Notes for MATH 0290 Honors by Prof. Anna Vainchtein 1 Inverse of a square matrix An n n square matrix A is called invertible

More information

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

WRITING PROOFS. Christopher Heil Georgia Institute of Technology WRITING PROOFS Christopher Heil Georgia Institute of Technology A theorem is just a statement of fact A proof of the theorem is a logical explanation of why the theorem is true Many theorems have this

More information

Math 319 Problem Set #3 Solution 21 February 2002

Math 319 Problem Set #3 Solution 21 February 2002 Math 319 Problem Set #3 Solution 21 February 2002 1. ( 2.1, problem 15) Find integers a 1, a 2, a 3, a 4, a 5 such that every integer x satisfies at least one of the congruences x a 1 (mod 2), x a 2 (mod

More information

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform MATH 433/533, Fourier Analysis Section 11, The Discrete Fourier Transform Now, instead of considering functions defined on a continuous domain, like the interval [, 1) or the whole real line R, we wish

More information

1. The Fly In The Ointment

1. The Fly In The Ointment Arithmetic Revisited Lesson 5: Decimal Fractions or Place Value Extended Part 5: Dividing Decimal Fractions, Part 2. The Fly In The Ointment The meaning of, say, ƒ 2 doesn't depend on whether we represent

More information

Solving Systems of Linear Equations

Solving Systems of Linear Equations LECTURE 5 Solving Systems of Linear Equations Recall that we introduced the notion of matrices as a way of standardizing the expression of systems of linear equations In today s lecture I shall show how

More information

The Chinese Remainder Theorem

The Chinese Remainder Theorem The Chinese Remainder Theorem Evan Chen evanchen@mit.edu February 3, 2015 The Chinese Remainder Theorem is a theorem only in that it is useful and requires proof. When you ask a capable 15-year-old why

More information

Solving Systems of Linear Equations Using Matrices

Solving Systems of Linear Equations Using Matrices Solving Systems of Linear Equations Using Matrices What is a Matrix? A matrix is a compact grid or array of numbers. It can be created from a system of equations and used to solve the system of equations.

More information

The last three chapters introduced three major proof techniques: direct,

The last three chapters introduced three major proof techniques: direct, CHAPTER 7 Proving Non-Conditional Statements The last three chapters introduced three major proof techniques: direct, contrapositive and contradiction. These three techniques are used to prove statements

More information

The Mathematics of the RSA Public-Key Cryptosystem

The Mathematics of the RSA Public-Key Cryptosystem The Mathematics of the RSA Public-Key Cryptosystem Burt Kaliski RSA Laboratories ABOUT THE AUTHOR: Dr Burt Kaliski is a computer scientist whose involvement with the security industry has been through

More information

MATH 10034 Fundamental Mathematics IV

MATH 10034 Fundamental Mathematics IV MATH 0034 Fundamental Mathematics IV http://www.math.kent.edu/ebooks/0034/funmath4.pdf Department of Mathematical Sciences Kent State University January 2, 2009 ii Contents To the Instructor v Polynomials.

More information

Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

More information

Hill Ciphers and Modular Linear Algebra

Hill Ciphers and Modular Linear Algebra Hill Ciphers and Modular Linear Algebra Murray Eisenberg November 3, 1999 Hill ciphers are an application of linear algebra to cryptology (the science of making and breaking codes and ciphers). Below we

More information

Preliminary Mathematics

Preliminary Mathematics Preliminary Mathematics The purpose of this document is to provide you with a refresher over some topics that will be essential for what we do in this class. We will begin with fractions, decimals, and

More information

Linear Algebra and TI 89

Linear Algebra and TI 89 Linear Algebra and TI 89 Abdul Hassen and Jay Schiffman This short manual is a quick guide to the use of TI89 for Linear Algebra. We do this in two sections. In the first section, we will go over the editing

More information

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Linear Algebra Notes for Marsden and Tromba Vector Calculus Linear Algebra Notes for Marsden and Tromba Vector Calculus n-dimensional Euclidean Space and Matrices Definition of n space As was learned in Math b, a point in Euclidean three space can be thought of

More information

Introduction to Encryption

Introduction to Encryption Computers and Society Introduction to Encryption Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/35 3-0: Terminology

More information

The Euclidean Algorithm

The Euclidean Algorithm The Euclidean Algorithm A METHOD FOR FINDING THE GREATEST COMMON DIVISOR FOR TWO LARGE NUMBERS To be successful using this method you have got to know how to divide. If this is something that you have

More information

Multiplicative Ciphers. Cryptography of Multiplicative Ciphers

Multiplicative Ciphers. Cryptography of Multiplicative Ciphers Fall 2006 Chris Christensen MAT/CSC 483 Multiplicative Ciphers It is evident from the relative ease with which the Caesar Cipher or its generalization to an arbitrary number of positions of shift has been

More information

Cryptography and Network Security. Prof. D. Mukhopadhyay. Department of Computer Science and Engineering. Indian Institute of Technology, Kharagpur

Cryptography and Network Security. Prof. D. Mukhopadhyay. Department of Computer Science and Engineering. Indian Institute of Technology, Kharagpur Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Module No. # 01 Lecture No. # 12 Block Cipher Standards

More information

FAREY FRACTION BASED VECTOR PROCESSING FOR SECURE DATA TRANSMISSION

FAREY FRACTION BASED VECTOR PROCESSING FOR SECURE DATA TRANSMISSION FAREY FRACTION BASED VECTOR PROCESSING FOR SECURE DATA TRANSMISSION INTRODUCTION GANESH ESWAR KUMAR. P Dr. M.G.R University, Maduravoyal, Chennai. Email: geswarkumar@gmail.com Every day, millions of people

More information

5.4 Solving Percent Problems Using the Percent Equation

5.4 Solving Percent Problems Using the Percent Equation 5. Solving Percent Problems Using the Percent Equation In this section we will develop and use a more algebraic equation approach to solving percent equations. Recall the percent proportion from the last

More information

Pigeonhole Principle Solutions

Pigeonhole Principle Solutions Pigeonhole Principle Solutions 1. Show that if we take n + 1 numbers from the set {1, 2,..., 2n}, then some pair of numbers will have no factors in common. Solution: Note that consecutive numbers (such

More information

Quotient Rings and Field Extensions

Quotient Rings and Field Extensions Chapter 5 Quotient Rings and Field Extensions In this chapter we describe a method for producing field extension of a given field. If F is a field, then a field extension is a field K that contains F.

More information

Chapter 6. Linear Programming: The Simplex Method. Introduction to the Big M Method. Section 4 Maximization and Minimization with Problem Constraints

Chapter 6. Linear Programming: The Simplex Method. Introduction to the Big M Method. Section 4 Maximization and Minimization with Problem Constraints Chapter 6 Linear Programming: The Simplex Method Introduction to the Big M Method In this section, we will present a generalized version of the simplex method that t will solve both maximization i and

More information