wikipedia is correct. your algorithm is wrong. note that the solutions given by your algorithm do not work in the last equation. plug them in and checkI'm currently trying to understand how to solve systems of equations using Gaussian elimination and back-substitution. I'm also trying to implement some computer algorithms that solve systems of equations using this method.
Now I know Wikipedia is not always a reliable source, but I thought it be helpful to get some sample problems from the Wikipedia entry on Guassian elimination. But, no matter how many times I try to solve it, I never get the answer specified on Wikipedia. Also, the computer algorithm I use doesn't get the Wikipedia answer either. So either I'm doing this totally wrong, or Wikipedia is wrong about it.
The wikipedia entry can be found at Gaussian elimination - Wikipedia, the free encyclopedia
Here is the system of equations:
2x + y - z = 8
-3x - y + 2z = -11
-2x + y + 2z = -3
So we get a matrix like this:
| 2 1 -1 8 |
| -3 -1 2 -11 |
| 2 1 2 -3 |
Now, the Wikipedia article gives the solution as:
x = 2
y = 3
z = -1
But the computer algorithm I implemented gets the following results:
x = -0.66
y = 5.66
z = -3.66
At first I thought it's more likely that I'm wrong than the Wikipedia article, so I tried solving the same system of equations using a professional computer algorithm, and I got the same solution. Also, when you plug in the above values for 2x + y - z = 8, you get a true statement. So it seems Wikipedia is wrong here, unless I'm totally missing something.
Can anyone confirm this? I would really appreciate it.