What is the rank of a matrix?
The rank of a matrix A is the maximum number of linearly independent column vectors it contains, which is always equal to the maximum number of linearly independent row vectors. Geometrically it is the dimension of the space spanned by the rows (or columns) of A. This is a universal concept in linear algebra and does not depend on any region or convention. In Japanese the same idea is called the matrix rank, written "kaisuu".
How to use this calculator
Set the number of rows (m) and columns (n), then type the matrix entries row by row in the text box. Separate values within a row with commas or spaces, and separate rows with new lines or semicolons. The display-precision dropdown only controls how working precision is shown; it does not change the mathematical rank for ordinary inputs. Click calculate and the tool reports the rank along with the matrix shape and whether the matrix has full rank.
The formula and method
The calculator reduces A to row-echelon form using Gaussian elimination with partial pivoting. Starting with rank = 0, it scans each column; in each column it picks the candidate row with the largest absolute value (for numerical stability), and if that value exceeds a small tolerance it uses that row as a pivot, eliminates the column from all other rows, and increases the rank by one. If a whole column has only near-zero candidates it contributes no pivot. The final count of pivots is the rank, which always satisfies \(0 \le \text{rank} \le \min(m, n)\).
$$\text{rank}(A) = \dim\!\big(\text{span of pivot rows of }\text{Matrix }A\big) \le \min\!\left(m,\; n\right)$$$$\text{rank}(A) = \#\{\text{nonzero pivots in REF}(A)\}$$$$\text{where}\quad \left\{ \begin{aligned} A &= \text{Matrix entries} \;(m \times n) \\ \text{tol} &= 10^{-12}\cdot \max_{i,j}\lvert a_{ij}\rvert \\ \text{rank}(A) &\le \min(m,\, n) \end{aligned} \right.$$
Worked example
Take \(A = [[1, 2, 3], [2, 4, 6], [1, 0, 1]]\). Row 2 equals 2 times row 1, so those two rows are dependent. After elimination only two nonzero pivot rows remain, giving rank = 2. By contrast the 3 x 3 identity matrix yields three pivots and rank 3, and any all-zero matrix has rank 0.
FAQ
Can the rank exceed the number of rows or columns? No. The rank can never be larger than \(\min(m, n)\).
What does full rank mean? A matrix has full rank when its rank equals \(\min(m, n)\). For a square matrix this means it is invertible and its determinant is nonzero.
Why use the largest pivot? Partial pivoting avoids dividing by tiny numbers, which keeps floating-point round-off small and the rank count reliable.