# Matrices & linear systems

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:

$\displaystyle x + 3 y = 4 \qquad \allowbreak\quad\allowbreak\text{and}\allowbreak\quad\allowbreak \qquad - 2 x + 3 y = 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*:

$\displaystyle \left [ \begin{array}{rr|r} 1 & 3 & 4 \\ - 2 & 3 & 10 \end{array} \right ]$.

The first two columns represent the *x* and *y* coefficients respectively; 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:

$\displaystyle \left [ \begin{array}{rrrr|r} 1 & 0 & 0 & 0 & x \\ 0 & 1 & 0 & 0 & y \\ 0 & 0 & 1 & 0 & z \\ 0 & 0 & 0 & 1 & w \end{array} \right ]$.

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.

## Example

Let’s return to our original example. We had

$\displaystyle \left [ \begin{array}{rr|r} 1 & 3 & 4 \\ - 2 & 3 & 10 \end{array} \right ]$.

We can subtract the second row from the first to get

$\displaystyle \left [ \begin{array}{rr|r} 3 & 0 & - 6 \\ - 2 & 3 & 10 \end{array} \right ]$.

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

$\displaystyle \left [ \begin{array}{rr|r} 3 & 0 & - 6 \\ 0 & 3 & 6 \end{array} \right ]$.

Finally, we can divide both rows by three:

$\displaystyle \left [ \begin{array}{rr|r} 1 & 0 & - 2 \\ 0 & 1 & 2 \end{array} \right ]$.

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