8
Matrices define matrix We will use matrices to help us solve systems of equations. A matrix is a rectangular array of numbers enclosed in parentheses or brackets. In linear algebra, matrices are important because every matrix represents uniquely a linear transformation. Examples of matrices are: 2 3 "5 4 # $ % & ( and 1 0 0 0 1 0 0 0 1 # $ % % % & ( ( ( . The particular numbers constituting a matrix are called its entries or elements. To distinguish between elements, we identify their position in the matrix by row and column. E.g., in the matrix 2 3 "5 4 # $ % & ( the element in the first row and second column is 3 and is designated by a 12 . The size or dimension of a matrix is specified by the number of rows and the number of columns, in that order. E.g., the matrix 1 " 2 0 1 3 " 1 # $ % & ( is a 2 X 3 matrix. used to describe systems of linear equations Matrices are a natural choice to describe systems of linear equations. Consider the following system of linear equations in standard form: 2 x " 3y + 4 z = 14 3x " 2 y + 2z = 12 4 x + 5 y " 5z = 16 . The coefficient matrix of this system is the matrix: 2 " 3 4 3 " 2 2 4 5 " 5 # $ % % % & ( ( ( . This matrix consists of the coefficients of the variables as they appear in the original system. The augmented matrix of this system is 2 " 3 4: 14 3 " 2 2: 12 4 5 " 5: 16 # $ % % % & ( ( ( . The augmented matrix includes the constant terms. The colons separate the coefficients from the constants. solving systems of linear equations with matrices Matrices may be used to solve systems of linear equations. The operations that we perform to solve a system of linear equations correspond to similar elementary row operations for a matrix. We'll solve the system 2 x " 3y + 4 z = 14 3x " 2 y + 2z = 12 4 x + 5 y " 5z = 16 using Gaussian elimination (Gaussian elimination is a modified version of the elimination or linear combination method used to solve systems of linear equations) and similar row operations in matrices, side-by-side. First, we represent the system of linear equations with an augmented matrix. 2 x " 3y + 4 z = 14 3x " 2 y + 2z = 12 4 x + 5 y " 5z = 16 2 " 3 4: 14 3 " 2 2: 12 4 5 " 5: 16 # $ % % % & ( ( (

Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

  • Upload
    ledat

  • View
    220

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

Matrices define matrix We will use matrices to help us solve systems of equations. A matrix is a rectangular array of numbers enclosed in parentheses or brackets. In linear algebra, matrices are important because every matrix represents uniquely a linear transformation.

Examples of matrices are:

!

2 3

"5 4

#

$ %

&

' ( and

1 0 0

0 1 0

0 0 1

#

$

% % %

&

'

( ( ( . The particular numbers constituting a

matrix are called its entries or elements. To distinguish between elements, we identify

their position in the matrix by row and column. E.g., in the matrix

!

2 3

"5 4

#

$ %

&

' ( the element

in the first row and second column is 3 and is designated by

!

a12 . The size or dimension of a matrix is specified by the number of rows and the number of columns, in that order.

E.g., the matrix

!

1 " 2 0

1 3 "1

#

$ %

&

' ( is a 2 X 3 matrix.

used to describe systems of linear equations Matrices are a natural choice to describe systems of linear equations. Consider

the following system of linear equations in standard form:

!

2x " 3y + 4z =14

3x " 2y + 2z =12

4x + 5y " 5z =16

.

The coefficient matrix of this system is the matrix:

!

2 " 3 4

3 " 2 2

4 5 " 5

#

$

% % %

&

'

( ( ( . This matrix consists of

the coefficients of the variables as they appear in the original system. The augmented

matrix of this system is

!

2 " 3 4 : 14

3 " 2 2 : 12

4 5 " 5 : 16

#

$

% % %

&

'

( ( ( . The augmented matrix includes the constant

terms. The colons separate the coefficients from the constants. solving systems of linear equations with matrices Matrices may be used to solve systems of linear equations. The operations that we perform to solve a system of linear equations correspond to similar elementary row

operations for a matrix. We'll solve the system

!

2x " 3y + 4z =14

3x " 2y + 2z =12

4x + 5y " 5z =16

using Gaussian

elimination (Gaussian elimination is a modified version of the elimination or linear combination method used to solve systems of linear equations) and similar row operations in matrices, side-by-side. First, we represent the system of linear equations with an augmented matrix.

!

2x " 3y + 4z =14

3x " 2y + 2z =12

4x + 5y " 5z =16

!

2 " 3 4 : 14

3 " 2 2 : 12

4 5 " 5 : 16

#

$

% % %

&

'

( ( (

Page 2: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

Our goal is to add linear combinations of the first row with the second and third rows to "eliminate" the x terms, i.e., to make their x coefficients zero. Before we do this, we want the coefficient of x in the first equation to be equal to 1. So, we need to multiply

the first row by 1/2. We will use the shorthand notation

!

1

2R1 to indicate this.

!

x "3

2y + 2z = 7

3x " 2y + 2z =12

4x + 5y " 5z =16

!

1 "3

2 2 : 7

3 " 2 2 : 12

4 5 " 5 : 16

#

$

% % % % %

&

'

( ( ( ( (

Next, we multiply the first row by –3 and add it to the second row, and we multiply the first row by –4 and add it to the third row,

!

"3R1 + R2 and

!

"4R1 + R3.

!

x "3

2y + 2z = 7

5

2y " 4z = "9

11y "13z = "12

!

1 "3

2 2 : 7

0 5

2 " 4 : " 9

0 11 "13 : "12

#

$

% % % % % %

&

'

( ( ( ( ( (

Now we want to add a linear combination of the second row to the third row to eliminate the y term. But first we want the coefficient of the y term to be equal to 1, so

we multiply the second row by 2/5,

!

2

5R2.

!

x "3

2y + 2z = 7

y "8

5z = "

18

5

11y "13z = "12

!

1 "3

2 2 : 7

0 1 "8

5: "

18

5

0 11 "13 : "12

#

$

% % % % % %

&

'

( ( ( ( ( (

Next, we multiply the second row by –11 and add it to the third row,

!

"11R2 + R3.

!

x "3

2y + 2z = 7

y "8

5z = "

18

5

23

5z =

138

5

!

1 "3

2 2 : 7

0 1 "8

5: "

18

5

0 0 23

5:

138

5

#

$

% % % % % %

&

'

( ( ( ( ( (

We can solve for z (z = 6) and back substitute to solve for y (y = 6) and x (x = 4). The final matrix form is called row echelon form and corresponds to the upper triangular form on the left. Gauss-Jordan elimination

Page 3: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear combination of the third row with the first two rows to eliminate the z

terms. We want the coefficient of z to be equal to 1 in the third row, so multiply

!

5

23R3.

!

x "3

2y + 2z = 7

y "8

5z = "

18

5

z = 6

!

1 "3

2 2 : 7

0 1 "8

5: "

18

5

0 0 1: 6

#

$

% % % % % %

&

'

( ( ( ( ( (

Now we want to add a linear combination of the third row and the first two rows

to eliminate the z terms. So we add,

!

"2R3

+ R1 and

!

8

5R3 + R2:

!

x "3

2y = "5

y = 6

z = 6

!

1 "3

2 0 : " 5

0 1 0 : 6

0 0 1: 6

#

$

% % % % %

&

'

( ( ( ( (

Lastly, we add a combination of the second row and the first row to eliminate the

y term, namely

!

3

2R2 + R1:

!

x = 4

y = 6

z = 6

!

1 0 0 : 4

0 1 0 : 6

0 0 1: 6

"

#

$ $ $

%

&

' ' '

This last matrix is called reduced row echelon form. matrix algebra Matrix algebra was developed to be consistent with the operations performed on systems of equations. Two matrices are equal provided they have the same size and corresponding

entries are equal. E.g.,

!

1 " 2 0

1 3 "1

#

$ %

&

' ( )

1 1

"2 3

0 "1

#

$

% % %

&

'

( ( ( .

To add (or subtract) two matrices, they must be of the same size and then you add

(or subtract) corresponding entries. Let

!

A = 2 3

"5 4

#

$ %

&

' ( and

!

B =1 "1

3 0

#

$ %

&

' ( , then

!

A " B = 1 4

"4 4

#

$ %

&

' ( . A zero matrix, e.g.,

!

0 0

0 0

"

# $

%

& ' , denoted by 0, is any matrix with all its

entries equal to zero. Zero matrices are additive identities, i.e.,

!

A + 0 = 0 + A = A and

!

A " A = 0.

Page 4: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

To multiply a matrix by a scalar, multiply each entry by that scalar. E.g., if

!

A = 2 3

"5 4

#

$ %

&

' ( and

!

B =1 "1

3 0

#

$ %

&

' ( , then

!

2A + B = 5 5

"7 8

#

$ %

&

' ( .

The product of two matrices A and B, if it exists, is the matrix AB satisfying: 1. The number of columns in A is the same as the number of rows in B 2. If A has a columns and B has b columns, then the size of AB is a X b 3. The entry in the ith row and the jth column of AB is the inner product of

the ith row of A with the jth column of B. The inner product is defined to be the number obtained by multiplying the corresponding entries and then adding the products.

E.g., the product

!

AB = 2 3

"1 4

#

$ %

&

' (

1 "1

3 0

#

$ %

&

' ( =

2 )1+ 3 ) 3 2 ) "1+ 3 ) 0

"1)1+ 4 ) 3 "1) "1+ 4 ) 0

#

$ %

&

' ( =

11 " 2

11 1

#

$ %

&

' ( . The

product

!

BA =1 "1

3 0

#

$ %

&

' (

2 3

"1 4

#

$ %

&

' ( =

3 "1

6 9

#

$ %

&

' ( . Notice that in general

!

AB " BA .

Often is not possible to multiply two matrices together because of their sizes.

E.g., let

!

A = 2 3

"5 4

#

$ %

&

' ( and

!

B =1 2 0

3 0 1

"

# $

%

& ' . Then the product AB is exists, but BA does not!

Matrices of the form

!

1 0

0 1

"

# $

%

& ' where the main diagonal entries are all 1 and all other

entries are 0 are multiplicative identities, i.e.,

!

2 3

"5 4

#

$ %

&

' (

1 0

0 1

#

$ %

&

' ( =

2 3

"5 4

#

$ %

&

' ( .

What is the product

!

2 " 3 4

3 " 2 2

4 5 " 5

#

$

% % %

&

'

( ( (

x

y

z

#

$

% % %

&

'

( ( ( ?

!

2x " 3y + 4z

3x " 2y + 2z

4x + 5y " 5z

#

$

% % %

&

'

( ( (

Inverse matrices inverse matrix We define a multiplicative identity for square matrices as a matrix of the form

!

I2 =1 0

0 1

"

# $

%

& ' , i.e.,

!

a b

c d

"

# $

%

& '

1 0

0 1

"

# $

%

& ' =

1 0

0 1

"

# $

%

& ' a b

c d

"

# $

%

& ' =

a b

c d

"

# $

%

& ' .

In the real numbers, multiplicative inverses are two real numbers a and b such that ab = 1. The same terminology applies to matrices, i.e., if A and B are n X n matrices such that AB =

!

In and BA =

!

In , then A and B are said to be inverses of each other. An inverse matrix of A is denoted by

!

A"1.

Show that the inverse of

!

A =1 2

3 4

"

# $

%

& ' is

!

A"1

=

"2 1

3

2 "

1

2

#

$

% %

&

'

( ( .

Page 5: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

We must show that

!

AA"1

=1 2

3 4

#

$ %

&

' (

"2 1

3

2 "

1

2

#

$

% %

&

'

( (

=1 0

0 1

#

$ %

&

' ( . And, we must show that

!

A"1A =

"2 1

3

2 "

1

2

#

$

% %

&

'

( (

1 2

3 4

#

$ %

&

' ( =

1 0

0 1

#

$ %

&

' ( .

finding inverse matrices Not all matrices have inverses. First, a matrix must be square in order to have an inverse. But even many square matrices do not have inverses. We will study two ways of finding inverse matrices of square matrices, if they exist. Our first method solves a system of equations to find the inverse matrix of

!

A =1 2

3 4

"

# $

%

& ' . We need to find numbers a, b, c, and d in an inverse matrix

!

A"1

=a b

c d

#

$ %

&

' (

such that the following two matrix equations are true:

!

1 2

3 4

"

# $

%

& ' a b

c d

"

# $

%

& ' =

1 0

0 1

"

# $

%

& ' and

!

a b

c d

"

# $

%

& '

1 2

3 4

"

# $

%

& ' =

1 0

0 1

"

# $

%

& '

The first matrix equation is equivalent to:

!

a + 2c b + 2d

3a + 4c 3b + 4d

"

# $

%

& ' =

1 0

0 1

"

# $

%

& ' . If these

matrices are equal, then their entries are equal.

!

a + 2c =1 b + 2d = 0

3a + 4c = 0 3b + 4d =1

This is equivalent to two 2 x 2 systems of linear equations. Solving for a, we have a = -2. Solving for c, we have c = 3/2. Solving for b and d, we have b = 1 and

d = -1/2. Therefore,

!

A"1

="2 1

3 2 "1 2

#

$ %

&

' ( .

If we had solved the second matrix equation, we would have the following systems of linear equations:

!

a + 3b =1 2a + 4b = 0

c + 3d = 0 2c + 4d =1

You can verify that the solutions to this system of equations are the same. Our first method of finding inverse matrices solved systems of equations. Since we know that not all systems of equations have solutions, we may guess that not all

matrices have inverses. And we'd be right! E.g., the matrix

!

A =1 2

2 4

"

# $

%

& ' does not have an

inverse matrix, because the first resulting system of equations (

!

a + 2b =1 and

!

2a + 4b = 0) does not have a solution. SHOW. We call matrices that have inverses singular and matrices that do not have inverses non-singular. Singular matrices must be square, i.e., they must have the same number of rows and columns. Our second method of finding inverse matrices uses elementary row operations (Gauss-Jordan method) on a specially-augmented matrix. We augment our initial matrix

Page 6: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

!

A =1 2

3 4

"

# $

%

& ' by writing

!

I2 next to A:

!

A =1 2 :1 0

3 4 : 0 1

"

# $

%

& ' . Our goal now is to change the matrix

A on the left into

!

I2 and the resulting matrix on the right will be

!

A"1.

!

1 2 :1 0

3 4 : 0 1

"

# $

%

& '

(3R1+R2) * ) ) ) 1 2 : 1 0

0 ( 2 :(3 1

"

# $

%

& '

(1

2R2

) * ) ) 1 2 : 1 0

0 1: 3 2 (1 2

"

# $

%

& '

(2R2+R1) * ) ) )

!

1 0 : " 2 1

0 1: 3 2 "1 2

#

$ %

&

' ( . Therefore,

!

A"1

="2 1

3 2 "1 2

#

$ %

&

' ( .

using inverse matrices to solve systems of linear equations

Let's now solve the following system of equations using

!

A"1:

!

x + 2y = 8

3x + 4y = 6.

If

!

A =1 2

3 4

"

# $

%

& ' ,

!

X =x

y

"

# $ %

& ' , and

!

B =8

6

"

# $ %

& ' , then we can represent our system of equations

by the matrix equation

!

AX = B . If we multiply both sides of the equation by

!

A"1, i.e.,

!

A"1AX = A

"1B , we have

!

(A"1A)X = I2X = X = A

"1B . Therefore, the matrix

!

A"1B should

give us our solutions for x and y.

!

A"1B =

"2 1

3 2 "1 2

#

$ %

&

' (

8

6

#

$ % &

' ( =

"16 + 6

12 " 3

#

$ %

&

' ( =

"10

9

#

$ %

&

' ( . Therefore, x = -10 and y = 9. Let's

check our answer in the original system of equations.

!

"10 + 2(9) = 8

3("10) + 4(9) = 6

In general, we can show for any

!

A =a b

c d

"

# $

%

& ' that

!

A"1

=1

ad " bc

d " b

"c a

#

$ %

&

' ( . Find

!

A"1 if

!

A ="1 2

4 " 9

#

$ %

&

' ( .

!

A"1

=1

9 " 8

"9 " 2

"4 "1

#

$ %

&

' ( =

"9 " 2

"4 "1

#

$ %

&

' ( . Verify

!

"9 " 2

"4 "1

#

$ %

&

' ( "1 2

4 " 9

#

$ %

&

' ( =

1 0

0 1

#

$ %

&

' ( .

Solve the system

!

2x " 3y + 4z =14

3x " 2y + 2z =12

4x + 5y " 5z =16

using inverse matrices.

First, we write the systems of equations as the matrix equation

!

AX = B , where

!

A =

2 " 3 4

3 " 2 2

4 5 " 5

#

$

% % %

&

'

( ( ( ,

!

X =

x

y

z

"

#

$ $ $

%

&

' ' ' , and

!

B =

14

12

16

"

#

$ $ $

%

&

' ' ' . To find X, we must find

!

A"1B , where

!

A"1 is the

inverse matrix of A. We can find

!

A"1 manually as we did earlier, or we can use

technology (e.g., a graphing calculator) to find

!

A"1

=

0 5 /23 2 /23

1 " 26 /23 8 /23

1 " 22 /23 5 /23

#

$

% % %

&

'

( ( ( . We can

multiply

!

A"1B =

0 5 /23 2 /23

1 " 26 /23 8 /23

1 " 22 /23 5 /23

#

$

% % %

&

'

( ( (

14

12

16

#

$

% % %

&

'

( ( (

=

4

6

6

#

$

% % %

&

'

( ( ( . Therefore, x = 4, y = 6, and z = 6.

Page 7: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

Determinants and Cramer's Rule define determinant of a square matrix As we have seen, inverses of some square matrices may be used to solve systems of linear equations. Can we determine a priori which square matrices have inverses? We can define a number, called the determinant, for any square matrix. We can think of the determinant as a function of a square matrix returning a unique number as the output. If the determinant is equal to 0, then the square matrix does not have an inverse, i.e., it is singular. If the determinant is equal to any number but 0, then the square matrix does have an inverse and it is non-singular. We denote the determinant of a square matrix A using the notations

!

det A or A . determinant formula for 2 x 2 matrices

The formula for the determinant of a 2 x 2 matrix

!

a b

c d

"

# $

%

& ' is defined as

!

a b

c d= ad " bc . We see that the formula subtracts the product of the minor diagonal from

the product of the major diagonal.

Compute

!

"1 5

"2 3.

!

"1 5

"2 3= "1# 3( ) " "2 # 5( ) = "3" "10( ) = 7.

determinant formula for 3 x 3 matrices and larger Computing determinants for larger square matrices becomes more cumbersome.

For example, the determinant of a 3 x 3 matrix

!

a1 a

2 a

3

a4

a5

a6

a7

a8

a9

"

#

$ $ $

%

&

' ' ' is defined as

!

a1

a2

a3

a4

a5

a6

a7

a8

a9

= a1

a5

a6

a8

a9

" a2

a4

a6

a7

a9

+ a3

a4

a5

a7

a8

. This sum of products of entries and

determinants of smaller (2 x 2) matrices is called the minor and co-factor expansion of the determinant along the first row. The minor of an entry is formed by eliminating all entries in the same row and column. Each minor is then multiplied by its co-factor which may be found by alternating signs among the entries.

Compute

!

1 2 "1

2 "1 1

4 0 2

.

!

1 2 "1

2 "1 1

4 0 2

=1"1 1

0 2" 2

2 1

4 2+ "1( )

2 "1

4 0 =

!

1 "2 " 0( ) " 2 4 " 4( ) "1 0 " "4( )( ) =1 "2( ) " 2 0( ) "1 4( ) = "2 " 0 " 4 = "6 . We can choose any column or row to expand. Sometimes it is helpful to choose a

row or column with a zero, e.g., row 3.

!

1 2 "1

2 "1 1

4 0 2

=

!

42 "1

"1 1+ 2

1 2

2 "1 =

!

4 2 "1( ) + 2 "1" 4( ) = 4 1( ) + 2 "5( ) = 4 "10 = "6. rules for manipulating determinants

Page 8: Matrices - UCSD Mathematics | Homemath.ucsd.edu/~barnold/math4c/4C Lessons/Additional...Gauss-Jordan elimination is a continuation of Gaussian elimination. Our goal is to add a linear

There are three rules for manipulating determinants that make computations easier. These rules are listed on p. 642.

Compute

!

5 10 15

1 2 3

"9 11 7

. We can factor a 5 out of the first row (Rule 1) to obtain

!

5 10 15

1 2 3

"9 11 7

=

!

5

1 2 3

1 2 3

"9 11 7

. We can subtract the second row from the first (Rule 2) to

obtain

!

5

1 2 3

1 2 3

"9 11 7

=

!

5

1 2 3

0 0 0

"9 11 7

. What would happen if we expanded on the second

row? The determinant would be equal to 0. Cramer's rule for solving a system of linear equations Cramer's rule allows us to solve some systems of linear equations using determinants. See Cramer's Rule on p. 645 and its proof on p. 646.

Use Cramer's Rule to solve the system of equations

!

3x + 4y " z = 5

x " 3y + 2z = 2

5x " 6z = "7

. First, we

write

!

D =

3 4 "1

1 " 3 2

5 0 " 6

, Dx =

5 4 "1

2 " 3 2

"7 0 " 6

, Dy =

3 5 "1

1 2 2

5 " 7 " 6

, Dz =

3 4 5

1 " 3 2

5 0 " 7

. Then, we

compute the values of each determinant:

!

D =103, Dx =103, Dy =103, Dz = 206 . Lastly,

we solve for x, y, and z:

!

x =Dx

D=103

103=1,

!

y =103

103=1, and

!

z =206

103= 2 . Therefore, the

solution is

!

1,1,2( ). Verify that

!

1,1,2( ) is a solution.