🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
MATHEMATICS

Matrix Rank Calculator — pivots, rank and nullity

Reduce any matrix, count the pivots, and get the rank and nullity together with the rank-nullity relationship that connects them.

One row per line, entries separated by spaces or commas. Rows and columns need not match; up to 8 by 8.
Entries below the tolerance count as zero. Raise it for measured data, where a pivot of one millionth is noise rather than structure.
Rank of the matrix
 
Matrix size
Nullity
Left nullity
Full rank?
 
Tip: rank counts how many rows carry genuinely new information. Duplicated rows, scaled copies and sums of other rows all add height to a matrix without adding rank.
Advertisement

The rank of a matrix is the number of linearly independent rows it contains, which is also the number of linearly independent columns, which is also the number of pivots left after row reduction. Those three descriptions always agree, and that agreement is one of the genuinely surprising results in linear algebra. This matrix rank calculator reduces any matrix, rectangular or square, counts the pivots, and reports the rank alongside the nullity and the left nullity so that the four fundamental subspace dimensions are all visible at once.

Arb Digital built the page to answer one question cleanly — how much independent information is in this matrix — and to state the rank-nullity relationship explicitly, because that relationship is what makes the number useful. Rank on its own is a count. Rank plus the number of columns tells you the dimension of the solution space of the homogeneous system, which is a statement about how many solutions a system of equations has.

What This Matrix Rank Calculator Does

It reads a matrix of any shape up to 8 by 8, performs Gaussian elimination with partial pivoting, and counts the rows that end up with a leading non-zero entry. That count is the rank. From it the tool derives the nullity, which is the number of columns minus the rank, and the left nullity, which is the number of rows minus the rank. It also names the pivot columns, since those identify which columns form a basis for the column space.

Four pages on this site touch the same elimination, and each stops at a different point. This one counts pivots and stops. Our row echelon form calculator returns the reduced matrix itself, which is what you need when the working has to be shown. Our null space calculator continues past the count to produce an actual basis for the kernel. Our linear independence calculator asks the yes-or-no question about a specific set of vectors rather than reporting a dimension. Use whichever matches the question you were asked.

How to Use It

  1. Enter the matrix one row per line. Every row must have the same number of entries, but the matrix does not have to be square.
  2. Leave the tolerance alone for exact numbers. The default treats anything below one billionth as zero, which is correct for values you typed.
  3. Raise the tolerance for measured data. Real measurements carry noise, and a pivot of 10⁻⁶ in that context is a zero that rounding has disguised.
  4. Read the pivot column list. Those columns of the original matrix form a basis for its column space, which is often what a question is really asking for.
  5. Check the rank-nullity line. Rank plus nullity always equals the number of columns, and it is the fastest sanity check on any hand calculation.

The Method and How It's Calculated

Take the default matrix. Row two is exactly twice row one, so subtracting twice row one from row two produces a row of zeros. Row three minus row one gives 0, −1, −2, −3, which has a leading entry in column two. Elimination ends with two non-zero rows, so the rank is 2. The matrix has four columns, so the nullity is 4 − 2 = 2, and three rows, so the left nullity is 3 − 2 = 1.

The algorithm is the same elimination used everywhere else on this site. Work through the columns left to right; in each column look below the current row for the entry of largest magnitude, swap it up, and use it to clear everything beneath. If a whole column has nothing above the tolerance, no pivot exists there and the algorithm moves to the next column without advancing the row. The number of times a pivot was found is the rank.

Partial pivoting is not decoration here. Choosing the largest available entry keeps the multipliers small, which prevents a genuine pivot from being wiped out by accumulated rounding and then miscounted as a zero. The equivalence of row rank, column rank and pivot count, and the elimination that establishes it, is set out in the MIT OpenCourseWare 18.06SC Linear Algebra course.

Advertisement

Rank-Nullity Is the Reason the Number Matters

For a matrix with n columns, rank + nullity = n. Read as a statement about linear maps it says something concrete: a matrix takes n-dimensional space somewhere, the rank is the dimension of where it lands, and the nullity is the dimension of what it crushes to zero. Nothing is lost — every dimension of the input either survives into the image or disappears into the kernel.

That immediately answers questions about solutions. The homogeneous system Ax = 0 has a solution space of dimension exactly the nullity. If the nullity is zero the only solution is x = 0. If the nullity is 2, as in the default matrix, the solutions form a two-dimensional plane through the origin and there are infinitely many. No amount of staring at the original matrix reveals this; the rank calculation does it in one step.

For non-homogeneous systems the same count governs uniqueness. If a solution to Ax = b exists at all, the full solution set is one particular solution plus the entire null space. So the number of free parameters in the general solution equals the nullity. Our system of equations calculator produces the particular solution, and our null space calculator produces the basis for the rest.

Row Rank Equals Column Rank

The claim that the number of independent rows equals the number of independent columns is not obvious and deserves a moment. The rows of a 3 by 7 matrix live in seven-dimensional space and the columns live in three-dimensional space; they are not the same objects and they need not even have the same maximum possible count. Yet the two independence counts always coincide.

The reason is that row operations change the rows but preserve the linear relationships among the columns. If column three was the sum of columns one and two before elimination, it still is afterwards. So the number of independent columns survives the reduction unchanged, and in echelon form the independent columns are exactly the pivot ones — which is also the number of non-zero rows. The two counts are forced to agree.

One practical consequence: rank can never exceed the smaller of the row count and the column count. A 3 by 7 matrix has rank at most 3, however carefully its 21 entries are chosen. A matrix that attains this bound is said to have full rank, and the tool reports whether yours does. The parallel development of row space, column space and rank appears in the Matrix Algebra for Engineers notes.

What Rank Tells You About a System of Equations

Write a system as Ax = b and form the augmented matrix by attaching b as an extra column. Compare the rank of A with the rank of the augmented matrix. If they differ, the system is inconsistent and has no solution at all — the extra column has introduced a direction the original columns cannot reach, which in row terms shows up as a row reading 0 = 1.

If the two ranks agree, solutions exist. Whether there is one or infinitely many then depends on the nullity. Rank equal to the number of unknowns means nullity zero and a unique solution. Rank less than the number of unknowns means free variables and an infinite family. That is the entire solvability theory for linear systems, and it is nothing more than two rank calculations.

For a square matrix this collapses into the familiar test. Full rank means invertible, non-zero determinant, unique solution. Deficient rank means singular, zero determinant, and either no solution or infinitely many. The determinant answers the question with a single number on our determinant calculator, but only for square matrices, and it says nothing about how far short of full rank a deficient matrix falls. Rank does.

Rank in Practice: When the Answer Is Not an Integer

Textbook matrices have exact entries and unambiguous ranks. Data matrices do not. Two columns of a spreadsheet that are theoretically proportional will differ in the sixth decimal place because of measurement noise, and strict elimination will find a tiny non-zero pivot and report full rank for a matrix that is effectively rank deficient.

This is why the tolerance field exists. Setting it to something like 10⁻⁶ instead of 10⁻⁹ tells the algorithm to treat anything below that as noise. The right value depends on the precision of your measurements and on the scale of the entries, and there is no universal answer — which is precisely why serious numerical work uses the singular value decomposition instead, where the numerical rank is read off a list of singular values and the gap between the significant ones and the negligible ones is visible.

The applied name for near-deficient rank is multicollinearity, and it is the reason a regression can have a good overall fit while every individual coefficient is unstable. If two predictors are nearly proportional, the data cannot separate their effects and the fitted coefficients swing wildly with tiny changes in the sample. Checking the rank of the predictor matrix before fitting is a two-minute test that explains a great many confusing regression outputs from our linear regression calculator.

Rank Under Multiplication and Transposition

Rank is unchanged by transposition, which is another way of saying row rank equals column rank. It is also unchanged by multiplying on either side by an invertible matrix, since an invertible matrix cannot collapse any direction and therefore cannot destroy independence. That is why row operations, which are exactly left multiplication by invertible matrices, leave the rank alone.

For a product, rank can only fall: rank(AB) is at most the smaller of rank(A) and rank(B). This makes intuitive sense, since applying two maps in succession cannot recover anything the first one already crushed. It has a sharp practical use — multiplying a 100 by 3 matrix by a 3 by 100 matrix gives a 100 by 100 matrix whose rank is at most 3, which is the entire basis of low-rank approximation in data compression and recommender systems.

Finally, a matrix and its factors share rank information. In an LU factorisation the number of non-zero pivots in U is the rank of the original matrix, so the rank falls out of the work our LU decomposition calculator is doing anyway, and the same count decides whether an inverse exists on our matrix inverse calculator.

Data models that do not fall over?

Arb Digital checks for collinearity and rank deficiency before fitting anything, so a coefficient you rely on is one the data can actually support.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Counting rows instead of pivots — a matrix with ten rows can have rank two, because duplicated and dependent rows add height without adding independence.
  • Assuming rank equals the smaller dimension — that is the maximum possible rank, not the actual one, and dependence can push it well below.
  • Using a determinant to measure rank deficiency — a zero determinant tells you the rank is below full but not by how much, and it exists only for square matrices.
  • Trusting a tiny pivot in measured data — noise routinely produces pivots around 10⁻⁷, which inflate the rank and hide genuine collinearity.
  • Forgetting to check the augmented rank — a consistent system needs the rank of A and of [A | b] to match, and comparing only one of them says nothing about solvability.

Related Free Tools From Arb Digital

See the reduced matrix itself with the row echelon form calculator, get an actual kernel basis from the null space calculator, test a specific set of vectors with the linear independence calculator, check invertibility in one number with the determinant calculator, or factor the matrix with the LU decomposition calculator. The full free online tools hub lists every mathematics tool we publish.

Frequently Asked Questions

What does the rank of a matrix actually measure?

It counts how many rows, or equivalently how many columns, carry independent information. Rows that are copies, multiples or sums of other rows add nothing to the rank however many of them there are.

How are rank and nullity related?

Rank plus nullity equals the number of columns. Every dimension of the input space either survives into the image of the matrix or is collapsed into its null space, and nothing is unaccounted for.

Why does row rank always equal column rank?

Because row operations change the rows but leave the linear relationships among the columns untouched. In echelon form the independent columns are the pivot ones, which is also the number of non-zero rows.

What is full rank?

A matrix has full rank when its rank equals the smaller of its row count and column count, which is the largest value the rank could possibly take. For a square matrix that is the same as being invertible.

Can a rectangular matrix have a rank?

Yes. Rank is defined for any shape, unlike the determinant, which needs a square matrix. A 3 by 7 matrix has a rank of at most 3, since rank cannot exceed either dimension.

How does rank determine the number of solutions?

If the rank of the coefficient matrix differs from the rank of the augmented matrix there are no solutions. If they agree, the solution is unique when the rank equals the number of unknowns and infinite otherwise.

Why does the tolerance setting change my answer?

Because elimination on noisy data produces very small non-zero pivots that are really rounding artefacts. The tolerance is the size below which a pivot is treated as a genuine zero rather than counted.

This page explains a mathematical method for study and for checking your own working. It is not a substitute for showing your method, and it is not medical, legal, or financial advice.

Advertisement
Advertisement

Take it further