Solutions of Linear Systems - Gauss Jordan Method

Linear Algebra Project                                            

 

Objectives:

  To investigate solutions of systems of linear equations by

 (a) Matrix Method

 (b) Step-by-step Gauss-Jordan Elimination

 (c)  Gauss-Jordan Elimination in one-step

   These steps will be carried out using Maple commands.

  (d)  To discuss the solution set of a system by graphing whenever possible.

 

Solved Example 1:

   Solve:   4x + 3y = 2

                7x + 5y = 3

 

Solution:

  (a) Matrix Method

First activate the linalg  and plot  packages of Maple.

>    with(linalg): with(plots):

Warning, new definition for norm

Warning, new definition for trace

Matrix Method:  Define the coefficient matrix:  A:= matrix(2,2,[4,3,7,5]).  

                               Define the constant matrix (or vector):   c:= vector([2, 3]);

>    A:= matrix(2,2,[4,3,7,5]);

A := matrix([[4, 3], [7, 5]])

>    c:= vector([2,3]);

c := vector([2, 3])

Use the command "linsolve" to solve the system.

>    linsolve(A,c);

vector([-1, 2])

  (b) Gaussian Elimination - Step by Step:

  First define the augmented matrix.  

>    Ac:= augment(A,c);

Ac := matrix([[4, 3, 2], [7, 5, 3]])

Now we use the three elementary row operations to get an echelon

>    A1:= mulrow(Ac, 1, 1/4);

A1 := matrix([[1, 3/4, 1/2], [7, 5, 3]])

>    A2:= addrow(A1,1,2,-7);

A2 := matrix([[1, 3/4, 1/2], [0, -1/4, -1/2]])

>    A3:= addrow(A2,2,1,3);

A3 := matrix([[1, 0, -1], [0, -1/4, -1/2]])

>    A4:=mulrow(A3,2,-4);

A4 := matrix([[1, 0, -1], [0, 1, 2]])

The solution is x = -1, y = 2.

 (c) Gaussian Elimination - in one step.

>    Acr:=rref(Ac);

Acr := matrix([[1, 0, -1], [0, 1, 2]])

This operation reduces the matrix to r ow r educed e chelon f orm (rref) and basically solves the problem.

rref is also called "reduced normal form."

  (d) Graph of the system

We use the command "implicitplot".

>    implicitplot({4*x + 3*y = 2,7*x + 5*y = 3}, x =-1.5..-.5, y = 1..3);

                

[Maple Plot]

Solved  Example 2:

Solve the linear system

x + 2y + 3z = 0

x+ 3y + 8z = 2

x + 2y + 2z  = 0

by Gauss-Jordan method.

Solution:

First define the augmented matrix then use RREF command.

>    A:= matrix(3,3,[1,2,3,1,3,8,1,2,2]);

A := matrix([[1, 2, 3], [1, 3, 8], [1, 2, 2]])

 

>    d:= vector([0, 2, 0]);

d := vector([0, 2, 0])

>    Ad:= augment(A,d);

Ad := matrix([[1, 2, 3, 0], [1, 3, 8, 2], [1, 2, 2, 0]])

>    Adr:= rref(Ad);

Adr := matrix([[1, 0, 0, -4], [0, 1, 0, 2], [0, 0, 1, 0]])

Solution: x = -4, y = 2, z = 0.

Graph of the system

Geometrically, each linear equation in three variables is a plane.  To find the solution of the system is to find the point where the three planes intersect each other.

We use the "implicitplot3d" command to graph an equation in three variables.   

>    implicitplot3d({x + 2*y + 3*z = 0,x+ 3*y + 8*z = 2,x + 2*y + 2*z  = 0},x=-5..-3,y=1..3, z= -1..1, title=`Graph of the System`);

[Maple Plot]

We can get some idea about the location where the three planes meet by rotating the box  with y-axis backward and forward, x-axis left and right, z-axis up and down, and noting that the planes intersect on the lines through x = -4, y = 2 and z = 0.

 We zoom repeatedly to get the exact solution.  We can find the exact location by rotating the axes.

>    implicitplot3d({x + 2*y + 3*z = 0,x+ 3*y + 8*z = 2,x + 2*y + 2*z  = 0},x=-4.0001..-3.9999 ,y=1.9999..2.0001, z= -0.0001..0.0001, title=`Graph of the System`);

[Maple Plot]

Solved Example 3:

Find all solutions of the homogeneous system of equations:

x1 + 2x2       + 2x4 + 3x5 = 0

               x3  + 3x4 + 2x5 = 0

               x3  + 4x4 -   x5 = 0

                                   x5 = 0

Solution:

The number of variables is more than the number of equations.  This has infinitely many solutions.

>    A:= matrix(4, 5,[1,2,0,2,3,0,0,1,3,2,0,0,1,4,-1,0,0,0,0,1]);

A := matrix([[1, 2, 0, 2, 3], [0, 0, 1, 3, 2], [0, 0, 1, 4, -1], [0, 0, 0, 0, 1]])

>    c:= vector([0,0,0,0]);

c := vector([0, 0, 0, 0])

>    Ac := augment(A,c);

Ac := matrix([[1, 2, 0, 2, 3, 0], [0, 0, 1, 3, 2, 0], [0, 0, 1, 4, -1, 0], [0, 0, 0, 0, 1, 0]])

>    Acr:= rref(Ac);

Acr := matrix([[1, 2, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0]])

x1 + 2x2 = 0 or x1 = -2x2

x3 = 0

x4 = 0

x5 = 0

Solution:   We choose x2 = lambda ( lambda ), the greek letter, as a variable.  Then the solution is

                     (-2 lambda, lambda , 0, 0, 0)

Since lambda  can have any value the solutions are infinite.

_____________________________________________________________________

ASSIGNMENT

In Problems  1 and 2 solve the system using

 (a) 'linsolve' command.

 (b)  Step-by-step Gauss-Jordan Elimination.

 (c)  Gauss-Jordan Elimination in one-step.

 (d)  Graphing .

  Problem 1:

                  -4x + 3y = -15

                   3x + 5y = 33

 Problem 2:

            2x  +         z = 1

            -x  +   y  - 3z = 4

            2x  +  y -    4 z = 0

Solve Problems 3 and 4 by one-step elimination.  

 Problem 3:

      - 2b + 3c = 1

3a + 6b - 3c  = -2

6a + 6b + 3c = 5

  Problem 4:

 2w -  3x + 4y - z  = 0

 7w +  x  - 8y + 9z = 0

 2w + 8x +  y - z = 0

________________

MSEIP Grant #P120AA010031:  "Four Colleges: Calculus + Enhancements", 2001-2004