# Matrix

A matrix (plural matrices) is a rectangular array of numbers. Matrices are organized into rows of columns and each number in a matrix is commonly referred to as an entry, term, or element. Matrices are typically named using capital letters, and are referenced based on the number of rows and columns in the matrix. For example, a matrix with 2 rows and 3 columns would be referred to as a "two by three" matrix, or a 2 × 3 matrix; this is referred to as the order of the matrix. Below are examples of a 2 × 2, 2 × 3, and 3 × 5 matrix.

Matrices can undergo operations such as multiplication, addition, and subtraction, among others, but not necessarily in ways that are exactly analogous to their arithmetic operations. They can also be used to represent linear systems of equations and to solve said systems. For example, the following system of linear equations,

2a - b + c = 21

-2a + 2b - 2c = -28

3a + 2b + c = 17

can be written in the form of an augmented matrix as,

where each value corresponds to a coefficient in the linear equation. As such, the matrix,

is referred to as the coefficient matrix of the system. This is worth noting, as one of the methods for solving systems of linear equations involves manipulating the coefficient matrix. There are various ways to solve systems of linear equations using a matrix, such as using the inverse of the matrix, its determinant, or Gaussian elimination. In order to use some of these methods, it is important to first recognize a few different types of matrices.

## Special types of matrices

Matrices that have an order of n × n (2 × 2, 3 × 3, 9 × 9, etc.) are referred to as square matrices. Both matrix A and matrix B below are square matrices:

Being able to recognize square matrices is useful in part because one of the methods for solving linear equations, called Cramer's rule, involves using determinants, which can only be calculated from a square matrix.

Matrices can also be described in terms of their entries, particularly in relation to the main diagonal of the matrix. The main diagonal of matrix A is highlighted in green:

Also note that the two numbers in the subscript are a reference to the position of the entry within the matrix. For example, a11 is the entry in the first row and the first column of the matrix. If the entries above the main diagonal of a square matrix are 0, the square matrix is called a lower diagonal (or lower triangular) matrix. Similarly, if the entries below the main diagonal are zero, the matrix is referred to as an upper diagonal (or upper triangular) matrix. Matrix A below is a lower triangular matrix, while matrix B is an upper triangular matrix.

If the entries both above and below the main diagonal of a square matrix are 0, the matrix is referred to as a diagonal matrix. Both matrix A and B below are diagonal matrices:

If the entries in the main diagonal of a diagonal matrix are all 1, the matrix is a special matrix referred to as an identity matrix. Identity matrices are typically named as I:

Identity matrices are used in a number of different ways, one of which is as part of a method for solving systems of linear equations, referred to as Gaussian elimination.

## Gaussian elimination

Gaussian elimination is a method for solving matrices that involves manipulating an augmented matrix through a series of operations referred to as row reduction operations. Row reduction operations do not change the system of equations. Rather, they convert them into equivalent systems. The following are row operations that can be performed on an augmented matrix:

• Interchange all entries of any two rows (i.e. switch the position of row 1 with row 2).
• Multiply any row by a scalar value (e.g. multiply all entries in row 1 of a matrix by 2).
• Combine a scalar multiple of one row with another row (or simply combine two rows). This is the equivalent of performing basic arithmetic using two rows, as we would when manipulating systems of equations that are not represented in the form of a matrix.

The goal of performing these various row operations is to convert the matrix into what is referred to as reduced row echelon form. Firstly, a matrix is in row echelon form if the following conditions are true:

• All rows made up of only 0s are at the bottom of the matrix.
• The leading coefficient of a non-zero row is always to the right of the leading coefficient of the row directly above it.

A matrix is in reduced row echelon form (a more strict version of row echelon form) if:

• It is in row echelon form.
• The leading entry in each non-zero row is 1.
• Each column that has a leading 1 has 0s in all of its other entries.

If a matrix is in reduced row echelon form, the leading coefficients in the matrix identify the solution to the corresponding variable in the system of equations. For example, we will reduce the following augmented matrix to reduced row echelon form, but first will show the resulting matrix in reduced row echelon form, and how it corresponds to the solution of the system of linear equations. The system of linear equations,

2x - y + z = 3

x + y + z = 6

3x -2z = 3,

can be written in augmented matrix form as

,

which can be represented in reduced row echelon form as:

The leading 1s correspond to the respective variables. In this case, column 1 is x, column 2 is y, and column 3 is z. Thus, the solution to the system of linear equations is x = 1, y = 2, and z = 3.

Generally, when attempting to convert a matrix to reduced row echelon form, it is helpful to first obtain a lower triangular matrix, then an upper triangular matrix. The following steps were used to convert the matrix above into its reduced row echelon form.

1. Switch rows 1 and 2:

,

2. Rows 1, 2, and 3 will be referred to as R1, R2, and R3 respectively, and each line will indicate the operations performed. For example, for the second step, R1 is multiplied by -2, then added to R2. The result becomes the new R2. These operations are indicated as -2R1 + R2 → R2 (applied to the matrix above), and the result is as follows:

3. -3R1 + R3 → R3:

4. -R2 + R3 → R3:

5. ⅓R2 + R1 → R1:

6. -¼R3:

7. -⅔R3 + R1 → R1:

8. R3 + R2 → R2:

9. -⅓R2:

In this case, we see that the coefficient matrix in the reduced row echelon form matrix is an identity matrix. This is not always the case, but converting a matrix to reduced row echelon form can always be used to solve a system of linear equations.