Search⌘ K
AI Features

Rank of a Matrix

Explore the concept of matrix rank, which measures the number of linearly independent rows or columns. Understand how rank relates to solving linear systems, full row and column rank, and the rank of matrix products. Learn to calculate rank using Python and grasp fundamental properties essential for data science.

Rank

The rank of a matrix AA, denoted by r(A)r(A), is defined as the number of linearly independent rows of AA.

By definition, a coefficient matrix, AA, represents a linearly independent system of r(A)r(A) equations. The number of linearly independent rows is called row rank, and the number of linearly independent columns is called column rank. However, because row rank is always equal to column rank, these terms are seldom used. Instead, we simply refer to them as rank.

Calculating rank through Python

The following Python code calculates the rank of a matrix.

Python 3.8
import numpy as np
mat = np.array([[2, 3, -4, 7],
[1, 6, -5, 1],
[-2, 1, 10, -4]])
print(mat)
rank = np.linalg.matrix_rank(mat)
print("The rank of the matrix is", rank)

Rank and rrefrref

The rank of a matrix, AA, equals the number of pivots in the rrefrref of AA."

This follows from our previous discussion on linearly dependent rows in rrefrref. All linearly dependent rows are converted into all-zero rows in rrefrref, and we’re left with only the linearly independent rows as the nonzero rows. Each nonzero row in ...