To solve the matrix equation #Ax=b# we start by writing the augmented matrix #(A|b)# :
# ((1,-2,-1,2),(2,-1,1,4),(-1,1,-2,-4))#
usually we would put a vertical line to separate the fourth column (the column vector #b#) from the first three (which represent #A#, but couldn't figure out how to do it!
The aim in Gauss elimination is to carry out row operations on the augmented matrix until #A# is converted to reduced row-echelon form. To do this we first subtract twice the first row from the second (denote this by #R_2-2R_1# ) and #R_3+R_1#
# ((1,-2,-1,2),(0,3,3,0),(0,-1,-3,-2))#
Divide the second row by 3 #(R_2/3)# :
# ((1,-2,-1,2),(0,1,1,0),(0,-1,-3,-2))#
#R_3+R_2#
# ((1,-2,-1,2),(0,1,1,0),(0,0,-2,-2))#
#(R_3/{-2})#
# ((1,-2,-1,2),(0,1,1,0),(0,0,1,1))#
This completes the Gauss-elimination process. We can now carry out back-substitution to determine the required solution:
#z = 1#
#y+z=0 implies y = -1#
#x-2y-z = 2 implies x = 2y+z+2=2times (-1)+1+2 = 1#
So, the solution is #x = 1, y = -1, z=1#
To carry out Gauss Jordan elimination, the steps are the same until we reach
# ((1,-2,-1,2),(0,1,1,0),(0,-1,-3,-2))#
#R_1+2R_2 , R_3+R_2#
# ((1,0,1,2),(0,1,1,0),(0,0,-2,-2))#
#(R_3/{-2})#
# ((1,0,1,2),(0,1,1,0),(0,0,1,1))#
#R_1-R_3,R_2-R_3#
# ((1,0,0,1),(0,1,0,-1),(0,0,1,1))#
from this we can immediately read off #x = 1, y = -1, z=1#