# System of linear equations

• Feb 4th 2013, 08:31 AM
sirellwood
System of linear equations
So I have the following set of linear equations:

x + 2y - z = 1
-x -2y + 3z = 0
x + y + z = -2

I then used Gaussian Elimination to simplify them, from which I obtained the Matrix:

6 0 0 -15
0 -12 0 -16
0 0 6 -5

first of all, my calculations could well be wrong, but I think i did it right. More to the point, I am more struggling with how to interpret the results. So from this matrix, do I take from it that, the system has a unique solution? the system has no solution? or the system has an infinite number of solutions?

Obviously the answer will also rely on whether or not my Gaussian Elimination is correct!

Thanks
• Feb 4th 2013, 09:04 PM
chiro
Re: System of linear equations
Hey sirrelwood.

Checking with octave, I get the following:

>> A = [1, 2, -1; -1, -2, 3; 1, 1, 1]
A =

1 2 -1
-1 -2 3
1 1 1

>> b = [1; 0; -2]
b =

1
0
-2

>> A\b
ans =

-6.50000
4.00000
0.50000

The above confirms that the solution is unique however the actual solution obtained is very different.

The inverse of the matrix given by Octave is:

>> inv(A)
ans =

-2.50000 -1.50000 2.00000
2.00000 1.00000 -1.00000
0.50000 0.50000 0.00000
• Feb 4th 2013, 10:26 PM
hollywood
Re: System of linear equations
Yes, the correct solution to the system is x=-13/2, y=4, z=1/2, so it seems like you made an error in your Gaussian Elimination. If I interpret your results correctly, you would get x=-15/6=-5/2, y=-16/-12=4/3, z=-5/6, which doesn't work: -x-2y+3z = -8/3. Here's how I would have done it:

[ 1 2 -1 1]
[-1 -2 3 0]
[ 1 1 1 -2]

Add row 1 to row 2, subtract row 1 from row 3, and swap rows 2 and 3:

[ 1 2 -1 1]
[ 0 -1 2 -3]
[ 0 0 2 1]

Subtract row 3 from row 2:

[ 1 2 -1 1]
[ 0 -1 0 -4]
[ 0 0 2 1]

Add 2*row 2 and (1/2)*row 3 to row 1:

[ 1 0 0 -13/2]
[ 0 -1 0 -4]
[ 0 0 2 1]

So the solution is x=-13/2, y=4, z=1/2.

- Hollywood