Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections...

Preview:

Citation preview

Lecture 9:Introduction to Matrix InversionGaussian EliminationSections 2.4, 2.5, 2.6

Sections 2.2.3, 2.3

Matrix Inverse and Transpose

• The inverse of a square matrix A, denoted by A-1, is a square matrix with the property

A-1A = AA-1 = I,where I is an identity matrix of the same size.

• Useful properties of the inverse of a nonsingular matrix A: ▫ (A−1)−1 = A ▫ AA−1 = A−1A = I

▫ AT is also nonsingular, and (AT )−1 =(A−1)T

▫ This follows easily by taking the transpose of both sides of AA−1 = I.

▫ If B is also nonsingular, then so is the product AB, and

(AB)−1 = B−1A−1

Example

Verify that is the inverse of 4 111 11

3 211 11

2 1.

3 4

4 1 2 1 1 011 113 3 4 0 1211 11

4 12 1 1 011 1133 4 0 1211 11

checks

checks

Linear Systems

• Given the output of a linear system for which the coefficient matrix A is known, is it possible to determine its input? This would involve solving the equation

Ax = b • Matrices provide a concise notation for

representing and solving simultaneous linear equations, for example:

[A]{x} {b}

a11x1 a12x2 a13x3 b1

a21x1 a22x2 a23x3 b2

a31x1 a32x2 a33x3 b3

a11 a12 a13

a21 a22 a23

a31 a32 a33

x1

x2

x3

b1

b2

b3

Example Solving a Matrix Equation

Use a matrix equation to solve 2 4 2

3 7 7.

x y

x y

The matrix form of the equation is

2 4 2.

3 7 7

x

y

1 7 22 4 2 2 723 7 7 3 7 412

x

y

If the matrix A has an inverse, then the solution of the matrix equation

AX = B is given by X = A-1B.

Gaussian Elimination

• A sequential process of removing unknowns from equations using forward elimination followed by back substitution is known as Gaussian elimination.

Gaussian Elimination

• Forward elimination▫ Starting with the first row, add or subtract multiples of

that row to eliminate the first coefficient from the second row and beyond.

▫ Continue this process with the second row to remove the second coefficient from the third row and beyond.

▫ Stop when an upper triangular matrix remains.

• Backward substitution▫ Starting with the last row, solve for the unknown, then

substitute that value into the next highest row.▫ Because of the upper-triangular nature of the matrix,

each row will contain only one more unknown.

Pivoting

• Problems arise with naïve Gauss elimination if a coefficient along the diagonal is 0 (problem: division by 0) or close to 0 (problem: round-off error)

• One way to combat these issues is to determine the coefficient with the largest absolute value in the column below the pivot element. The rows can then be switched so that the largest element is the pivot element. This is called partial pivoting.

• If the rows to the right of the pivot element are also checked and columns switched, this is called complete pivoting.

Example

• Using the Gaussian Elimination method, solve:

Gaussian Jordan Method

• Involves complete pivoting so that the coefficient matrix becomes diagonal

• Eliminates the need for substitution

• Also used in finding inverses

Gaussian Jordan Method

• Steps

1. Write down the matrix corresponding to the linear system.

2. Make sure that the first entry in the first column is nonzero. Do this by interchanging the first row with one of the rows below it, if necessary.

3. Pivot the matrix about the first entry in the first column. Pivoting in this case also involves normalizing the

diagonal entry4. Make sure that the second entry in the second column

is nonzero. Do this by interchanging the second row with one of the rows below it, if necessary.

5. Pivot the matrix about the second entry in the second column.

6. Continue in this manner until you have the identity matrix on the left hand side

Example: System of Equations

• Using the Gauss-Jordan method, solve the following system of equations

▫ Using Matlab colon operations▫ Check with Matlab’s back slash operation

9321

124

2132

zyx

zyx

zyx

Infinitely Many Solutions

• When a linear system cannot be completely diagonalized,

▫ Apply the Gaussian elimination method to as many columns as possible. Proceed from left to right, but do not disturb columns that have already been put into proper form.

▫ Variables corresponding to columns not in proper form can assume any value.

▫ The other variables can be expressed in terms of the variables of step 2.

▫ 4. This will give the general form of the solution.

Example: Infinitely Many Solutions

Find all solutions of 2 2 4 8

2 2

5 2 2.

x y z

x y z

x y z

General Solution

z = any real number

x = 3 - 2z

y = 1

1 [1]2[2] ( 1)[1][3] 1 [1]

2 2 4 8 1 1 2 4

1 1 2 2 0 2 0 2

1 5 2 2 0 6 0 6

1 [2]2[1] ( 1)[2][3] 6 [2]

1 0 2 3

0 1 0 1

0 0 0 0

Inconsistent System

When using the Gaussian elimination method:

if a row of zeros occurs to the left of the vertical line and a nonzero number is to the right of the vertical line in the same row, then the

system has no solution and is said to be inconsistent.

Singular/Nonsingular Matrix

•A square matrix A is nonsingular if and only if the equation Ax = b has a unique solution for every vector b.

•It is singular otherwise.

Example: Inconsistent System

Find all solutions of 3

5

2 4 4 1.

x y z

x y z

x y z

Because of the last row, the system is inconsistent.

[2] ( 1)[1][3] 2 [1]

1 1 1 3 1 1 1 3

1 1 1 5 0 2 2 2

2 4 4 1 0 2 2 7

1 [2]2[1] (1)[2]

[3] 2 [2]

1 0 0 4

0 1 1 1

0 0 0 5

Gauss-Jordan Method for Inverses

• Step 1: Write down the matrix A, and on its right write an identity matrix of the same size.

• Step 2: Perform elementary row operations on the left-hand matrix so as to transform it into an identity matrix. These same operations are performed on the right-hand matrix.

• Step 3: When the matrix on the left becomes an identity matrix, the matrix on the right is the desired inverse.

Example: Inverses

Find the inverse of4 2 3

8 3 5 .

7 2 4

A

Step 1:

31 11 0 02 4 40 1 1 2 1 0

3 5 70 0 12 4 4

Step 2:

4 2 3 1 0 0

8 3 5 0 1 0

7 2 4 0 0 1

31 11 0 04 4 20 1 1 2 1 0

1 5 30 0 14 4 2

Example: Inverses (cont’d)

1 0 0 2 2 1

0 1 0 3 5 4

0 0 1 5 6 4

1

2 2 1

3 5 4

5 6 4

A

Step 3:

Recommended