Audited 29 Jul 2026·Last updated 28 Oct 2026·4 citations·Tier 2·0 uses

Null Space Calculator (Kernel of a Matrix)

Find a basis for the null space (kernel) of any matrix up to 6 × 6, with nullity, rank, free variables, the parametric solution of Ax = 0 and the RREF working.

Null Space Calculator

One row per line, up to 6 rows and 6 columns. Separate entries with commas or spaces. Fractions like 1/2 are accepted. The matrix does not need to be square.
Null space basis
(-2, 1, 0, 0), (2, 0, -2, 1)
One basis for the null space: one vector per free variable, each obtained by setting that variable to 1 and the other free variables to 0 — a valid basis, though other bases of the same subspace are equally correct.
Nullity
2
Rank
2
What it means
Non-trivial — Nul(A) is a 2-dimensional subspace of R^4, so Ax = 0 has infinitely many solutions
Parametric solution
x = x2·(-2, 1, 0, 0) + x4·(2, 0, -2, 1)
Free variables
x2, x4
Reduced row echelon form
[1, 2, 0, -2; 0, 0, 1, 2; 0, 0, 0, 0]

Background.

Write down three equations in four unknowns with every right-hand side equal to zero, and you are asking for a null space. The zero vector always satisfies such a system. What matters is what else does, and when there are more unknowns than independent equations the answer is a whole family: a line, a plane or a higher-dimensional flat sheet passing through the origin.

The null space of a matrix A, also called its kernel, is exactly that family — every vector x with Ax = 0. Its basis vectors are more useful than they look, because each one is a recipe for combining the columns of A so that they cancel. In the worked example below, the basis vector (−2, 1, 0, 0) says that −2 times column 1 plus column 2 is zero, which is another way of saying column 2 is double column 1. When no such recipe exists the null space shrinks to the zero vector alone and the columns are linearly independent.

That single computation settles several questions that keep coming back in a linear algebra course and after it: whether a set of vectors is independent, whether a solution of Ax = b is unique or comes with free parameters, how many independent ways a chemical equation can be balanced, and which directions a linear map flattens to nothing.

Enter A one row per line, up to 6 rows and 6 columns, square or not. Back come a basis, the nullity and rank, the free variables, the general solution written in parametric form, and the reduced row echelon form the answer was read from, so you can follow every step by hand.

What is null space calculator?

For an m × n matrix A, the null space Nul(A) is the set of all vectors x in Rⁿ with Ax = 0. It lives in the space of inputs, so its vectors have one entry per column of A, not per row. It is always a subspace: it contains the zero vector, and sums and scalar multiples of solutions are solutions again, since A(x + y) = Ax + Ay and A(cx) = c·Ax. Its dimension is the nullity. Because Ax = 0 says that x has zero dot product with every row of A, the null space is also the set of vectors perpendicular to the whole row space. It is trivial, {0}, exactly when the columns of A are linearly independent; for a square matrix that is the same as A being invertible, with a non-zero determinant.

How to use this calculator.

  1. Type Matrix A with one row per line and commas or spaces between entries; a semicolon also ends a row. Every row needs the same number of entries, with at most 6 rows and 6 columns and each entry between −1,000,000,000 and 1,000,000,000.
  2. Use fractions such as 1/3 instead of 0.333. Entries are taken exactly as typed, so a rounded decimal can turn a matrix whose columns depend on each other into one whose columns do not.
  3. Read the verdict and the nullity first: nullity 0 means only the zero vector solves Ax = 0, and nullity equal to the number of columns happens only for the zero matrix.
  4. Copy the basis from the top line, or use the parametric solution when you want every solution written out with the free variables as parameters.
  5. If a textbook lists different vectors, compare reduced row echelon forms first, since that matrix is unique, then multiply the textbook vectors through A to confirm each gives zero.

The formula.

Nul(A) = { x : Ax = 0 } , rank + nullity = n

The definition is Nul(A) = { x : Ax = 0 }, and the method is row reduction. Reduce A to its reduced row echelon form R. Each elementary row operation can be undone, so Rx = 0 has exactly the same solutions as Ax = 0, and R is unique: every legal sequence of row operations ends at the same matrix. Columns of R containing a leading 1 are pivot columns, and their variables are basic; every other column is free. For each free column j, build one vector: put 1 in position j, 0 in the other free positions, and in the position of the pivot from row i put the negative of R's entry in row i, column j. In other words, a basis vector is the free column of R with its signs flipped and a 1 inserted. These are Strang's special solutions. They are independent, because each has a 1 where all the others have 0, and they span, because any solution equals the sum of its own free-variable values times the matching special solutions. So the nullity is the number of free columns, and since every column is either pivot or free, rank + nullity = n, the column count. Entries are displayed as exact fractions whenever a denominator up to 1,000 fits, otherwise to 6 decimal places.

A worked example.

Example

Take A with rows (1, 2, 2, 2), (2, 4, 6, 8) and (3, 6, 8, 10). Subtracting 2 × row 1 from row 2 and 3 × row 1 from row 3 leaves both lower rows equal to (0, 0, 2, 4); subtracting row 2 from row 3 then clears row 3 completely, because the original third row was the sum of the first two. Halving row 2 gives (0, 0, 1, 2), and subtracting 2 × that from row 1 gives (1, 2, 0, −2). So R = [1, 2, 0, −2; 0, 0, 1, 2; 0, 0, 0, 0], with pivots in columns 1 and 3. That leaves x2 and x4 free, so the rank is 2 and the nullity is 4 − 2 = 2. Setting x2 = 1, x4 = 0, the first row of R reads x1 + 2 = 0 and the second reads x3 = 0, giving (−2, 1, 0, 0). Setting x2 = 0, x4 = 1, the rows read x1 − 2 = 0 and x3 + 2 = 0, giving (2, 0, −2, 1). The basis is therefore (−2, 1, 0, 0), (2, 0, −2, 1), and every solution is x = x2·(−2, 1, 0, 0) + x4·(2, 0, −2, 1). Multiplying back confirms both: A times the first vector is (−2 + 2, −4 + 4, −6 + 6) = (0, 0, 0), and A times the second is (2 − 4 + 2, 4 − 12 + 8, 6 − 16 + 10) = (0, 0, 0). Read as column relations, the two vectors say column 2 = 2 × column 1 and column 4 = 2 × column 3 − 2 × column 1: only columns 1 and 3 carry independent information.

matrix1, 2, 2, 2 2, 4, 6, 8 3, 6, 8, 10

Frequently asked questions.

My textbook's null space basis has different vectors. Is one of us wrong?
Usually neither. A subspace has infinitely many bases, and textbooks often scale vectors to clear fractions, so (−1/2, 1) and (−1, 2) describe the same line. Two answers agree when they have the same number of vectors, equal to the nullity, and every vector in each one satisfies Ax = 0.
Why do MATLAB and SciPy give decimals like 0.8944 instead of whole numbers?
MATLAB's null(A) and SciPy's null_space use the singular value decomposition and return an orthonormal basis. For A = [1, 2; 2, 4] the basis here is (−2, 1); those tools return about (−0.8944, 0.4472) or its negative, which is the same vector divided by √5. MATLAB's null(A, 'r') gives the row-reduction basis instead.
Why did typing 0.333333 instead of 1/3 change the nullity?
Entries are used exactly as typed. The matrix [1, 1/3; 3, 1] has dependent columns and nullity 1, with basis (−1/3, 1). With 0.333333 its determinant becomes 1 − 0.999999, about 0.000001, which is not zero, so the nullity drops to 0. Enter fractions when the dependence is exact.
How does the null space help me solve Ax = b?
Every solution of Ax = b is one particular solution plus a null space vector. For the example matrix and b = (3, 8, 11), x = (1, 0, 1, 0) works, so does (−1, 1, 1, 0), and so does every vector (1, 0, 1, 0) + x2·(−2, 1, 0, 0) + x4·(2, 0, −2, 1). A trivial null space means at most one solution.
Can I find a particular solution of Ax = b with a null space calculation?
Yes. Append b as an extra column and enter [A | b]. If a basis vector has 1 in the last position, negate its other entries to get a solution. For the example with b = (3, 8, 11) the extra vector is (−1, 0, −1, 0, 1), giving x = (1, 0, 1, 0). If none does, Ax = b has no solution.
How do I get eigenvectors from a null space?
Eigenvectors for an eigenvalue λ are the non-zero vectors in the null space of A − λI. For A = [2, 1; 1, 2] and λ = 3, enter A − 3I = [−1, 1; 1, −1]; the basis comes back as (1, 1), and indeed A(1, 1) = (3, 3). A nullity above 1 means several independent eigenvectors share that eigenvalue.
Why must a wide matrix always have a non-trivial null space?
The rank can never exceed the number of rows, so an m × n matrix with n greater than m has nullity at least n − m. The single row (1, 2, 3) has rank 1 and nullity 2: its null space is the plane of vectors perpendicular to (1, 2, 3), spanned by (−2, 1, 0) and (−3, 0, 1).

How this page was produced

Published by
Quanta Calculator
Primary sources
4 cited below
Method
Nul(A) = { x : Ax = 0 } , rank + nullity = n
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon