A *matrix* (plural matrices) is a rectangular array of numbers arranged in rows and columns. They have a variety of uses, but for us they are just a convenient way of staying organized while solving linear systems. Solving a system of two linear equations by elimination is easy, but it becomes much harder once you have four or five equations. Consider this linear system:

`x + 3y = 4 qquad and qquad ``-2x + 3y = 10`.

The first step is to move the constant term to the right-hand side. In this case, it’s already done. Now, we take the coefficients and we put them into an *augmented matrix*:

`[(1,3,|,4),(-2,3,|,10)]`.

The first two columns represent the *x* and *y* coefficients resepctively; the last column, separated by a bar, represents the right-hand sides of the equations. To solve the system, we will use *Gauss-Jordan elimination*, which is a method of transforming the matrix to *reduced row-echelon form*. We want the columns left of the bar to have a diagonal of ones and zeros everywhere else. For example, if we were solving a linear system of four equations, the end result would look like this:

`[(1,0,0,0,|,x),(0,1,0,0,|,y),(0,0,1,0,|,z),(0,0,0,1,|,w)]`.

The values of *x*, *y*, *z*, and *w* would be the solution. To perform Gauss-Jordan elimination, we use elementary operations until we get to the reduced row-echelon form. There are just three operations—we can

- interchange any two rows;
- multiply one row by a nonzero scalar;
- add a multiple of one row to another.

Let’s return to our original example. We had

`[(1,3,|,4),(-2,3,|,10)]`.

We can subtract the second row from the first to get

`[(3,0,|,-6),(-2,3,|,10)]`.

We can add two-thirds of the first row to the second to get

`[(3,0,|,-6),(0,3,|,6)]`.

Finally, we can divide both rows by three:

`[(1,0,|,-2),(0,1,|,2)]`.

The values `x=-2` and `y=2` are indeed the solution to this system.