In this explainer, we will learn how to perform elementary row operations on a matrix and how to represent a system of linear equations as an augmented matrix.

One of the luxuries when working with linear algebra is the sheer variety of methods that are often available for solving a problem or completing a calculation. Perhaps the most exemplary of these is GaussβJordan elimination, where any combination of valid row operations can be used to put a matrix into reduced echelon form, which is often used to solve a system of linear equations. GaussβJordan elimination can also be used to calculate the inverse of a square matrix (if it exists), as can the adjoint method. Principles of the adjoint method can also be used to help calculate the determinant of a matrix, which can alternatively be found by expanding along any row or column and combining with relevant matrix minors. This intermingling of equivalent ideas is a beautiful feature of linear algebra that rewards long-term study and exploration. Inevitably, however, people end up settling on their favorite techniques when working with linear algebra, often forgetting or totally neglecting other, equivalent ideas that might be circumstantially more useful.

Often when calculating the determinant of a matrix, we would use one of the two methods alluded to above. However, there is one method that is used infrequently in comparison, despite being versatile and ostensibly similar to the process of GaussβJordan elimination. Our aim will be to use elementary row operations to manipulate a matrix into upper-triangular form, keeping track of any effect on the determinant and then use this form to quickly calculate the final answer. To do this we will need to first recap the elementary row operations for matrices.

### Definition: Elementary Row Operations

Consider a matrix of order and with rows labeled . Then, the three elementary row operations that we can perform are as follows:

- Switching of row with row , denoted ;
- Scaling of row by a nonzero constant , denoted ;
- Adding a scaled version of row to row , denoted .

If an elementary row operation is used to to transform the matrix into a new matrix , then we should say that these two matrices are βrow equivalent.β

To demonstrate the effect of these row operations, consider the matrix

The first elementary row operation is the simplest to describe, as this just involves the switching of two rows, with no change to their entries. For example, the row operation exchanges the first and the third row, leaving all other rows unchanged:

We can also take an entire row and multiply by a nonzero constant. Suppose that we wanted to multiply every entry in the second row of this new matrix by a scale factor of 3. We would use the elementary row operation on the matrix immediately above, giving

As we can see, there has only been a change in the second row. To demonstrate the third type of elementary row operation, we select the example . This takes every element in the first row, doubles it, and then subtracts it from the entry in the same column of the third row. This only changes the third row of the matrix, giving

The matrices above are all row equivalent because we can transform from one to the next by only using elementary row operations. Had we been working with a square matrix, we might have been interested in how the determinant changes between a series of row-equivalent matrices. With row operations being so useful when working with matrices, it is understandable that we might like to classify the effects on a concept that is as ubiquitous as the determinant. The results are pleasantly simple, as described by the following theorem.

### Theorem: Elementary Row Operations and the Determinant

Consider a square matrix with order . Then, suppose that an elementary row operation is used to create the row-equivalent matrix . Then, the effect of each elementary row operation is as follows:

- For , where , we have .
- For , where , we have .
- For , we have .

The first elementary row operation has a simple effect on the determinant, introducing only a sign change. The second row operation involves scaling a whole row by a nonzero constant, and this corresponds to scaling the determinant by the same number. The third elementary row operation is the hardest and, yet, there is no overall effect on the determinant. This last result is especially convenient because we will be using elementary row operations to reduce squares matrices to upper-triangular form. If we are to use the third type of elementary row operation, then there will be no need to modify the determinant at all, which will certainly be an advantage. In the next two examples, we will demonstrate how to implement elementary row operations and track the overall effect on the determinant.

### Example 1: Elementary Row Operations and the Determinant of a 2 Γ 2 Matrix

Consider the matrix

After obtaining the row-equivalent matrix by performing the following elementary row operations in order: , , , and , what is the determinant of in terms of the determinant of the row-equivalent matrix ?

### Answer

We apply the first row operation to obtain the row-equivalent matrix

Given that we have used an elementary row operation, we must keep track of the effect on the determinant. We implemented , which means that the determinant must be scale by the same number. In other words, . Next, we perform the row-swap operation , assigning this matrix to the previous variable , giving

(Although overwriting a variable like this is somewhat improper notation, it is very convenient for tracking the overall effect on the determinant, so we allow it in this situation.)

We have used the row-swap operation and this means that there is a sign change in the determinant, giving . The elementary row operation does not incur any change in the determinant. Therefore, the matrix has the previous determinant relation . Likewise, the elementary row operation also has no effect on the determinant, despite returning the matrix

Overall, the relationship between the determinants of the two matrices is . Rearranging this equation gives .

We can check that the answer in the previous example is correct by examining the determinants of both matrices:

For the original matrix , we could use the standard formula for the determinant of a matrix to calculate

Applying the same method to the row-equivalent matrix gives

This confirms the relationship we found in the previous example between the determinants: .

### Example 2: Elementary Row Operations and the Determinant of a 3 Γ 3 Matrix

Consider the matrix

After obtaining the row-equivalent matrix by performing the following elementary row operations in order: , , , , and , what is the determinant of in terms of the determinant of the row-equivalent matrix ?

### Answer

The first row operation that we need to perform is the row scaling . This gives the row-equivalent matrix

Given that we have scaled one of the rows by the constant 3, we must keep a note that . We are asked to then perform another row-scaling operation: . The new matrix is and we must update the relationship between the determinants, with the case now being that . The next elementary row operation is , which belongs to the third type of row operation and therefore has no effect on the determinant. The row-equivalent matrix therefore maintains the determinant relationship . The row-swap operation incurs a sign change in the determinant. Using to give the matrix means that the determinant relationship must be modified to include a sign change, meaning that . The final row operation is again of the type that does not change the determinant. Therefore, the row-equivalent matrix has the determinant relationship . Rearranging the equation gives .

As with the previous question regarding a matrix, we can also check the example above by manually calculating the determinant. For this, we use Sarrusβ rule on both of the matrices:

For the original matrix , we find

Then, for the row-equivalent matrix , Sarrusβ rule gives

As expected, we have confirmed the relationship given at the end of the previous question, namely, that .

Our work so far has been helpful in that it allows us to use row operations (one of the most commonly used tools in linear algebra) to simplify the calculation of determinants (one of the most commonly calculated quantities in linear algebra). Despite the obvious advantages of such a toolkit, we have not yet exploited this to its full potential. The examples above have used row operations to establish relationships between row-equivalent matrices, which will allow for a streamlined approach toward calculating the determinant. However, we have not yet shown how this method can be used to actually calculate the determinant of a matrix in a self-contained way. For this, we need only one further result of startling elegance, which relates upper-triangular matrices to the determinant.

### Theorem: Upper-Triangular Form and the Determinant

For a square matrix in upper-triangular form, the determinant is the product of the diagonal entries.

This theorem can be combined with our understanding of how the elementary row operations will affect the determinant of a matrix, and it applies equally to lower-triangular matrices (which are not useful here but occur in many contexts such as LU and PLU decomposition). Even more helpfully, this approach utilizes nearly identical techniques and tactics to when performing GaussβJordan elimination to find the echelon form of a matrix. As we will see in the following examples, it is possible to radically shortcut the calculation of a determinant if row operations can be quickly used to manipulate the matrix into a row-equivalent matrix that is also in upper-triangular form. Any matrix in this form can be calculated by the theorem above.

### Example 3: Calculating the Determinant of a 2 Γ 2 Matrix Using Elementary Row Operations

Consider the matrix

- Use elementary row operations to reduce the matrix into upper-triangular form.
- Calculate the determinant of matrix .

### Answer

Before using any row operations, we highlight the pivots in each row, which are the first nonzero entries:

There are infinitely many ways that we could manipulate this matrix into upper-triangular form using elementary row operations. The following is one such method, wherein we aim to remove the pivot in the second row using row operations, thereby placing the matrix into upper-triangular form. We will choose the approach which uses row operations to give the pivots the same value. The scaling row operation returns the row-equivalent matrix

By scaling each entry in one of the rows by a nonzero constant, we have affected the determinant of the matrix such that . Now, we will use the row operation to ensure that the two pivots have the same value:

We have again altered the determinant such that . It is now a simple matter to turn this matrix into upper-triangular form with the row operation . This type of row operation does not change the determinant, meaning that the outputted matrix is and there is no change to the determinant relationship . Alternatively (and more usefully), we can equivalently say that .

Now that is an upper-triangular matrix, the determinant is simply the product of the diagonal entries. In other words, we have . Given that , we have . This can be checked by directly calculating the determinant of using any valid method.

We cannot pretend that the method above was easier than the standard method for calculating the determinant of a matrix. It is hard to imagine a situation where the usage of row operations would be preferable for calculating the determinant of matrices with this order, although the merits quickly become clear when working with matrices that have order or larger. It is definitely not the case that the method presented in this explainer is superior in every situation, although in the following examples it is clear that using row operations will provide a quick answer compared to a blunter instrument such as Sarrusβ rule. As a rule of thumb, the closer a matrix already is to upper-triangular form, the more helpful our method is likely to be.

It is also worth bearing in mind that the third type of row operation does not effect the determinant. We would generally choose this row operation if it does not result in too many fractions being produced (which might pollute the subsequent working with proliferating errors). A key skill with this method is in being able to understand the situations in which the method we have presented is most suitable, with the working principle that the third type of row operation should be used if possible.

### Example 4: Calculating the Determinant of a 3 Γ 3 Matrix Using Elementary Row Operations

Consider the matrix

- Use elementary row operations to reduce the matrix into upper-triangular form.
- Calculate the determinant of matrix .

### Answer

We initially highlight the pivot in each of the rows. These are the first nonzero entries of each row:

To obtain upper-triangular form, the pivot in the third row will first need to be replaced with a zero entry. One option for achieving this is with the row operation , which gives the row-equivalent matrix

We have used the third type of row operation, which does not alter the determinant and therefore . We will achieve upper-triangular form if the pivot in the third row can be moved to the right, by replacing this entry with a zero. The operation provides the row-equivalent matrix

This type of row operation has not changed the determinant of . Now that is in upper-triangular form, the determinant is calculated by taking the product of the diagonal entries. This gives . Since , we conclude that . This result can be checked by Sarrusβ rule or any other valid method.

In the examples that we have worked with so far, all of the determinants have been nonzero, which means that the matrix would be invertible. We have seen that the determinant of an upper-triangular matrix is calculated by the product of the diagonal entries. Should any of these entries be zero, the determinant of the matrix will also be zero. In the following example, we will use elementary row operations to manipulate a square matrix into upper-triangular form, whereupon we will find that one of the diagonal entries is equal to zero, meaning that the determinant will be equal to zero and therefore the matrix will not be invertible.

### Example 5: Calculating the Determinant of a 3 Γ 3 Matrix Using Elementary Row Operations

Consider the matrix

- Use elementary row operations to reduce the matrix into upper-triangular form.
- Calculate the determinant of matrix .

### Answer

We first highlight all of the pivot entries in the matrix :

To manipulate this matrix into upper-triangular form using row operations, it is usually advantageous to produce a value of β1β in the top-left entry of the matrix, so that the remaining entries in this column can be more easily removed. One way of achieving this is to use the pivot entry in the second row, placing this in the first row with the swap operation . This gives the row-equivalent matrix

Given that we have used the row-swap operation once, we have changed the sign of the determinant, meaning that . Now the pivot in the top-left entry can be given a value of 1 with the row-scale operation , giving

We have scaled one of the rows in the matrix by a constant, in this case the constant . We just adjust the sign of the determinant, meaning that . We are now in a position to use the third type of row operation to begin moving toward upper-triangular form. The pivot entries in the second and third rows can be turned into zero entries with the concurrent row operations and . This gives the matrix

The third type of row operation does not cause any change in the determinant, meaning that we maintain the relationship . We can also observe that now the matrix is actually in upper-triangular form, meaning that the determinant is simply the product of the diagonal entries. Given that one of these entries is equal to zero, we find that .

The benefits of this technique can be further appreciated when working with matrices of even larger orders. For such matrices, the standard method for calculating the determinant does allow for an element of choice in order to make the calculations easier. Most often though, there is no way of avoiding a large number of calculations when using the standard method, so we should therefore be open to the alternative approach that we have developed in this explainer. As with the previous example, in the following question we should be motivated to use the third type of row operation in order to manipulate the matrix into upper-triangular form.

### Example 6: Calculating the Determinant of a 4 Γ 4 Matrix Using Elementary Row Operations

Consider the matrix

- Use elementary row operations to reduce the matrix into upper-triangular form.
- Calculate the determinant of matrix .

### Answer

First, we highlight the pivots in each of the rows:

Our aim will be to use row operations to manipulate this matrix into upper-triangular form. First, we must remove the nonzero entry in the third row. To do this, we can use the first row as follows: . This produces the row-equivalent matrix

There has been no effect on the determinant because of the type of row operation that we have used. Therefore, . Now, we must remove the pivot in the fourth row, so we choose the row operation , giving

Once again, we have not changed the determinant and therefore . There is one final row operation required to move the matrix into upper-triangular form: . The result is

The matrix is now in upper-triangular form and hence the determinant is the product of all the diagonal entries. This means that

This method of using row operations is very reminiscent of GaussβJordan elimination, where we would be aiming to achieve the reduced echelon form of a matrix. In fact, many of the same strategies apply to our method of calculating the determinant by using row operations to obtain a row-equivalent, upper-triangular matrix. The two techniques are not identical, and the method demonstrated in this explainer is more closely aligned with the idea of LU or PLU decomposition, where matrices having certain forms are used to simplify complicated calculations and serve as the bedrock of many versatile and insightful theorems. Although there are many situations (such as those we have given in this explainer) where using row operations is clearly the optimal method for calculating the determinant, it is no less important to be familiar with the other available methods, as there will always be situations in which they are more applicable.

### Key Points

- The three elementary row operations can be used to calculate the determinant of a square matrix by manipulating it into a row-equivalent, upper-triangular matrix.
- The first type of row operation () changes the sign of the determinant.
- The second type of row operation () multiplies the determinant by .
- The third type of row operation () is preferable as this does not effect the determinant.
- The closer a square matrix is to being in upper-triangular form, the more likely it will be that this method is optimal.