Part 3 Chapter 11 Matrix Inverse and Condition Part A All images copyright © The McGraw-Hill...

36
Part 3 Chapter 11 Matrix Inverse and Condition Part A All images copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Transcript of Part 3 Chapter 11 Matrix Inverse and Condition Part A All images copyright © The McGraw-Hill...

Part 3Chapter 11

Matrix Inverse and Condition

Part A

All images copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter Objectives

• Know how to determine the matrix inverse in an efficient manner based on LU factorization.

• Understand how the matrix inverse can be used to assess stimulus-response characteristics of engineering systems.

• Understand the meaning of matrix and vector norms and how they are computed.

• Know how to use norms to compute the matrix condition number.

• Understand how the magnitude of the condition number can be used to estimate the precision of solutions of linear algebraic equations.

Matrix Inverse

• If a matrix [A] is square, there is another matrix [A]-1, called the inverse of [A], for which [A][A]-1=[A]-1[A]=[1]

• The inverse can be computed in a column by column fashion by generating solutions with unit vectors as the right-hand-side constants:

A x1 100

A x2

010

A x3

001

A 1 x1 x2 x3 Column vector

Matrix Inverse (cont)

• Recall that LU factorization can be used to efficiently evaluate a system for multiple right-hand-side vectors - thus, it is ideal for evaluating the multiple unit vectors needed to compute the inverse.

Do this once

Do this three times – once for each column

Example 11.1

• Employ LU factorization to determine the matrix inverse for the following system

3 0.1 0.2

0.1 7 0.3

0.3 0.2 10

A

*L d unit

*U x d

In this case x is a column in the inverse

Let’s run this code and watch what happens

Or…

Ainv = inv(A)

The corresponding MATLAB code is:

Stimulus-Response Computations

• Many systems can be modeled as a linear combination of equations, and thus written as a matrix equation:

• The system response can thus be found using the matrix inverse.

Interactions response stimuli

Interactions response stimuli

A x B

1x A B

1 1 11 11 1 12 2 13 3x a b a b a b

1 1 12 21 1 22 2 23 3x a b a b a b

1 1 13 31 1 32 2 33 3x a b a b a b

Each of the elements represents the response of a single part of the system to a unit stimulus of any other part of the system

Each of these is a dot product

1 1 111 12 13 1

1 1 121 22 23 2

1 1 131 32 33 3

*

a a a b

a a a b

a a a b

Example 11.2

• Let’s return to the connected bungee jumpers from chapter 8

11

Suppose there are three jumpers connected by bungee cords, so that each cord is fully extended, but unstretched.

After they are released, gravity takes hold and the jumpers will eventually come to equilibrium

You are asked to compute the displacement of each of the jumpers.

•Gravity causes the stimulus•The displacement is the response

Free body diagrams

12

Assume that each cord behaves like a linear spring, and follows Hooke’s Law

Force Balance

13

21

1 1 2 2 1 1 12

22

2 2 3 3 2 2 1 22

23

3 3 3 2 32

( )

( )

( )

d xm m g k x x k xdt

d xm m g k x x k x x

dt

d xm m g k x xdt

21

1 1 2 2 1 1 12

22

2 2 3 3 2 2 1 22

23

3 3 3 2 32

( ) 0

( ) 0

( ) 0

d xm m g k x x k xdt

d xm m g k x x k x x

dt

d xm m g k x xdt

Since the jumpers are at equilibrium the acceleration is equal to 0

Substituting in the constants we can pose the problem as a system of linear equations

1

2

3

150 100 0 588.6

100 150 50 686.7

0 50 50 784.8

x

x

x

Interactions response stimuli

Force in Newtons (m*g)

Effective Spring Constants

Change in Position

Each element represents the vertical change in position of jumper i, due to a unit change in force applied to jumper j

The position of all three jumpers would change by 0.02 m if the force on jumper 1 was increased by 1 Newton

The position of the first jumper would change by 0.02 m if the force on jumper 2 was increased by 1 Newton – but jumper 2 and 3 would change by 0.03 m

The position of the first jumper would change by 0.02 m if the force on jumper 3 was increased by 1 Newton – jumper 2 would change by 0.03 m and jumper 3 would change by 0.05 m

1 1 13 31 1 32 2 33 3x k F k F k F

So why is this useful?

By looking at the matrix inverse I can see where applying a stimulus will have the most (or least) affect.

Next time…

• Matrix norm and condition calculations

Error Analysis and System Conditioning

• The inverse also provides a means to see whether systems are ill-conditioned. There are 3 direct methods1. Scale the matrix of coefficients so that the

largest element in each row is 1. Invert the scaled matrix and if there are elements of A-1 that are several orders of magnitude greater than 1 – it is likely that the matrix is ill-conditioned

Error Analysis and System Conditioning

• The inverse also provides a means to see whether systems are ill-conditioned. There are 3 direct methods2. Multiply the inverse by the original matrix, and

see if the result is the identity matrix. If not it is ill-conditioned

Error Analysis and System Conditioning

• The inverse also provides a means to see whether systems are ill-conditioned. There are 3 direct methods3. Invert the inverted matrix and check to see if

the result is equivalent to the original matrix. If not, the system is ill-conditioned

These techniques work, but it would be nice to quantify the problem with a single number

In addition, recall that if the determinant is close to 0, the matrix is ill-conditioned

Vector and Matrix Norms

• A norm is a real-valued function that provides a measure of the size or “length” of multi-component mathematical entities such as vectors and matrices.

• Vector norms and matrix norms may be computed differently.

Vector Norms

• For a vector {X} of size n, the p-norm is:

• Important examples of vector p-norms include:

p1:sum of the absolute values X1 xii1

n

p2 :Euclidian norm (length) X2 X

e xi

2

i1

n

p :maximum magnitude X

1inmax xi

Xp x i

p

i1

n

1/ p

Matrix Norms

• Common matrix norms for a matrix [A] include:

• Note - max is the largest eigenvalue of [A]T[A].

column - sum norm A1

1jnmax aij

i1

n

Frobenius norm Af aij

2

j1

n

i1

n

row - sum norm A

1inmax aij

j1

n

spectral norm (2 norm) A

2 max 1/2

Matrix Condition Number

• The matrix condition number Cond[A] is obtained by calculating Cond[A]=||A||·||A-1||

• In can be shown that:

• The relative error of the norm of the computed solution can be as large as the relative error of the norm of the coefficients of [A] multiplied by the condition number.

• If the coefficients of [A] are known to t digit precision, the solution [X] may be valid to onlyt-log10(Cond[A]) digits.

XX

Cond A AA

MATLAB Commands

• MATLAB has built-in functions to compute both norms and condition numbers:– norm(X,p)

• Compute the p norm of vector X, where p can be any number, inf, or ‘fro’ (for the Euclidean norm)

– norm(A,p)• Compute a norm of matrix A, where p can be 1, 2, inf, or ‘fro’

(for the Frobenius norm)

– cond(X,p) or cond(A,p)• Calculate the condition number of vector X or matrix A using the

norm specified by p.

Example 11.3

• The Hilbert matrix is ‘notoriously’ ill-conditioned.

• Use condition number to help you understand the effect of ill-conditioning on results.

Hilbert Matrix

Determinant

A*A-1

Inv(A)*A

Now try the condition number

The long way

Using the cond function

Condition of the unscaled matrixSig fig reduction