## Determinants, Simultaneous Equations

### Simultaneous Equations

You are given 3 equations and 3 unknowns, and you are asked to find the point in 3 space that satisfies all three equations simultaneously.  Here is a sample.

```   x +  y +  z =  9
x + 2y + 3z = 23
x + 5y - 3z = -7
```

Before we solve this, let's think about it geometrically.  Each equation is a plane slicing through 3 space.  There are 3 planes, one for each equation, and most of the time they will intersect in a point, like the floor and two walls of a room.  The point that is contained in all three planes is the point that satisfies the three equations simultaneously.  If we are rather unlucky, two planes could be parallel, like the floor and the ceiling, and there is no intersection, hence no solution.  Or two planes could be one and the same, the floor and the floor, whence the third plane intersects this plane in a line.  Now there are infinitely many solutions running along a line in 3 space.  The same thing happens when 3 distinct planes intersect in a line, like the pages of an open book.

All this generalizes to higher dimensions, though it is hard to picture.

Assuming n variables, the solution is always a subspace of n space.  This is not surprising.  If you have two solutions, subtract them to get a point in n space that satisfies all your equations with the constants set to 0.  Something like this.

```   x +  y +  z = 0
x + 2y + 3z = 0
x + 5y - 3z = 0
```

Subtract any two solutions for the first set of equations (at the top of this page), and find a solution for the second set.  Conversely, given a solution for the first set, add solutions for the second set to get yet more solutions for the first set.  Realize that the second set of equations is a linear transformation, and its kernel, the points that map to zero, is a subspace.  In fact the dimension of the kernel, the dimension of the solution space for either set of equations, is n - the rank of the second matrix.  The rank is the quotient space, and we know the dimension of the kernel + the dimension of the quotient is n.

I deliberately wrote the equations as a matrix, because gaussian elimination provides a way to solve simultaneous equations, thousands of them if you wish.  Actually the first matrix, with the constants, is called an augmented matrix, because it has been "augmented" by the constants on the right.  Run gaussian elimination on it as usual, but carry the constants along.  Swapping two equations won't change the solution space, and neither will row subtraction, where one equation is scaled and subtracted from another.  Here is the augmented matrix after the first column is cleared, and then after the second column is cleared.

```   x +  y +  z =  9
0 +  y + 2z = 14
0 + 4y - 4z = -16
```

```   x +  y +  z =  9
0 +  y + 2z = 14
0 +  0 -12z = -72
```

The last set of equations is easy to solve using "back substitution".  Start at the bottom and work up.  Clearly z is 6.  Replace z with 6 in the second equation, and y = 2.  Finally the first equation tells us x = 1.

If there were no solutions, gaussian elimination would have produced something like 0+0+0 = 1.  Redundant equations become 0+0+0 = 0 and go away.  If there are many solutions, the last nontrivial equation has more than one variable.  If it has 3 variables, for instance, two of them are free parameters.  Call them s and t, and solve for the third in terms of s and t.  Then back up to the previous equation and replace the last three variables with expressions in s and t.  If this leaves one variable unspecified, solve for it.  If two variables remain, one of them is a free parameter.  Call it u and solve for the other in terms of s t and u.  Then back up to the previous equation and continue.  Finally you have a solution space expressed using free parameters.  The number of parameters is the dimension of the solution space.  Let's try another 3-dimensional example that looks like three pages of a book.  The solution is the spine of the book, a line in 3 space.

```    x + 2y - 3z = 5
x - 4y + 5z = 7
4x - 4y + 4z = 24
```

After the first column is cleared, you get the following.

```    x + 2y - 3z = 5
0 - 6y + 8z = 2
0 -12y +16z = 4
```

The third equation is now twice the second.  When gaussian eliination is complete, the third row is all zeros, and contributes nothing.  So we start with the second equation.  Replace z with the free parameter t, and y becomes (4t-1)/3.  Replace y and z in the first equation and get x = (t+17)/3.  Every real value of t gives a solution to the three equations.