Explainer: Elementary Row Operations

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 𝐴=12610301102βˆ’2012.

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: 2βˆ’20123011012610.

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 π‘Ÿβ†’3π‘ŸοŠ¨οŠ¨ on the matrix immediately above, giving 2βˆ’20129033012610.

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 π‘Ÿβ†’π‘Ÿβˆ’2π‘ŸοŠ©οŠ©οŠ§. 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 2βˆ’201290330βˆ’366βˆ’1βˆ’4.

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 𝑐≠0, 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 𝐴=263βˆ’1.

After obtaining the row-equivalent matrix 𝐴 by performing the following elementary row operations in order: π‘Ÿβ†’12π‘ŸοŠ§οŠ§, π‘Ÿβ†”π‘ŸοŠ§οŠ¨, π‘Ÿβ†’π‘Ÿβˆ’2π‘ŸοŠ§οŠ§οŠ¨, and π‘Ÿβ†’π‘Ÿβˆ’π‘ŸοŠ¨οŠ¨οŠ§, what is the determinant of 𝐴 in terms of the determinant of the row-equivalent matrix 𝐴?

Answer

We apply the first row operation π‘Ÿβ†’12π‘ŸοŠ§οŠ§ to obtain the row-equivalent matrix 𝐴=133βˆ’1.

Given that we have used an elementary row operation, we must keep track of the effect on the determinant. We implemented π‘Ÿβ†’12π‘ŸοŠ§οŠ§, which means that the determinant must be scale by the same number. In other words, |𝐴|=12|𝐴|. Next, we perform the row-swap operation π‘Ÿβ†”π‘ŸοŠ§οŠ¨, assigning this matrix to the previous variable 𝐴, giving 𝐴=3βˆ’113.

(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 |𝐴|=βˆ’12|𝐴|. The elementary row operation π‘Ÿβ†’π‘Ÿβˆ’2π‘ŸοŠ§οŠ§οŠ¨ does not incur any change in the determinant. Therefore, the matrix 𝐴=1βˆ’713 has the previous determinant relation 𝐴=βˆ’12|𝐴|. Likewise, the elementary row operation π‘Ÿβ†’π‘Ÿβˆ’π‘ŸοŠ¨οŠ¨οŠ§ also has no effect on the determinant, despite returning the matrix 𝐴=1βˆ’7010.

Overall, the relationship between the determinants of the two matrices is |𝐴|=βˆ’12|𝐴|. Rearranging this equation gives |𝐴|=βˆ’2|𝐴|.

We can check that the answer in the previous example is correct by examining the determinants of both matrices: 𝐴=263βˆ’1,𝐴=1βˆ’7010.

For the original matrix 𝐴, we could use the standard formula for the determinant of a 2Γ—2 matrix to calculate |𝐴|=||263βˆ’1||=2Γ—(βˆ’1)βˆ’6Γ—3=βˆ’20.

Applying the same method to the row-equivalent matrix 𝐴 gives |𝐴|=||1βˆ’7010||=1Γ—10βˆ’(βˆ’7)Γ—0=10.

This confirms the relationship we found in the previous example between the determinants: |𝐴|=βˆ’2|𝐴|.

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

Consider the matrix 𝐴=15βˆ’2201βˆ’120.

After obtaining the row-equivalent matrix 𝐴 by performing the following elementary row operations in order: π‘Ÿβ†’3π‘ŸοŠ¨οŠ¨, π‘Ÿβ†’βˆ’2π‘ŸοŠ§οŠ§, π‘Ÿβ†’π‘Ÿ+π‘ŸοŠ©οŠ©οŠ¨, π‘Ÿβ†”π‘ŸοŠ§οŠ©, and π‘Ÿβ†’π‘Ÿβˆ’2π‘ŸοŠ¨οŠ¨οŠ§, 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 π‘Ÿβ†’3π‘ŸοŠ¨οŠ¨. This gives the row-equivalent matrix 𝐴=15βˆ’2603βˆ’120.

Given that we have scaled one of the rows by the constant 3, we must keep a note that |𝐴|=3|𝐴|. We are asked to then perform another row-scaling operation: π‘Ÿβ†’βˆ’2π‘ŸοŠ§οŠ§. The new matrix is 𝐴=ο˜βˆ’2βˆ’104603βˆ’120 and we must update the relationship between the determinants, with the case now being that |𝐴|=(βˆ’2)Γ—3|𝐴|=βˆ’6|𝐴|. 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 𝐴=ο˜βˆ’2βˆ’104603523 therefore maintains the determinant relationship |𝐴|=βˆ’6|𝐴|. The row-swap operation incurs a sign change in the determinant. Using π‘Ÿβ†”π‘ŸοŠ§οŠ© to give the matrix 𝐴=523603βˆ’2βˆ’104 means that the determinant relationship must be modified to include a sign change, meaning that |𝐴|=6|𝐴|. The final row operation π‘Ÿβ†’π‘Ÿβˆ’2π‘ŸοŠ¨οŠ¨οŠ§ is again of the type that does not change the determinant. Therefore, the row-equivalent matrix 𝐴=523βˆ’4βˆ’4βˆ’3βˆ’2βˆ’104 has the determinant relationship |𝐴|=6|𝐴|. Rearranging the equation gives |𝐴|=16|𝐴|.

As with the previous question regarding a 2Γ—2 matrix, we can also check the example above by manually calculating the determinant. For this, we use Sarrus’ rule on both of the matrices: 𝐴=15βˆ’2201βˆ’120,𝐴=523βˆ’4βˆ’4βˆ’3βˆ’2βˆ’104.

For the original matrix 𝐴, we find |𝐴|=(1)Γ—||0120||βˆ’(5)Γ—||21βˆ’10||+(βˆ’2)Γ—||20βˆ’12||=+(1)Γ—(βˆ’2)βˆ’(5)Γ—(1)+(βˆ’2)Γ—(4)=βˆ’15.

Then, for the row-equivalent matrix 𝐴, Sarrus’ rule gives |𝐴|=(5)Γ—||βˆ’4βˆ’3βˆ’104||βˆ’(2)Γ—||βˆ’4βˆ’3βˆ’24||+(3)Γ—||βˆ’4βˆ’4βˆ’2βˆ’10||=+(5)Γ—(βˆ’46)βˆ’(2)Γ—(βˆ’22)+(3)Γ—(32)=βˆ’90.

As expected, we have confirmed the relationship given at the end of the previous question, namely, that |𝐴|=16|𝐴|.

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 𝐴=243βˆ’1.

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

Answer

Before using any row operations, we highlight the pivots in each row, which are the first nonzero entries: 𝐴=243βˆ’1.

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 π‘Ÿβ†’3π‘ŸοŠ§οŠ§ returns the row-equivalent matrix 𝐴=6123βˆ’1.

By scaling each entry in one of the rows by a nonzero constant, we have affected the determinant of the matrix such that |𝐴|=3|𝐴|. Now, we will use the row operation π‘Ÿβ†’2π‘ŸοŠ¨οŠ¨ to ensure that the two pivots have the same value: 𝐴=6126βˆ’2.

We have again altered the determinant such that |𝐴|=2Γ—3|𝐴|=6|𝐴|. 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 𝐴=6120βˆ’14 and there is no change to the determinant relationship |𝐴|=6|𝐴|. Alternatively (and more usefully), we can equivalently say that |𝐴|=16|𝐴|.

Now that 𝐴 is an upper-triangular matrix, the determinant |𝐴| is simply the product of the diagonal entries. In other words, we have |𝐴|=6Γ—(βˆ’14)=βˆ’84. Given that |𝐴|=16|𝐴|, we have |𝐴|=16Γ—(βˆ’84)=βˆ’14. 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 2Γ—2 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 3Γ—3 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 𝐴=13βˆ’6021142.

  1. Use elementary row operations to reduce the matrix into upper-triangular form.
  2. 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: 𝐴=13βˆ’6021142.

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 𝐴=13βˆ’6021018.

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 π‘Ÿβ†’π‘Ÿβˆ’12π‘ŸοŠ©οŠ©οŠ¨ provides the row-equivalent matrix 𝐴=⎑⎒⎒⎣13βˆ’602100152⎀βŽ₯βŽ₯⎦.

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 |𝐴|=1Γ—2Γ—152=15. Since |𝐴|=|𝐴|, we conclude that |𝐴|=15. 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 𝐴=ο˜βˆ’26βˆ’1βˆ’13βˆ’1βˆ’26βˆ’7.

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

Answer

We first highlight all of the pivot entries in the matrix 𝐴: 𝐴=ο˜βˆ’26βˆ’1βˆ’13βˆ’1βˆ’26βˆ’7.

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 𝐴=ο˜βˆ’13βˆ’1βˆ’26βˆ’1βˆ’26βˆ’7.

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 𝐴=1βˆ’31βˆ’26βˆ’1βˆ’26βˆ’7.

We have scaled one of the rows in the matrix by a constant, in this case the constant βˆ’1. 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 π‘Ÿβ†’π‘Ÿ+2π‘ŸοŠ¨οŠ¨οŠ§ and π‘Ÿβ†’π‘Ÿ+2π‘ŸοŠ©οŠ©οŠ§. This gives the matrix 𝐴=1βˆ’3100100βˆ’5.

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 |𝐴|=|𝐴|=0Γ—0Γ—(βˆ’5)=0.

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 𝐴=⎑⎒⎒⎣10360βˆ’105203βˆ’20241⎀βŽ₯βŽ₯⎦.

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

Answer

First, we highlight the pivots in each of the rows: 𝐴=⎑⎒⎒⎣10360βˆ’105203βˆ’20241⎀βŽ₯βŽ₯⎦.

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: π‘Ÿβ†’π‘Ÿβˆ’2π‘ŸοŠ©οŠ©οŠ§. This produces the row-equivalent matrix 𝐴=⎑⎒⎒⎣10360βˆ’10500βˆ’3βˆ’140241⎀βŽ₯βŽ₯⎦.

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 π‘Ÿβ†’π‘Ÿ+2π‘ŸοŠͺοŠͺ, giving 𝐴=⎑⎒⎒⎣10360βˆ’10500βˆ’3βˆ’1400411⎀βŽ₯βŽ₯⎦.

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: π‘Ÿβ†’π‘Ÿ+43π‘ŸοŠͺοŠͺ. The result is 𝐴=⎑⎒⎒⎒⎒⎣10360βˆ’10500βˆ’3βˆ’14000βˆ’233⎀βŽ₯βŽ₯βŽ₯βŽ₯⎦.

The matrix 𝐴 is now in upper-triangular form and hence the determinant is the product of all the diagonal entries. This means that |𝐴|=|𝐴|=1Γ—(βˆ’1)Γ—(βˆ’3)Γ—ο€Όβˆ’233=βˆ’23.

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 (π‘Ÿβ†’π‘π‘Ÿπ‘β‰ 0where) 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.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.