Rank of a matrix
The rank of a matrix is a number that represents the number of independent rows or columns of the matrix.
Definition
The rank of a matrix is the maximum number of linearly independent rows or columns in the matrix. The zero matrix has rank zero, and every other matrix has rank at least one. An m × n matrix can have rank at most min(m, n). So if a matrix has fewer rows than columns, its rank is at most the number of rows. Similarly for columns.
We usually denote the rank of a matrix by the word “rank”. We then write rank(A) = x.
How to work out the rank
Now, how do we work out the rank of a matrix? It is quite simple. You have to transform the matrix into a form in which it is clear which rows are linearly independent. This is most often done by reducing the matrix to row echelon form (all zeros below the diagonal), and then you can see how the matrix stands. Here goes, then, with an example. We have this matrix:
and we are asked to find its rank. First we need to realise one small thing. If we have two rows full of non-zero numbers, they could in theory be linearly dependent, and we would have to work it out. But if one of those rows has a zero in some position while the other row has no zero in the same position, we can say for certain that they are not dependent. There is no number we could multiply that zero (and so the whole row) by to get the same number as in the other row. That is why we always try to reduce matrices to row echelon form, so that we get those zeros in place.
We can write the previous paragraph like this. If α1, α2 ≠ 0, then:
So we try to get the matrix into a similar form, so that we can easily see the dependences. Look at this example:
This matrix is in row echelon form, and no rows are linearly dependent. You cannot express the third row using the first two, because if the coefficients alpha are non-zero, some non-zero number will always be left in the first positions.
The procedure usually goes like this: first we get zeros in the first column (except in the first row). Then we carry on transforming the matrix to get zeros in the second column, then the third, and so on and so on until we finally have row echelon form. Count the non-zero rows and, lo and behold, you have the rank of the matrix. We can use these operations without changing the rank of the matrix:
- Swap any two rows.
- Multiply a row by any non-zero expression.
- Add one row to another.
- All of the above operations can also be applied to columns.
Example
In our matrix above, we will carry out the operations like this. We look at the relationship between the entries a11 and a21. They are the same, so to get a zero in the position of a21 we have to add −1 times the first row. We add −1 times the first row to the second row (in other words, we subtract the first row from the second row):
Now we have a zero where we wanted one. Next we need to get a zero in the position a31. There is a one there again, so we just subtract the first row:
Now we have zeros in the first column, so we can tackle the second column with gusto. We can see that a22 and a32 are negatives of each other, so it is enough to add the rows:
And we have ended up with one zero row. The operations are finished, and we have reached row echelon form. Now we just count the non-zero rows and we have the rank. It is rank(A) = 2. This matrix had rank two.
Second example
Now let’s try to work out the rank of a slightly bigger matrix:
The rank of a matrix is the maximum number of linearly independent rows, so we can shuffle the rows of the matrix around however we like. Here it would help to have a row starting with a one right at the top, to make the calculation easier. So we can safely swap the first and second rows:
Now we proceed as in the previous example. We need zeros throughout the first column (except in the first row, of course), so we add −7 times the first row to the second row, −4 times the first row to the third, and −2 times the first row to the last. The first row stays unchanged:
Again we swap rows. This time we should put the last row in place of the second row, because of the 2 in the second position. We swap the second and fourth rows:
But we can see that below the 2 we have the numbers −17 and −19. Neither of them is divisible by two, which is rather awkward, even nasty. So we now multiply the third and fourth rows by two:
Now we can continue with the operations and try to clear the second column. We add 17 times the second row to the third row and 19 times the second row to the fourth:
Well, now we have some rather awkward numbers for the next step, but we will manage somehow. We divide the third row by −38:
And now we multiply the third row by 60 and add it to the fourth row:
We got an ugly number, but it is not zero. So the matrix has rank four, and it contains no linearly dependent row.
Example with a parameter
What is the rank of the matrix A, depending on the parameter q?
This is a slightly harder problem, because it contains a parameter q. We have to find for which values of q the matrix has maximum rank, if any, and for which values it has a lower rank. We proceed in the usual way, except that now and then, instead of specific values, we work with the abstract q. In the first step we move the parameter q to a nicer place, namely the bottom right corner. So we swap the second row with the third and then the first column with the last:
Now the parameter is in a convenient place where it will not get in the way much. But the first column has some rather awkward numbers, although there is a one right in the middle. We move it to the top left, that is, we swap the first and second rows and the first and second columns:
Now that is a nice matrix. We multiply the first row by −8 and add it to the second row:
We multiply the first row by −5 and add it to the third row:
Good, the first column is as we need it. Now we add −1 times the second row to the third row:
And that is the end of the operations. We can see that the first and second rows are certainly linearly independent. But the third row may be linearly dependent. The row will be linearly dependent if it is entirely zero, that is, if we choose the parameter q so that the expression q + 11 equals zero. Clearly, if q = −11, the row is zero and so it is linearly dependent.
So the final verdict: for q = −11 the matrix has rank two, and otherwise it has rank three.