Lab for the Gauss-Jordan Method

Module for the Gauss-Jordan Method

   Check out the new Numerical Analysis Projects page.

Gauss-Jordan Method for Linear Systems. Construct the solution to AX = B, by using Gaussian elimination. Let the coefficients of A and the constants of B be stored in the augmented matrix
[A, B] = ([Graphics:gj.txtgr1.gif]) which has n rows and n+1 columns; that is, the column vector B = ([Graphics:gj.txtgr2.gif]) is
stored in column n+1 of the augmented matrix [A, B]. The system can be written
[Graphics:gj.txtgr3.gif]
Row operations will be used to eliminate [Graphics:gj.txtgr4.gif] in column p.
Remark. In the following subroutine the notation i=!=p means "i not equal to j".

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr5.gif]
 
 

Report to be handed in.

Computer Problems.



Exercise 1. Use above Gaussian elimination method to solve the linear system AX = B:

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr7.gif]

First form the augmented matrix M = [A,B]

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr8.gif]

Then perform Gaussian elimination.
Remark. All the computations are printed too !

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr9.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr10.gif]

Verify the solution.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr11.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr12.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr13.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr14.gif]


Exercise 2. Form the augmented matrix M using the following steps.
Go the Input menu and pull down the Create/Table/Matrix/Palette and form a 4 by 5 matrix.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr15.gif]

Then store A in the first four columns of M.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr16.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr17.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr18.gif]

Then store B in the fifth column of M.
You will need to Flatten B when you do this !

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr19.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr20.gif]

Then perform Gaussian elimination as you did before, showing all the intermediate computations.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr21.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr22.gif]

This time get the solution vector X out of this augmented matrix !

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr23.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr24.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr25.gif]

What did you just learn about the data structure of a row vector vs the data structure of a column vector ?


Now use the subroutine Gauss for finding the inverse of a matrix.


Exercise 3. Use above Gaussian elimination method to find the inverse of the matrix A.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr26.gif]


Form the augmented matrix M = [A, I] using the following steps.
Remark. Don't use I as a variable, it is a reserved word which is the complex constant [Graphics:gj.txtgr27.gif] .
Go the Input menu and pull down the Create/Table/Matrix/Palette and form a 4 by 8 matrix.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr28.gif]

Go the Input menu and pull down the Create/Table/Matrix/Palette and create a 4 by 4 identity matrix.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr29.gif]

Then store A in the first four columns of M.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr30.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr31.gif]

Then store Iden in the last four columns of M.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr32.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr33.gif]

Then perform Gaussian elimination.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr34.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr35.gif]

Get the inverse of A out of this augmented matrix ! And store it in the matrix B.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr36.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr37.gif]

Verify that B is the inverse of A.

[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr38.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr39.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr40.gif]
[Graphics:gj.txtgr6.gif][Graphics:gj.txtgr41.gif]
 

 

 

(c) John H. Mathews, 1998