Details and Options
- MatrixRank works on both numerical and symbolic matrices.
- The rank of a matrix is the number of linearly independent rows or columns.
- MatrixRank[m,Modulus->n] finds the rank for integer matrices modulo n.
- MatrixRank[m,ZeroTest->test] evaluates test[m[[i,j]]] to determine whether matrix elements are zero. The default setting is ZeroTest->Automatic.
- MatrixRank[m,Tolerance->t] gives the minimum rank with each element in a numerical matrix assumed to be correct only to within tolerance t.
- MatrixRank works with sparse arrays.
Examplesopen allclose all
Basic Examples (1)
Find the number of linearly independent rows:
MatrixRank can handle rectangular matrices:
MatrixRank assumes all symbols to be independent:
MatrixRank for a machine‐number matrix:
Find the matrix rank for a complex‐valued matrix:
Find the rank of a sparse matrix:
The rank of a matrix depends on the modulus used:
With ordinary arithmetic, m has the full rank of 3:
With arithmetic modulo 5, the rank is only 2:
The setting of Tolerance can affect the estimated rank for numerical ill-conditioned matrices:
In exact arithmetic, m has full rank:
With machine arithmetic, the default is to consider elements that are too small as zero:
With zero tolerance, even small terms may be taken into account:
With a tolerance greater than the pivot in the middle row, the last two rows are considered zero:
Most but not all random 10×10 0–1 matrices have full rank:
Estimate the average rank of a random 10×10 0–1 matrix:
Find the ranks of coprimality arrays:
Properties & Relations (4)
MatrixRank[m] is equal to Length[SingularValueList[m]]:
MatrixRank[m] plus the dimension of the null space is equal to the number of columns of m:
The column and row rank of a matrix are equal:
The outer product of vectors has matrix rank 1:
Possible Issues (1)
MatrixRank may depend on the precision of the given matrix:
Use exact arithmetic to compute the matrix rank exactly:
Use machine arithmetic. Machine numbers cannot distinguish between and :
Use 24‐digit-precision arithmetic:
Introduced in 2003
Updated in 2007