In fact, any linear equation can be put in the form
where n is the number of variables, the variables are x1, x2, ... , xn, and c0, c1, ... , cn are constants.
A system is just a collection of such linear equations, and to solve a system look for the values of the variables which make all the equations true simultaneously. For instance, if x and y are the variables, then an example system of linear equations is
|5x||– 2y||= 4|
|x||+ 2y||= 8|
There are various ways of solving this system, and they lead to the unique solution where x = 2 and y = 3. We’ll look next at a common algorithm for solving systems of simultaneous equations called elimination.
|3x||+ 2y||+ z||= 39|
|2x||+ 3y||+ z||= 34|
|x||+ 2y||+ 3z||= 26|
This is very similar to the ancient Chinese method except they wrote in columns and did not use variables. In fact, the ancient Chinese method uses what we would call matrices. The solution in the Jiuzhang suanshu continues.
Putting the numbers in rows rather than columns, and starting at the top instead of the right, we get the matrix of coefficients of the system of simultaneous linear equations that appears above.
This matrix contains all the information of the system of equations so long as we remember what the rows and columns mean. But we don’t have to write down all the variables, so it’s more concise.
For the rest of the translation of the solution in the Jiuzhang suanshu, I’ll use rows instead of columns to be consistent with the modern practice. The solution proceeds:
The whole purpose of that operation is to get a 0 just where we got it.
This is what we call echelon form, a steplike form where the leading nonzero entries are further to the right in each row. We’ve finished the first stage of the algorithm of elimination. The next stage finds the answers starting with the third unknown and working backwards with back substitutions.
|2x||+ y||= 1|
|3y||+ z||= 1|
|x||+ 4z||= 1|
As a matrix this looks like
First, we’ll put it in echelon form. There already is a 0 at the beginning of the second row. We need to get a 0 at the beginning of the third row. For this example, let’s follow the ancient Chinese method that avoids fractions as long as possible. Double the third row to get 2 0 8 2, and subtract the first row from it.
You might wonder how the ancient Chinese dealt with negative numbers like the 1 that appears in the third row. They had no problem with them. According to Lui Hui (c. 263 C.E.) who wrote about the Jiuzhang suanshu, red rods were used for positive numbers and black rods for negative numbers. He also explained how to add and subtract positive and negative numbers.
For this problem, we can continue by tripling the third row to get 0 –3 24 3, and then adding the second row to it.
The matrix is now in echelon form. We know z = 4/25. We can continue to avoid fractions if we multiply the second row by 25 to get 0 75 25 25 and subtracting the third from it.
We now have y = 21/75 = 7/25. Multiply the first row by 25 to get 50 25 0 25, and subtract the second row 0 25 0 7 from it.
Therefore, x = 18/50 = 9/25. We’ve solved the problem. The solution is: one bundle of the first class contains x = 9/25 measures of grain, one bundle of the second class contains y = 7/25 measures of grain, and one bundle of the third class contains z = 4/25 measures of grain.
|2x||+ 5y||– 13 z||= 1000|
|3x||– 9y||+ 3z||= 0|
|–5x||+ 6y||+ 8z||= –600|
As a matrix this looks like
We can begin by putting a 1 at the beginning of the first row by dividing that row by 2.
Now subtract 3 times the first row from the second, and add 5 times the first row to the third. That will make the first entries in the second and third rows both 0.
Next, divide the second row by –16.5 to put a 1 in its first nonzero entry. We can wait on the third row until later.
(Note that we’ve only kept five significant figures. You would think that would be enough, but we’ll see how that small roundoff error makes a larger error in the final answer.)
Now subtract 18.5 times the second row from the third.
(The error is building up. The .7266 should be .727272...)
Divide the third row by .7266 so its leading nonzero entry becomes 1.
(The correct entry in the last row is 300, not 300.275.)
The matrix is now in echelon form where the first nonzero entry in each row is a 1. We know what z is, 300.275. We can back substitute. Add 1.3636 times the third row to the second row, and add 6.5 times the third row to the first row.
Subtract 2.5 times the second row from the first row.
Thus, the solution is that x = 1200.88, y = 500.364, and z = 300.275.
The fractions are due to roundoff error. The actual solution is x = 1200, y = 500, and z = 300. Even though our computations were done with five significant figures, our final answer is only correct to three significant figures. Typical modern calculators keep a couple extra digits of accuracy to hide the roundoff error. Usually that’s enough, but not always. Perhaps the original method which delays division to the end of the algorithm is a better method.
Of course, there are shortcuts and exceptions. The order of the rows in the matrix is irrelevant, so you can decide which one goes first. If there’s a 1 as the first entry of some row other than the first, you might just as well make that row the first and save yourself some division. For example, in the matrix
start off by making the third row the first. You don’t actually have to exchange the rows; it’s enough to treat the third row as the first. You can do something similar with the columns, but you can get pretty confused if you do that. (You must remember which column refers to which variable.)
One time when you have to treat some other row as the first is when the first leads off with a 0. For instance, in the matrix
you have to make either the second or the third row into the first row.
Now a wrinkle. In many applications, there is a unique solution, that is, there is only one way to assign values to the variables so that the equations are simultaneously true. But not in all applications. Sometimes, there are no solutions at all, and sometimes there are infinitely many solutions. Here’s a coefficient matrix for a system of linear equations that has no solution.
Note that if you sum the first two rows, then you get 5 –1 10 13. That says 5x y + 10z = 13. But the third row says 5x y + 10z = 4. Since 13 does not equal 4, there is no solution. If you were to go through the algorithm of elimination, you end up with the matrix
The important thing to notice is that the last row is a contradiction. It says 0 = 1. There are no values of x, y, and z to make that true. So, there are no solutions to the system. When one of the rows has all zeros in it except the final number, that means the system has no solutions.
Next, let’s look at a system where there are infinitely many solutions. Take the last example, but change the last entry in the last row to 13.
Note now how the third row is the sum of the previous two. If you follow through the method of elimination, you end up with the matrix
The last row says 0 = 0, and that is no condition whatsoever on the values of x, y, and z. The question is: what do you do at this point? The second row says y = 14/13, and the first row says x 2z = 31/13, that is to say, x = 2z + 31/13. Those are the conditions on x and y, but there are no conditions on z. That means you can take any value of z you want, set y to –14/13, and set x to 2z + 31/13, and you get a solution to the system of equations. There are infinitely many solutions. When the solutions are described that way, we say that they are parameterized by z.
Back to Math 105, History of Math, course page
Back to Math 130, Linear Algebra, course page