Docsity

Gaussian Elimination: Solving Linear Systems and Finding Matrix Inverses - Prof. Shankar J, Slides of Linear Algebra

Toggle sidebar
bg1
Gaussian Elimination
Gaussian elimination for the solution of a linear system transforms the
system Sx =finto an equivalent system U x =cwith upper triangular
matrix U(that means all entries in Ubelow the diagonal are zero).
This transformation is done by applying three types of transformations to
the augmented matrix (S|f).
Type 1: Interchange two equations; and
Type 2: Replace an equation with the sum of the same equation and a
multiple of another equation.
Once the augmented matrix (U|f)is transformed into (U|c), where U
is an upper triangular matrix, we can solve this transformed system
Ux =cusing backsubstitution.
M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 1
Example 1
Suppose that we want to solve
2 4 −2
4 9 −3
−2−3 7
x1
x2
x3
=
2
8
10
.(1)
We apply Gaussian elimination. To keep track of the operations, we use,
e.g., R2=R2−2∗R1, which means that the new row 2 is computed by
subtracting 2 times row 1 from row 2.
2 4 −2 2
4 9 −3 8
−2−3 7 10
→
2 4 −2 2
0 1 1 4
0 1 5 12
R2=R2−2∗R1
R3=R3+R1
→
2 4 −2 2
0 1 1 4
0 0 4 8
R3=R3−R2
The original system (1) is equivalent to
2 4 −2
0 1 1
0 0 4
x1
x2
x3
=
2
4
8
.(2)
The system (2) can be solved by backsubstitution. We get the solution
x3= 8/4=2, x2= (4−1∗2)/1=2, x1= (2−4∗2−(−2)∗2)/2 = −1.
M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 2
Example 2
Suppose that we want to solve
2 3 −2
1−2 3
4−1 4
x1
x2
x3
=
f1
f2
f3
.(3)
We apply Gaussian elimination.
2 3 −2f1
1−2 3 f2
4−1 4 f3
→
2 3 −2f1
0−7/2 4 f2−f1/2
0−7 8 f3−2f1
R2=R2−0.5∗R1
R3=R3−2∗R1
→
2 3 −2f1
0−7/2 4 f2−f1/2
0 0 0 f3−2f2−f1
R3=R3−2R2
The original system (3) is equivalent to
2 3 −2
0−7/2 4
0 0 0
x1
x2
x3
=
f1
f2−f1/2
f3−2f2−f1
.(4)
The last equation in system (4) reads 0x1+ 0x2+ 0x3=f3−2f2−f1.
This can only be satisfied of the right hand side satisfies
f3−2f2−f1= 0, for example if f1=f2=f3= 1.
M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 3
Example 2 (cont.)
If f3−2f2−f1= 0, then x3can be chosen arbitrarily and x2, x1can be
determined by backsubstitution.
If f3−2f2−f1= 0, then
x3=any scalar, x2= (f2−f1/2−4x3)∗(−2/7), x1= (f1−3x2+2x3)/2.
For example if f1=f2=f3= 1, and if we choose x3= 0, then
x3= 0, x2=−1/7, x1= 5/7.
M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 4
pf2

Partial preview of the text

Download Gaussian Elimination: Solving Linear Systems and Finding Matrix Inverses - Prof. Shankar J and more Slides Linear Algebra in PDF only on Docsity!

Gaussian Elimination

Gaussian elimination for the solution of a linear system transforms the

system Sx = f into an equivalent system U x = c with upper triangular

matrix U (that means all entries in U below the diagonal are zero).

This transformation is done by applying three types of transformations to

the augmented matrix (S | f ).

Type 1: Interchange two equations; and

Type 2: Replace an equation with the sum of the same equation and a

multiple of another equation.

Once the augmented matrix (U | f ) is transformed into (U | c), where U

is an upper triangular matrix, we can solve this transformed system

U x = c using backsubstitution.

M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 1

Example 1

Suppose that we want to solve  

x 1 x 2 x 3

We apply Gaussian elimination. To keep track of the operations, we use, e.g., R 2 = R 2 − 2 ∗ R 1 , which means that the new row 2 is computed by subtracting 2 times row 1 from row 2.  

 R 2 = R 2 − 2 ∗ R 1

R 3 = R 3 + R 1

R 3 = R 3 − R 2

The original system (1) is equivalent to  

x 1 x 2 x 3

The system (2) can be solved by backsubstitution. We get the solution x 3 = 8/4 = 2, x 2 = (4− 1 ∗2)/1 = 2, x 1 = (2− 4 ∗ 2 −(−2)∗2)/2 = − 1. M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 2

Example 2

Suppose that we want to solve

x 1

x 2

x 3

f 1

f 2

f 3

We apply Gaussian elimination.

2 3 − 2 f 1

1 − 2 3 f 2

4 − 1 4 f 3

2 3 − 2 f 1

0 − 7 / 2 4 f 2 − f 1 / 2

0 − 7 8 f 3 − 2 f 1

 R 2 = R 2 − 0. 5 ∗ R 1

R 3 = R 3 − 2 ∗ R 1

2 3 − 2 f 1

0 − 7 / 2 4 f 2 − f 1 / 2

0 0 0 f 3 − 2 f 2 − f 1

R 3 = R 3 − 2 R 2

The original system (3) is equivalent to

x 1

x 2

x 3

f 1

f 2 − f 1 / 2

f 3 − 2 f 2 − f 1

The last equation in system (4) reads 0 x 1 + 0x 2 + 0x 3 = f 3 − 2 f 2 − f 1.

This can only be satisfied of the right hand side satisfies

f 3 − 2 f 2 − f 1 = 0, for example if f 1 = f 2 = f 3 = 1.

M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 3

Example 2 (cont.)

If f 3 − 2 f 2 − f 1 = 0, then x 3 can be chosen arbitrarily and x 2 , x 1 can be

determined by backsubstitution.

If f 3 − 2 f 2 − f 1 = 0, then

x 3 = any scalar, x 2 = (f 2 −f 1 / 2 − 4 x 3 )∗(− 2 /7), x 1 = (f 1 − 3 x 2 +2x 3 )/ 2.

For example if f 1 = f 2 = f 3 = 1, and if we choose x 3 = 0, then

x 3 = 0, x 2 = − 1 / 7 , x 1 = 5/ 7.

M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 4

The Matrix Inverse

A square matrix S ∈ Rn×n^ is invertible if there exists a matrix X ∈ Rn×n^ such that XS = I and SX = I. The matrix X is called the inverse of S and is denoted by S−^1. I (^) An invertible matrix is also called non-singular. A matrix is called non-invertible or singular if it is not invertible. I (^) A matrix S ∈ Rn×n^ cannot have two different inverses. In fact, if X, Y ∈ Rn×n^ are two matrices with XS = I and SY = I, then X = XI = X(SY ) = (XS)Y = IY = Y. I (^) The property SX = I (right inverse) is important for the existence of a solution. In fact, if there is a matrix X with SX = I, then x = Xf satisfies Sx = SXf = If = f , i.e., x = Xf is a solution to the linear system. I (^) The property XS = I (left inverse) is important for the uniqueness of the solution. In fact, if there is a matrix X with XS = I and if x and y satisfy Sx = f and Sy = f , then S(x − y) = Sx − Sy = f − f = 0 and x − y = X0 = 0. I (^) It can be shown that if the square matrix S has a left inverse XS = I, then X is also a right inverse, SX = I, and vice versa. I (^) If S is invertible, then for every f the linear system Sx = f has the unique solution x = S−^1 f. I (^) We will see later that if for every f the linear system Sx = f has a unique solution x, then S is invertible. M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 5

Computation of the Matrix Inverse

We want to find the inverse of S ∈ Rn×n, that is we want to find a

matrix X ∈ Rn×n^ such that SX = I.

I Let X:,j denote the jth column of X, i.e., X = (X:, 1 ,... , X:,n).

Consider the matrix-matrix product SX. The jth column of SX is

the matrix-vector product SX:,j , i.e., SX = (SX:, 1 ,... , SX:,n).

The jth column of the identity I is the jth unit vector

ej = (0,... , 0 , 1 , 0 ,... , 0)T^.

Hence SX = (SX:, 1 ,... , SX:,n) = (e 1 ,... , en) = I implies that we

can compute the columns X:, 1 ,... , X:,n of the inverse of S by

solving n systems of linear equations

SX:, 1 = e 1 ,

SX:,n = en.

Note that if for every f the linear system Sx = f has a unique

solution x, then there exists a unique X = (X:, 1 ,... , X:,n) with

SX = I.

M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 6

Example 3

Suppose that we want the inverse of

S =

 

2 4 − 2 4 9 − 3 − 2 − 3 7

  (^).

We can use Gaussian Elimination to solve the systems SX:, 1 = e 1 , SX:, 2 = e 2 , SX:, 3 = e 3 for the three columns of X = S−^1  

2 4 − 2 1 0 0 4 9 − 3 0 1 0 − 2 − 3 7 0 0 1

  (^) →

 

2 4 − 2 1 0 0 0 1 1 − 2 1 0 0 1 5 1 0 1

 

→

 

2 4 − 2 1 0 0 0 1 1 − 2 1 0 0 0 4 3 − 1 1

 

→

 

2 4 0 5 / 2 − 1 / 2 1 / 2 0 1 0 − 11 / 4 5 / 4 − 1 / 4 0 0 1 3 / 4 − 1 / 4 1 / 4

  (^) →

 

1 0 0 27 / 4 − 11 / 4 3 / 4 0 1 0 − 11 / 4 5 / 4 − 1 / 4 0 0 1 3 / 4 − 1 / 4 1 / 4

  (^).

S−^1 =^14

 

27 − 11 3 − 11 5 − 1 3 − 1 1

  (^).

M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 7

Example 4

Suppose that we want the inverse of

S =

We can use Gaussian Elimination to solve the systems

SX:, 1 = e 1 , SX:, 2 = e 2 , SX:, 3 = e 3 for the three columns of X = S−^1

None of the linear systems SX:, 1 = e 1 , SX:, 2 = e 2 , SX:, 3 = e 3 has a

solution. Therefore, S is not invertible.

M. Heinkenschloss - CAAM335 Matrix Analysis Gaussian Elimination and Matrix Inverse (updated September 3, 2010) – 8