# Always solving systems of linear equations wrong - what do I do wrong?

over time I noticed I (and other) again and again have problems solving "systems of linear equations". It seems depending of the steps one chooses, we get different results!! How can that be? Should one not always get the same results no matter which path he goes down? What am I missing? Are there maybe rules I don't know and use even though I shouldn't?

I want to give you an example. The set of equations is from a state-price security calculation (see "State Preference Approach") which we shall solve using the Gaussian elimination:

I: 2P(1) + 2P(2) + 2P(3) =1,6

II: 3P(1) + 0P(2) + 1P(3) =1,0

III: 0P(1) + 2P(2) + 1P(3) =0,8

The solution shall be: P(1) = 0,2 P(2)=0,2 and P(3)=0,4

Not only got I different numbers on the first try that totally went in "into space", I want to write down for you my second approach to check for mistakes:

II-III = IV = 3P(1) - 2P(2) = 0,2 --> 2P(2) = 3P(1) - 0,2 (this far I'm with the solution) then I simply plug in the result in the following lines:

in III: 4P(1) = 1 --> P(1) = 0,25

in II: 0,75 + P(3) = 1,0 --> P(3) = 0,25

in I: 0,5 + 2P(2) + 0,5 = 1,6 --> P(2) = 0,3

But these results seem to differ. So it seems I clearly miss some important rule!

Must I not "plug in" results into other rows, as the "Gaussian" system seems to avoid? But how can there be a difference / can I be forced to avoid "plugging in" results?

This should normally be allowed, shouldn't it? Can you help me find my blind spot?

-
I want to double-check a few things. I'm used to point-decimal notation, i.e. 1.5. But when you write things like 0,25 - that's a decimal, right? Second, when you write P(1), P(2), and P(3), do you just mean separate variables that you are solving for? –  mixedmath Jul 10 '11 at 21:04
One of the problems could be notation. Maybe $P(1)$, $P(2)$, $P(3)$ look too much like each other, particularly when there are numbers floating around. I have a feeling that the error rate might go down if they were called $x$, $y$, and $z$. –  André Nicolas Jul 10 '11 at 22:22
user6312 you are basically right, but we have to use this notation! :( But furthermore I got the problem, that I never come down to one variable! I also had this problem with later exercises. I can calculate around for 30 minutes and don't come to an end / silver lining on the horizon! –  grunwald2.0 Jul 12 '11 at 19:52

"Plugging in" or "substituting back" or whatever is equivalent to Gaussian elimination. You just made an error. You got $2P(2)=3P(1)-0{,}2$ all right. But when you plug that in equation III becomes: $3P(1)+P(3)=1{,}0$ and equation I becomes: $5P(1)+2P(3)=1{,}8$. Both of these still match the given solution.

IOW, you got variables mixed up. Not doing it systematically occasionally leads to a sleek solution, but you have to be careful.

-
You are right. But how do I know when I do it systematically and when I "slack off"? Maybe I didn't get the system yet, but I rarely see a longterm path (even though the Gaussian way suggests that and is actually a system!) because in the linear equations I have to solve I rarely see that being possible! It might be like chess, but I mostly can only "systematically" think ahead one or two "moves"! Thus I don't feel like I can really be strategic about it. Result: see above/below comment. ;) –  grunwald2.0 Jul 12 '11 at 19:55
@grunwald: Say that we have 3 unknowns+3eqs like in your example (similar thinking works with more). You solve one of them from some equation (no need to try those subtraction tricks, though they may make it more transparent). Set aside this equation, and plug in the solved variable into the other two equations. Now you have a pair of equations with two variables. Rinse. Repeat. IOW solve one of the remaining variables from one of those two eqs. Substitute to the remaining equation. One variable remaining, so can solve it. Substitute the solved value back to the equations that were set aside.. –  Jyrki Lahtonen Jul 12 '11 at 20:29

You're not missing some important rule; you're just making mistakes, which we all do, and you have the good sense to check your results, so everything is in best order -- all you need to do is learn to find your mistakes :-)

Where you wrote "I-III", I think you meant "II-III", and where it says "in III", you added 3P(1) and 1P(3) to make 4P(1), but the second one was a P(3), not a P(1).

-
Oh yes you are indeed right. It's 1 P(3) and 3P(1) still. Indeed the notation is confusing, but we have to use it. But now I got the problem, that I never come down to one variable! I also had this problem with later exercises. I can calculate around for 30 minutes and don't come to an end / silver lining on the horizon! –  grunwald2.0 Jul 12 '11 at 19:49