UPDATE: compare the following output to the output generated by my more evolved and more "elegant" elegant approach, namely
gauss++.
____________________________________________________________
mwh@coyote2:[~]:
---> rref
Enter the number of rows in the matrix: 3
Enter the number of columns in the matrix: 4
Enter row 1, column 1 : 4
Enter row 1, column 2 : 3
Enter row 1, column 3 : 1
Enter row 1, column 4 : 2
Enter row 2, column 1 : 2
Enter row 2, column 2 : -1
Enter row 2, column 3 : 2
Enter row 2, column 4 : 3
Enter row 3, column 1 : 4
Enter row 3, column 2 : 2
Enter row 3, column 3 : -1
Enter row 3, column 4 : -5
Original Matrix:
_________________________________________________________
4 3 1 2
2 -1 2 3
4 2 -1 -5
_________________________________________________________
Dividing row 1 by 4
_________________________________________________________
1 3/4 1/4 1/2
2 -1 2 3
4 2 -1 -5
_________________________________________________________
Multiplying row 1 by -2 and adding result to row 2
_________________________________________________________
1 3/4 1/4 1/2
0 -5/2 3/2 2
4 2 -1 -5
_________________________________________________________
Multiplying row 1 by -4 and adding result to row 3
_________________________________________________________
1 3/4 1/4 1/2
0 -5/2 3/2 2
0 -1 -2 -7
_________________________________________________________
Dividing row 2 by -5/2
_________________________________________________________
1 3/4 1/4 1/2
0 1 -3/5 -4/5
0 -1 -2 -7
_________________________________________________________
Multiplying row 2 by -3/4 and adding result to row 1
_________________________________________________________
1 0 7/10 11/10
0 1 -3/5 -4/5
0 -1 -2 -7
_________________________________________________________
Multiplying row 2 by 1 and adding result to row 3
_________________________________________________________
1 0 7/10 11/10
0 1 -3/5 -4/5
0 0 -13/5 -39/5
_________________________________________________________
Dividing row 3 by -13/5
_________________________________________________________
1 0 7/10 11/10
0 1 -3/5 -4/5
0 0 1 3
_________________________________________________________
Multiplying row 3 by -7/10 and adding result to row 1
_________________________________________________________
1 0 0 -1
0 1 -3/5 -4/5
0 0 1 3
_________________________________________________________
Multiplying row 3 by 3/5 and adding result to row 2
_________________________________________________________
1 0 0 -1
0 1 0 1
0 0 1 3
_________________________________________________________
************************************************************
Row reduced echelon form:
_________________________________________________________
1 0 0 -1
0 1 0 1
0 0 1 3
_________________________________________________________
************************************************************
So, we see there is a unique solution for vector x:
x1 = -1
x2 = 1
x3 = 3
An example where there are no solutions:
mwh@coyote2:[~]:
---> rref
Enter the number of rows in the matrix: 3
Enter the number of columns in the matrix: 4
Enter row 1, column 1 : 1
Enter row 1, column 2 : -3
Enter row 1, column 3 : 4
Enter row 1, column 4 : 1
Enter row 2, column 1 : 2
Enter row 2, column 2 : 13
Enter row 2, column 3 : -17
Enter row 2, column 4 : 2
Enter row 3, column 1 : -2
Enter row 3, column 2 : 6
Enter row 3, column 3 : -8
Enter row 3, column 4 : 1
Original Matrix:
_________________________________________________________
1 -3 4 1
2 13 -17 2
-2 6 -8 1
_________________________________________________________
Dividing row 1 by 1
_________________________________________________________
1 -3 4 1
2 13 -17 2
-2 6 -8 1
_________________________________________________________
Multiplying row 1 by -2 and adding result to row 2
_________________________________________________________
1 -3 4 1
0 19 -25 0
-2 6 -8 1
_________________________________________________________
Multiplying row 1 by 2 and adding result to row 3
_________________________________________________________
1 -3 4 1
0 19 -25 0
0 0 0 3
_________________________________________________________
Dividing row 2 by 19
_________________________________________________________
1 -3 4 1
0 1 -25/19 0
0 0 0 3
_________________________________________________________
Multiplying row 2 by 3 and adding result to row 1
_________________________________________________________
1 0 1/19 1
0 1 -25/19 0
0 0 0 3
_________________________________________________________
Multiplying row 2 by 0 and adding result to row 3
_________________________________________________________
1 0 1/19 1
0 1 -25/19 0
0 0 0 3
_________________________________________________________
Dividing row 3 by 3
_________________________________________________________
1 0 1/19 1
0 1 -25/19 0
0 0 0 1
_________________________________________________________
Multiplying row 3 by -1 and adding result to row 1
_________________________________________________________
1 0 1/19 0
0 1 -25/19 0
0 0 0 1
_________________________________________________________
Multiplying row 3 by 0 and adding result to row 2
_________________________________________________________
1 0 1/19 0
0 1 -25/19 0
0 0 0 1
_________________________________________________________
************************************************************
Row reduced echelon form:
_________________________________________________________
1 0 1/19 0
0 1 -25/19 0
0 0 0 1
_________________________________________________________
************************************************************
An example where there are an infinite number of solutions (with 2 free variables). Notice the zero rows in the row echelon form.
mwh@coyote2:[~]:
---> rref
Enter the number of rows in the matrix: 4
Enter the number of columns in the matrix: 5
Enter row 1, column 1 : 1
Enter row 1, column 2 : 2
Enter row 1, column 3 : 3
Enter row 1, column 4 : 4
Enter row 1, column 5 : 5
Enter row 2, column 1 : -1
Enter row 2, column 2 : -2
Enter row 2, column 3 : -3
Enter row 2, column 4 : -4
Enter row 2, column 5 : -5
Enter row 3, column 1 : 10
Enter row 3, column 2 : 20
Enter row 3, column 3 : 30
Enter row 3, column 4 : 40
Enter row 3, column 5 : 50
Enter row 4, column 1 : -3
Enter row 4, column 2 : -5
Enter row 4, column 3 : 32
Enter row 4, column 4 : 12
Enter row 4, column 5 : 100
Original Matrix:
_________________________________________________________
1 2 3 4 5
-1 -2 -3 -4 -5
10 20 30 40 50
-3 -5 32 12 100
_________________________________________________________
Dividing row 1 by 1
_________________________________________________________
1 2 3 4 5
-1 -2 -3 -4 -5
10 20 30 40 50
-3 -5 32 12 100
_________________________________________________________
Multiplying row 1 by 1 and adding result to row 2
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
10 20 30 40 50
-3 -5 32 12 100
_________________________________________________________
Multiplying row 1 by -10 and adding result to row 3
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
-3 -5 32 12 100
_________________________________________________________
Multiplying row 1 by 3 and adding result to row 4
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Prevented division by zero
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 2 by -2 and adding result to row 1
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 2 by 0 and adding result to row 3
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 2 by -1 and adding result to row 4
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Prevented division by zero
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 3 by -2 and adding result to row 1
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 3 by 0 and adding result to row 2
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 3 by -1 and adding result to row 4
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Dividing row 4 by 1
_________________________________________________________
1 2 3 4 5
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 4 by -2 and adding result to row 1
_________________________________________________________
1 0 -79 -44 -225
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 4 by 0 and adding result to row 2
_________________________________________________________
1 0 -79 -44 -225
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
Multiplying row 4 by 0 and adding result to row 3
_________________________________________________________
1 0 -79 -44 -225
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
************************************************************
Row reduced echelon form:
_________________________________________________________
1 0 -79 -44 -225
0 0 0 0 0
0 0 0 0 0
0 1 41 24 115
_________________________________________________________
************************************************************
I have been reading the posts. It's one of the first things I do in the morning. Do not mistaken the absence of comments or responses as a sign that I am not interested.
I have tragedies to report, and I am glad to read what others have to say.
I just wanted to post a few examples of the output of rref to give you an idea of the work it does. Final analysis is left to the "user".
May our toothaches be of the minor nuisance variety and not the full blown kind that leave one at the mercy of an expensive oral surgeon who only accepts cash (cash that you already spent on food, wires, adapters, and mysterious black boxes).