Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

MAMCS Session 3

Fall, 2010

In-Jae Kim Department of Mathematics and Statistics Minnesota State University, Mankato in-jae.kim@mnsu.edu

1

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

In the Mankato Area Math Circle for Students (MAMCS), we will Think deeply on simple things!! to improve our problem solving skills. To solve problems, student will 1. Do some experiments and observe patterns; 2. Find proper mathematical tools and do proper reasoning; 3. Make a conclusion; and 4. Find other applications of the kit of tools and reasoning.

2

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Session Plan a. Matrix Operations (Equality, Sum/Difference, Multiplication) b. Matrix Inverse & Determinant c. Hill Cipher

3

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Matrix Operations

A matrix is a rectangular array of numbers. For example,

 A=

 1 2

3

4 5

6

is a matrix. Each of the horizontal arrays in a matrix is called a row, and each of the vertical arrays is called a column. If a matrix has m rows and n columns, then we say that the size of the matrix is m × n. For instance the matrix A above has the size 2 × 3. An n × n matrix is called a square matrix. The entry in the intersection of row i and column j is called the (i, j)-entry of the matrix.

4

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

For two matrices A and B of the same size, we can define matrix equality (A

= B ), addition (A + B ) and subtraction (A − B ) entrywise.

Example (a) The equality

 

 1 2

=

3 4 means that x (b)

 x y u

v

= 1, y = 2, u = 3 and v = 4.  

 1 2 3 4

+

−1

0

2

−2

=

 0 2 5 2

5

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Scalar Multiplication & Matrix Multiplication A scalar multiplication of a matrix is simply a number times a matrix, defined entrywise. Example

 2

1

2

3

4

=

2 4

.

6 8

To define a matrix multiplication, we first illustrate a row times a column:

[ 1

2

] 4   3   5  = (1 · 4) + (2 · 5) + (3 · 6) = 32. 6

In order to make this multiplication work, the number of entries in the row must be equal to the number of entries in the column.

6

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

7

Matrix Multiplication Now, in order to multiply two matrices A and B , we multiply each row of A with each column of B . Hence, we need to make sure that the number of entries in each row of A, which is the number of columns of A, is equal to the number of entries in each column of B , which is equal to the number of rows of B . This implies that AB is defined only if A is an m × k matrix and B is a k

× n. The

(i, j)-entry of AB is equal to (row i of A) times (column j of B ), and hence the size of AB is m × n.

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

8

Example Let

A=

 1 1

0

0 2

1

Then AB is the 2 × 2 matrix

 and B =  

0 −2

2×3

 

1 −1

 1

1

−2

7

.

 2   3

3×2

.

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Matrix Inverse For nonzero numbers a and b, if ab

= 1 = ba, then we say that b is the multiplicative inverse of a, and b can be written as a−1 . To talk about the multiplicative inverse of a matrix, we need to find a matrix that acts like number 1. Such a matrix is called the identity matrix, and denoted by

    In =    

1

0

0

1

.. .

..

··· ..

.

.

1

0 ···

0

 0

   .  0   1 .. .

In addition, for an m × n matrix A to have a multiplicative inverse B with size

k × ℓ, both of products, AB and BA, must be defined and have the same size. This implies that A and B must be square matrices of the same size.

9

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Let A and B be n × n matrices. If AB

= BA = In , then we say that B is the (multiplicative) inverse of A, and is denoted by A−1 . If A has its inverse, then A is called invertible. Example Let

 A=

 1 2

.

1 3 

Then −1

A

=

3

−2

−1

1

 .

10

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Determinant and Matrix Inverse Note that not every square matrix has its inverse. For example, the matrix

 

1

1

2

2

 

does not have any inverse. If there were its inverse 

 

 1

1

2

2



 a

b

c

d

 a

b

c

d

=

, then

 1 0

.

0 1

However, by comparing the (1, 1)- and (2, 1)-entries of both sides, we get

a + c = 1 and a + c = 0, which cannot be true.

11

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Question Is there any indicator for a square matrix to have its inverse? The determinant of an n × n matrix A

= [aij ] can be defined recursively as

follows:

det(A) = ai1 (−1)i+1 det(Ai1 )+ai2 (−1)i+2 det(Ai2 )+· · ·+ain (−1)i+n det(Ain ) = a1j (−1)1+j det(A1j ) + a2j (−1)2+j det(A2j ) + · · · + anj (−1)n+j det(Anj ), where Aij is the (n − 1) × (n − 1) matrix obtained from A by deleting row i and column j . The factor (−1)i+j

det(Aij ) is called the (i, j)-cofactor of A,

and denoted by Cij . Hence,

det(A)

= ai1 Ci1 + ai2 Ci2 + · · · + ain Cin = a1j C1j + a2j C2j + · · · + anj Cnj .

This is called a cofactor expansion of det(A).

12

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Determinant and Matrix Inverse Theorem 1 Let A be an n × n matrix. Then det(A)

̸= 0 if and only if A is

invertible. The inverse of an n × n invertible matrix A can be written −1

A

1 = CT , det(A)

where C T is the transpose of C , obtained from C by interchanging the roles of rows and columns. Example Find the inverse of the following matrix

 A=

 2 2 3 4

.

13

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Hill Cipher Each letter is first encoded as a number. Often the simplest scheme is used: A

= 0, B = 1, ..., Z= 25. A block of n letters is then considered as a vector of n dimensions, and multiplied by an n × n matrix, modulo 26. The whole matrix is considered the cipher key. Consider the message “ACT”, and the key below

1 2

  1 1  3 1

3

 1  . 2

Since “A” is 0, “C” is 2 and “T” is 19, the message is the vector

0

   2 .   19

14

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Thus, the encrypted vector is given by

1

  1  3

2 1 1

3



0

9

        1   2  ≡  21   (mod 26) 2 19 14

15

Mankato Area Math Circle for Students, Fall 2010

MAMCS Session 3

Decryption In order to decrypt, we turn the ciphertext back into a vector, then simply multiply by the inverse matrix of the key matrix. We can compute the inverse of the key matrix by the matrix inverse formula, A−1

= det(A)−1 C T . This time the necessary and sufficient condition for a square matrix modulo 26 to be invertible is slightly different from the previous one for a real matrix. Theorem 2 Let A be an n × n matrix modulo 26. Then A is invertible if and only if det(A) is not divisible by any of 2 and 13. To compute det(A)−1 , we need to solve the congruence equation

det(A)x ≡ 1 (mod26). In another word, the Diophantine equation

det(A)x + 26y = 1 must have a solution, which implies that gcd(det(A), 26)

= 1.

16

Mankato Area Math Circle for Students, Fall 2010

1 2

3

  1 1  3 1

−1

 1   2

MAMCS Session 3

17

 ≡  17 18

9 11 7

9

 8   (mod 26) 9

Taking the previous example ciphertext of “ACT”, we get:

17

  17  18

9 11 7

9



9

0

        8   21  ≡  2   (mod 26) 14 19 9

17

MAMCS Session 3

Notes for MAMCS session 3