17.6 Solving Several Simultaneous Linear Equations in Several Variables

The sort of problem we want to solve is typified by the following example.

We are given the equation

and wish to determine the values of x, y and z that these equations imply.

We can associate the following array of numbers with this set of equations.

Here the first three columns are the coefficients of x, y and z respectively, and the last column consists of the numbers on the right hand sides of the equations.

We really want to extract an equation of the form Ax = B (and similar equations for y and for z) from this one.

We can do so using determinants. In fact, in general given a system of equations with k equations in k variables the same result holds. And it is:

Set A = the determinant of the first k (here 3) columns of this array, and B the determinant of the array with the right hand column substituted for the column associated with the variable you are looking for.

Thus, if we want an expression for the variable x, B will be the determinant of the array whose first column is the last one above, and the second and third columns are as given.

The answer is, then, that x is given by the ratio, .

This statement is called Cramer's Rule, and is not difficult to prove. Proof

Here it is explicitly in this case:

The wonderful thing about this expression is that you can use your spreadsheet method for computing determinants, to, at the same time, and with hardly any more effort, compute the numerators and denominator for all variables, and to deduce the values of all the variables. Thus, with a few minutes of effort, you can set up an instant equation solver, for up to say, 10 equations in 10 variables. Once you have set it up, as soon as you write down your array, it will produce solutions, and check that they are solutions.

Does this always work?

Well, almost always. You have trouble if the denominator here is 0. That means that there will be no solution at all unless the numerator is also 0, in which case there are lots of solutions, and this method will give you one of them, with luck.

The hardest part, in setting this up is in creating your input information, which is the array representing the equations you want to solve. When you set such a thing up, you are wise to use the hint described in a previous section for avoiding dividing by 0. Otherwise you are very likely to get some ridiculous error message instead of your answer when you want it the most.


17.10 Write down the Cramer's Rule expressions for the variables y and z given the equations above.

17.11 Evaluate the determinants in these expressions, and verify that you get solutions to these equations by finding x y and z explicitly and substituting them into the equations.

You claim I can actually do this and solve lots of equations in lots of variables? OK, how?