🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
MATHEMATICS

Null Space Calculator — a real basis, not just a dimension

Get an explicit basis for the null space of any matrix, the nullity, the column space basis, and the rank-nullity relationship that ties them together.

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 are treated as zero. Raise it for measured data, where a pivot of one millionth is noise rather than structure.
Basis for the null space
 
Nullity
Rank
Matrix size
Worst entry of A·v
 
Tip: the null space is never empty. It always contains the zero vector, so the meaningful question is whether it contains anything else — which is exactly what the nullity tells you.
Advertisement

The null space of a matrix A, also called its kernel, is the set of all vectors x satisfying Ax = 0. It is the collection of directions the matrix flattens to nothing. This null space calculator reduces the matrix to reduced row echelon form, identifies the pivot and free columns, and constructs an explicit basis vector for each free column — an actual list of numbers you can substitute back and check, rather than a dimension count.

Arb Digital built the page to return a basis because that is what the question usually needs. Knowing the nullity is 2 tells you the solution set is a plane; it does not let you write down a solution. The basis does, and it also makes the rank-nullity theorem concrete: the number of basis vectors is the number of columns minus the rank, and you can see both counts on the same screen.

What This Null Space Calculator Does

It performs Gauss-Jordan elimination to reduced row echelon form, where every pivot is 1 and is the only non-zero entry in its column. Columns containing a pivot are pivot columns; the rest are free. For each free column the tool builds a basis vector by setting that free variable to 1, all other free variables to 0, and solving for the pivot variables from the reduced rows. The result is a set of vectors that are automatically linearly independent and that span the whole null space.

Alongside the basis it reports the nullity, the rank, the pivot and free column numbers, a basis for the column space, and a verification figure: the largest entry of A multiplied by each basis vector, which must be zero. That check is worth reading, since it is the only direct evidence that the vectors returned really do solve Ax = 0.

Several pages on this site run the same elimination and stop at different points. Our matrix rank calculator counts pivots and reports rank and nullity without constructing anything. Our row echelon form calculator returns the reduced matrix for showing your working. Our linear independence calculator answers a yes-or-no question about a specific set of vectors. This page is the one that hands you the kernel itself.

How to Use It

  1. Enter the matrix one row per line. Every row needs the same number of entries, but the matrix can be any shape.
  2. Read the nullity first. A nullity of zero means the only solution to Ax = 0 is the zero vector and there is no basis to return.
  3. Check the free column list. There is exactly one basis vector per free column, and each vector has a 1 in its own free position and 0 in the others.
  4. Substitute a basis vector back by hand. Multiplying A by it should give a column of zeros, which is the definitive check on any answer.
  5. Raise the tolerance for measured data. Noise produces tiny non-zero pivots that inflate the rank and hide a null space that is really there.

The Method and How It's Calculated

Take the default matrix. Subtracting twice row one from row two gives 0, 0, 1, 2, which is identical to row three, so row three reduces to zeros. The reduced form is 1, 2, 0, 3 in the first row and 0, 0, 1, 2 in the second. Pivots sit in columns 1 and 3, so columns 2 and 4 are free and the rank is 2.

Now read the equations off the reduced rows: x₁ + 2x₂ + 3x₄ = 0 and x₃ + 2x₄ = 0. Set x₂ = 1 and x₄ = 0. Then x₃ = 0 and x₁ = −2, giving the vector (−2, 1, 0, 0). Set x₂ = 0 and x₄ = 1 instead. Then x₃ = −2 and x₁ = −3, giving (−3, 0, −2, 1). Those two vectors are the basis.

Verify the second one directly. Row one of A times it is 1(−3) + 2(0) + 0(−2) + 3(1) = 0. Row two is 2(−3) + 4(0) + 1(−2) + 8(1) = −6 − 2 + 8 = 0. Row three is 0 + 0 + 1(−2) + 2(1) = 0. Every row gives zero, so the vector is genuinely in the kernel. The construction of the four fundamental subspaces from the reduced form is the backbone of the MIT OpenCourseWare 18.06SC Linear Algebra course.

Advertisement

Rank-Nullity Is Why the Page Is Worth Reading

For a matrix with n columns, rank + nullity = n. In the default example the rank is 2, the nullity is 2, and there are 4 columns. The theorem is not an arithmetic coincidence; it says that every dimension of the input space has exactly one fate. It either survives into the image of the matrix, contributing to the rank, or it is crushed to zero, contributing to the nullity. Nothing is unaccounted for and nothing is counted twice.

The reason the counts work out is visible in the reduced form. Every column is either a pivot column or a free column, and there is no third possibility. Pivot columns are what make the rank; free columns are what make the basis vectors of the null space. So the two counts add to the total number of columns because that is how the columns were divided in the first place.

The practical payoff is that either number gives you the other for free. If you know a 5 by 8 matrix has rank 3, its nullity is 5 without any further work, so Ax = 0 has a five-dimensional space of solutions. And since the rank cannot exceed 5 here, the nullity is at least 3 for any matrix of that shape — a wide matrix always has a non-trivial kernel, which is another way of saying that a system with more unknowns than equations always has infinitely many solutions if it has any at all.

What the Null Space Tells You About Solving Systems

The connection to Ax = b is direct and it is the reason kernels matter outside pure algebra. If x₀ is any one solution of Ax = b, then the complete solution set is x₀ plus the entire null space. Every solution differs from x₀ by something the matrix sends to zero, and adding any such thing to x₀ leaves Ax₀ unchanged.

So the null space describes the ambiguity in a system, and the nullity counts the free parameters in the general solution. A nullity of zero means a unique solution when one exists. A nullity of 2, as here, means a two-parameter family. Our system of equations calculator produces the particular solution x₀; this page produces the rest of the set.

For a square matrix the same idea gives the invertibility test in its cleanest form. A is invertible exactly when its null space contains only the zero vector, because a matrix that flattens any direction cannot be undone. That is equivalent to a non-zero determinant, which our determinant calculator reports, and to the existence of the inverse our matrix inverse calculator builds.

The Left Null Space and the Other Two Subspaces

Every matrix has four fundamental subspaces, and the null space is one of them. The column space is what the matrix can produce, and its dimension is the rank. The row space, spanned by the rows, also has dimension equal to the rank, and it lives in the same space as the null space. The left null space is the kernel of the transpose, with dimension equal to the number of rows minus the rank.

The relationships between them are geometric. The null space and the row space are orthogonal complements: every null space vector is perpendicular to every row, which is precisely what Ax = 0 says when read one row at a time. Together they fill the whole input space. In the same way the column space and the left null space are orthogonal complements filling the output space.

This is why the basis vectors from this tool can be checked against the rows by taking dot products, and why a solution to Ax = 0 is exactly a vector orthogonal to every row of A. The parallel treatment of null space, row space and rank appears in consecutive chapters of the Matrix Algebra for Engineers notes.

Why the Basis You Get May Differ From the Textbook's

A basis is not unique. Any set of independent vectors spanning the same space is a valid basis for it, and there are infinitely many for any space of dimension one or more. A textbook answer of (−2, 1, 0, 0) and yours of (2, −1, 0, 0) describe the same line, and either is correct.

What this tool returns is the canonical basis obtained from the reduced row echelon form, where each vector carries a 1 in one free position and 0 in the other free positions. That convention makes the vectors visibly independent — no two share the same free position — and it is what most courses expect. If your answer differs, the test is whether each of your vectors can be written as a combination of these, and whether you have the same number of them.

The number is the part that cannot differ. The nullity is a property of the matrix, not of the method, so any correct basis has exactly that many vectors. If you have three where the tool has two, one of yours is a combination of the others and the set is not independent, which our linear independence calculator will confirm.

Null Spaces in Applied Work

A non-trivial null space in a data matrix means the columns are linearly dependent — one variable is an exact combination of others. In regression that makes the coefficients unidentifiable: infinitely many coefficient vectors fit the data equally well, differing by anything in the null space. The classic cause is the dummy variable trap, where indicator columns for every category plus an intercept sum to a constant, putting a vector straight into the kernel.

In structural engineering, the null space of an equilibrium matrix describes mechanisms — motions the structure can undergo without any member carrying load. A non-empty kernel there means the structure is not fully braced, which is the same mathematics answering a physical question. In computer graphics, the kernel of a projection matrix is the direction being projected along.

Near-dependence is the common practical case and it does not produce an exactly zero null space. Columns that are nearly proportional give a matrix that is technically full rank with a very small pivot, and strict elimination reports a nullity of zero while the data behaves as though the kernel were there. That is what the tolerance setting exists for, and it is why unstable regression coefficients from our linear regression calculator are so often explained by a rank check on the predictor matrix.

Models built on data that can support them?

Arb Digital checks for dependence and collinearity before fitting, so a coefficient you act on is one the data can actually identify.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Saying the null space is empty — it always contains the zero vector, so the right phrase for a nullity of zero is that the null space is trivial.
  • Building a basis vector per pivot column — it is the free columns that generate basis vectors, one each, and the pivot variables are then solved for.
  • Stopping at row echelon form — reading the basis off directly requires the reduced form, where each pivot is 1 and is alone in its column.
  • Dropping the sign when back-substituting — the pivot variable equals minus the coefficient of the free variable, and the missing negative is the most common hand error.
  • Expecting a unique basis — any independent spanning set is valid, so a different-looking answer with the right number of vectors may be perfectly correct.

Related Free Tools From Arb Digital

Count pivots without building a basis on the matrix rank calculator, get the reduced matrix itself from the row echelon form calculator, test a set of vectors with the linear independence calculator, find a particular solution with the system of equations calculator, or explore the directions a matrix scales with the eigenvalue calculator. The full free online tools hub lists every mathematics tool we publish.

Frequently Asked Questions

What is the null space of a matrix?

It is the set of every vector x for which Ax equals the zero vector. Geometrically it is the collection of directions the matrix collapses to nothing, and it is also called the kernel.

What does the nullity tell me?

It is the dimension of the null space, which is the number of vectors in its basis and the number of free parameters in the general solution of Ax = 0. A nullity of zero means the only solution is the zero vector.

How does rank-nullity connect the two numbers?

Rank plus nullity equals the number of columns. Every column of the reduced form is either a pivot column, adding to the rank, or a free column, adding to the nullity, with no other possibility.

Can the null space be empty?

No. It always contains the zero vector, because A times zero is always zero. When the nullity is zero the correct description is that the null space is trivial, not that it is empty.

Why does each basis vector have a 1 in one position?

Because the standard construction sets one free variable to one and the rest to zero, then solves for the pivot variables. That pattern guarantees the vectors are independent, since no two carry their 1 in the same place.

Is the basis unique?

No. Any independent set spanning the same space is a valid basis, so answers can look different and both be correct. What cannot differ is the number of vectors, which is fixed by the nullity.

How does the null space relate to solving Ax = b?

If one solution exists, the full solution set is that particular solution plus the whole null space. The nullity therefore counts the free parameters in the general solution.

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