Explainer: Rank of a Matrix

In this explainer, we will learn how to find the rank and nullity of a matrix.

The β€œrank” of a matrix is one of the most fundamental and useful properties of a matrix that can be calculated. In many senses, the rank of a matrix can be viewed as a measure of how much indispensable information is encoded by the matrix. As an example, we consider the following simple system of linear equations: π‘₯+2𝑦=5,3π‘₯+6𝑦=15.

Notice how the second equation is essentially identical to the first equation, other than for a multiplication by 3. Moreover, we can multiply the second equation by a constant factor of 13 without changing any of the properties: π‘₯+2𝑦=5,π‘₯+2𝑦=5.

If we were looking to solve this system of linear equations, then the second equation does not give us any extra information if we already know the first equation. In this sense, only the first equation is indispensable and the second equation is totally redundant and does not need to be written down.

When working with a system of linear equations, it is entirely possible that there is one or more redundant equations. Take, for example, the linear system of equations 3π‘₯+π‘¦βˆ’π‘§=2,βˆ’6π‘₯βˆ’2𝑦+2𝑧=βˆ’4,βˆ’3π‘₯βˆ’π‘¦+𝑧=βˆ’2.

Just like the previous example, the second equation is a copy of the first equation but, in this case, after a multiplication by βˆ’2. Therefore, the second equation offers no extra information and is redundant. Even worse, the third equation can be obtained from adding together the second and third equations. Therefore, the third equation is also redundant and only the first equation is indispensable.

One good way of thinking about the β€œrank” of a matrix is that it measures the number of indispensable equations in the corresponding system of linear equations. There are other, more abstract ways of understanding the rank of a matrix without needing to refer to a system of linear equations, although these will be covered in another explainer. Before showing how to calculate the rank of a matrix, we first need to define several key concepts.

Definition: Echelon Form

A matrix 𝐴 is said to be in β€œechelon form” or β€œrow echelon form” if the following two criteria are met:

  • All zero rows are below all nonzero rows.
  • The pivot of a nonzero row appears to the right of the pivot in all the rows above it.

The echelon form of a matrix is a vital idea that was first introduced when mathematicians were looking to find general methods for solving systems of linear equations. This definition is used to subsequently define the β€œreduced echelon form” of a matrix, which we will not describe in this explainer but is of vital importance nonetheless.

Consider the matrix ⎑⎒⎒⎣02βˆ’234βˆ’36βˆ’1650000000011⎀βŽ₯βŽ₯⎦.

We will take the first criterion of echelon form. The third row of this matrix is a zero row, which is not below the nonzero fourth row. Therefore, this matrix cannot meet the first criterion and so it is not in echelon form. However, if we had been given the matrix ⎑⎒⎒⎣02βˆ’234βˆ’36βˆ’1650001100000⎀βŽ₯βŽ₯⎦, then the zero row would have been below all other zero rows and hence would have satisfied the first criterion.

Now we consider the second criterion. The β€œpivot” of a row is the first nonzero entry of that row, which is also sometimes referred to as the β€œleading coefficient” of that row. We highlight the pivots in the matrix immediately above: ⎑⎒⎒⎣02βˆ’234βˆ’36βˆ’1650001100000⎀βŽ₯βŽ₯⎦.

The second criterion of echelon specifies that all pivots must appear to the right of any pivots in the row above. This is clearly not the case in our matrix, given that the pivot in the second row appears to the left of the pivot in the row above. If we had instead been given the matrix βŽ‘βŽ’βŽ’βŽ£βˆ’36βˆ’16502βˆ’2340001100000⎀βŽ₯βŽ₯⎦, then every pivot is to the right of the pivots in the rows above. This new matrix satisfies both criteria of the echelon form.

Definition: Rank of a Matrix

When in echelon form, the β€œrank” of a matrix 𝐴 is the number of nonzero rows. Normally, this is denoted as rank(𝐴).

There are a couple of points which follow from this definition that are worth discussing. First, the rank of a matrix counts the number of nonzero rows in that matrix. Quite naturally, that means that the rank of a matrix must be less than or equal to the number of rows in that matrix.

The second point arising from the above definition of the rank of a matrix is that, clearly, not every matrix is in echelon form, which means that our definition of the rank would not apply. In this case, we would ask ourselves the following question: How do we calculate the rank of a matrix if it is not already in echelon form? To answer this question, we will need one further definition and one further theorem.

Definition: Elementary Row Operations

For any matrix 𝐴 of order π‘šΓ—π‘›, the three β€œelementary row operations” are as follows:

  • switching of row 𝑖 with row 𝑗, denoted π‘Ÿπ‘–β†”π‘Ÿπ‘—;
  • multiplication of a single row 𝑖 by a nonzero constant 𝑐, denoted π‘Ÿπ‘–β†’π‘π‘Ÿπ‘–;
  • a constant multiple 𝑐 of a row 𝑗 added to π‘Ÿπ‘–, denoted π‘Ÿπ‘–β†’π‘Ÿπ‘–+π‘π‘Ÿπ‘—.

These three row operations are the key ingredients for taking a matrix and manipulating it into either echelon form or reduced echelon form, using a general and powerful technique known as Gauss–Jordan elimination. This is the approach that we will take when trying to understand the rank of a matrix, although we will not detail the full Gauss–Jordan method. We are nearly ready to begin calculating the rank for general matrices, but first we need one final theorem.

Theorem: The Rank of a Matrix and Elementary Row Operations

The rank of a matrix 𝐴 is unaffected by the elementary row operations.

We will not provide a proof in this explainer, but we will instead assume that this is true and begin applying the result to aid our calculations of the matrix rank. In each of the following examples, our aim will be to take the given matrix and use elementary row operations to force this matrix into echelon form. With the knowledge that the elementary row operations do not change the rank of a matrix, we can then simply count the number of nonzero rows.

Example 1: Rank of a 2 Γ— 2 Matrix

Find the rank of the matrix 224448.

Answer

We label the matrix as 𝐴=224448.

This second row of 𝐴 is a copy of the first row after a multiplication by 2. We, therefore, perform the row operation π‘Ÿ2β†’π‘Ÿ2βˆ’2π‘Ÿ1, which gives the matrix 22400.

The second row is a zero row and appears below all nonzero rows, meeting the first criteria of echelon form. The pivot of each row is the first nonzero entry, as highlighted: 22400.

The second criterion of echelon form is that all pivots appear to the right of all pivots in the rows above. Since the highlighted entry is the only pivot in this matrix, this criterion is satisfied.

This matrix is in echelon form and has 1 nonzero row, which means that the rank of this matrix is 1. Since we only performed elementary row operations to move from 𝐴 to the matrix above, we know that 𝐴 shares this rank, and hence rank(𝐴)=1.

A decent guideline for how to approach the calculation of an echelon form is to continuously highlight all pivots in the matrix of interest. This draws the eye and can provide a steer as to which elementary row operations should be performed. We will demonstrate the utility of this approach in the following examples. Unlike the reduced echelon form of a matrix, which is unique, there are infinitely many possible echelon forms. Our echelon form of 𝐴 is likely to be entirely different to an echelon form produced using an alternative approach.

Example 2: Finding the Rank of a Matrix

Find the rank of the matrix ⎑⎒⎒⎣100411210020⎀βŽ₯βŽ₯⎦.

Answer

We label the matrix as 𝐴=⎑⎒⎒⎣100411210020⎀βŽ₯βŽ₯⎦.

This matrix is certainly not in echelon form! First, we highlight all the pivots of the matrix: 𝐴=⎑⎒⎒⎣100411210020⎀βŽ₯βŽ₯⎦.

The pivots in the second and third rows are not to the right of the pivots in the first row, so this matrix is definitely not in echelon form, meaning that we must perform elementary row operations to achieve this. We begin by trying to secure as many zeros as possible in the first column. There is already a pivot in the top left, so we will do our best to leave this entry alone, producing zeros in the remaining entries of the first column. This can be achieved by the elementary row operations π‘Ÿ2β†’π‘Ÿ2βˆ’4π‘Ÿ1 and π‘Ÿ3β†’π‘Ÿ3βˆ’2π‘Ÿ1, with the result being as follows: ⎑⎒⎒⎣100011010020⎀βŽ₯βŽ₯⎦.

The pivot in the top left entry is now the only nonzero entry in the first column. The remaining pivots have been highlighted, with the pivots in the second, third, and fourth rows being to the right of the pivot in the first row. Unfortunately, the pivots in the third and fourth rows are not to the right of all pivots in the row above, which means that we must continue performing elementary row operations.

Now we see that the fourth row is just a copy of the third row after a multiplication by 2. The elementary row operation π‘Ÿ4β†’π‘Ÿ4βˆ’2π‘Ÿ3 gives the matrix ⎑⎒⎒⎣100011010000⎀βŽ₯βŽ₯⎦.

We have a zero row at the bottom of this matrix and we will endeavor to leave this row unchanged. However, the pivot in the third row is not to the right of all pivots in the rows above, so we have not quite yet obtained an echelon form. We must find a way of removing the pivot in the third row in order to meet the second criterion of echelon form. This can be achieved by the row operation π‘Ÿ3β†’π‘Ÿ3βˆ’π‘Ÿ2, which gives a much more agreeable structure of pivots: ⎑⎒⎒⎣10001100βˆ’1000⎀βŽ₯βŽ₯⎦.

Now every pivot is to the right of all the pivots in the rows above it, and the only zero row is at the bottom of the matrix. Therefore, this matrix is in echelon form. Given that there are three nonzero rows, the rank of this matrix is 3. We have only used elementary row operations to change the matrix 𝐴 into the matrix directly above. The rank of the original matrix 𝐴 is equal to the rank of the matrix above, meaning that rank(𝐴)=3.

Example 3: Finding the Rank of a Matrix

Find the rank of the matrix ⎑⎒⎒⎣120321210021⎀βŽ₯βŽ₯⎦.

Answer

We begin by defining the following matrix and highlighting the pivots: 𝐴=⎑⎒⎒⎣120321210021⎀βŽ₯βŽ₯⎦.

The pivots in the second and third rows are not to the right of the pivot in the first row. Therefore, we need to remove these nonzero entries in the first column. The obvious choice of elementary row operations is π‘Ÿ2β†’π‘Ÿ2βˆ’3π‘Ÿ1 and π‘Ÿ3β†’π‘Ÿ3βˆ’2π‘Ÿ1, giving the matrix ⎑⎒⎒⎣1200βˆ’410βˆ’30021⎀βŽ₯βŽ₯⎦, where we have highlighted the pivots. The pivots in the third and fourth rows are not to the right of all pivots in the rows above, so this matrix is not in echelon form. There are many possible approaches for remedying this situation, and we choose the method that is arguably the most direct, which is by immediately removing the pivots in the third and fourth rows with the elementary row operations π‘Ÿ3β†’π‘Ÿ3βˆ’34π‘Ÿ2 and π‘Ÿ4β†’π‘Ÿ4+12π‘Ÿ2. This gives the matrix ⎑⎒⎒⎒⎒⎒⎣1200βˆ’4100βˆ’340032⎀βŽ₯βŽ₯βŽ₯βŽ₯βŽ₯⎦.

There is only one remaining obstruction to the matrix above being in echelon form, and that is the pivot in the fourth column, which is not to the right of all pivots in the columns above. We perform the row operation π‘Ÿ4β†’π‘Ÿ4+2π‘Ÿ3 to get ⎑⎒⎒⎒⎒⎣1200βˆ’4100βˆ’34000⎀βŽ₯βŽ₯βŽ₯βŽ₯⎦.

The only zero row is at the bottom of the matrix and the pivots are all to the right of every pivot in the rows above. Therefore, this matrix is now in echelon form. Due to the presence of three nonzero rows, the rank of this matrix is 3. Given that we used only row elementary operations to transform from the original matrix 𝐴 to the matrix immediately above, we conclude that rank(𝐴)=3.

In the final example, we will give a matrix which has a larger number of rows and columns that we will then manipulate into an echelon form. With computations such as these, it is very easy to make an arithmetic error due to the large number of calculations that are involved. The example below is convenient in that the necessary elementary row operations are all easy to determine and do not introduce any fractions into the calculations. However, this will certainly not always be the case, and we should be wary that any error in calculation is likely to proliferate through the remaining calculations, causing the final outcome to be radically different from the correct solution.

Example 4: Rank of a Matrix

Find the rank of the matrix ⎑⎒⎒⎣0102010032605401120220214032⎀βŽ₯βŽ₯⎦.

Answer

We define the following matrix and highlight the pivot entries: 𝐴=⎑⎒⎒⎣0102010032605401120220214032⎀βŽ₯βŽ₯⎦.

The pivots are all in the second column, which means that this matrix is not in echelon form, which requires all pivots to be to the right of every pivot in the rows above. We will eliminate the pivots in the second, third, and fourth rows using the elementary row operations π‘Ÿ2β†’π‘Ÿ2βˆ’3π‘Ÿ1, π‘Ÿ3β†’π‘Ÿ3βˆ’π‘Ÿ1, and π‘Ÿ4β†’π‘Ÿ4βˆ’2π‘Ÿ1. The subsequent matrix is ⎑⎒⎒⎣0102010002002400100120010012⎀βŽ₯βŽ₯⎦, where the pivots have been highlighted. Before thinking any further about the pivots, we note that the fourth row is identical to the third row. We can quickly turn the fourth row into a zero row using the elementary row operation π‘Ÿ4β†’π‘Ÿ4βˆ’π‘Ÿ3. This gives the matrix ⎑⎒⎒⎣0102010002002400100120000000⎀βŽ₯βŽ₯⎦.

The third row is a copy of the second row, except for a scaling by a factor of 2. The row operation π‘Ÿ3β†’π‘Ÿ3βˆ’12π‘Ÿ2 then produces the matrix ⎑⎒⎒⎣0102010002002400000000000000⎀βŽ₯βŽ₯⎦.

There are now two zero rows which are at the bottom of the matrix, and the pivot in the second row is to the right of the pivot in the first row. This means that the matrix is in echelon form and, given that it has two nonzero rows, its rank is 2. Since we used only elementary row operations to transform the matrix 𝐴 into the matrix immediately above, the two matrices will have the same rank, and hence rank(𝐴)=2.

Unless a given matrix is already in echelon form, the rank of the matrix is usually not obvious upon first inspection. This means that normally we would have to perform (at least part of) the famed Gauss–Jordan elimination, as we did above. Mastering the technique of Gauss–Jordan elimination is arguably the single most important prerequisite for being able to compute the rank of a matrix. A related topic to the rank of a matrix is the β€œnullity” or β€œnull space” of a matrix, which is a quantity that counts the number of zero rows of a matrix in echelon form (rather than the number of nonzero rows, which is counted by the rank). These two concepts are used ubiquitously when studying linear algebra from a more abstract perspective, meaning that an understanding of their properties is essential.

Key Points

  • The pivots of matrix are the first nonzero entries of each row. These are sometimes referred to as the β€œleading coefficients.”
  • Highlighting the pivots is normally very useful when attempting to perform Gauss–Jordan elimination or when performing elementary row operations in a general sense.
  • A matrix is in echelon form if all zero rows are below all nonzero rows and if all pivots are to the right of any pivot in a row above.
  • If a matrix is in echelon form, then the rank is the number of nonzero rows.
  • The rank of a matrix is unchanged by elementary row operations.

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