← LibraryNull Space of a Matrix | KEVOS® MathematicsProject Delivery · Project ManagementLesson 110/189← PrevNext →
ArticlePublished 8 Aug 202622 min readBy Kevin Jogin
Skip to content

Engineering/Mathematics/Systems of Linear Equations

Null Space of a Matrix

The null space of a matrix A is the set of every vector that A sends to zero. Defining it as a property of the matrix rather than of a system of equations is what converts a computational routine into a structural object that the rest of linear algebra can reason about.

  • Core level
  • Stream: subspaces
  • Reading time 14 min
  • Ref KVS-ENG-MATH-0014
Taxonomy
Engineering / Mathematics
Prerequisite
Homogeneous systems; free variables
Notation
N(A)
Always contains
The zero vector 0
Dimension
nr, the nullity of A
Lives in
n, indexed by the columns of A

Overview

Every homogeneous system Ax=0 has a solution set, and that set is never empty because the zero vector always belongs to it. What makes the set worth naming is that it depends on nothing but the coefficient matrix. Two apparently unrelated engineering problems that happen to share a coefficient matrix share this set exactly. Recognising that, the object is defined as a property of the matrix and written N(A) — the null space of A.

The shift in viewpoint is deliberate and consequential. A system of equations is a question; a solution set is an answer to that question. A null space is neither — it is an attribute of a matrix, on the same footing as its size or its rank, available to be quoted, compared and reasoned with before any particular problem is posed. This is the first point in the subject where an object is defined for a matrix rather than derived from a computation, and the pattern repeats for the column space, the row space and the left null space.

Computing a null space is a routine application of reduction. Row-reduce A, identify the nr free variables, and generate one vector per free variable by setting it to one and the others to zero. The resulting vectors span N(A) and are independent by construction, so they form a basis and the dimension of the null space — the nullity — is exactly nr. When r=n there are no free variables and the null space collapses to {0}.

The engineering value of the null space is that it measures what a linear model cannot see. Vectors in N(A) produce no output, no residual and no effect, so they are precisely the directions in which the model is blind. Depending on context that blindness is a resource — redundancy available for secondary objectives — or a defect — parameters the data cannot identify. Either way, its dimension and its spanning set are the quantities that make the situation explicit.

Definition

Null Space of a Matrix

NSM

The null space of an m×n matrix A, written N(A), is the set of all column vectors of size n that are solutions of the homogeneous system LS(A,0). Equivalently, N(A)={xnAx=0}.

The definition attaches to the matrix, not to a system. There is no requirement that A arose from a system of equations, and no right-hand side is involved.

Trivial Null Space

TNS

A matrix whose null space contains only the zero vector, N(A)={0}. This occurs precisely when the reduced row-echelon form of A has a leading one in every column, so that r=n and no free variables remain. A trivial null space is a strong statement about A: no non-zero vector is annihilated, and the columns of A are linearly independent.

Nullity

NOM

The dimension of N(A), written nullity(A), equal to the number of free variables nr of the homogeneous system. It counts the independent directions in n that A maps to zero, and is zero exactly when the null space is trivial.

Concepts

A set defined by a membership test

The null space is specified by a condition rather than by a list: a vector belongs if and only if multiplying it by A yields the zero vector. Testing membership therefore costs one matrix-vector product and requires no reduction at all. This is worth stating because it separates two quite different tasks. Confirming that a candidate vector lies in N(A) is cheap and exact; producing a description of the whole set requires a reduction and yields a spanning set rather than an enumeration.

Why the null space is closed under linear combination

If Au=0 and Av=0 then evaluating equation i at αu+βv gives α times its value at u plus β times its value at v, which is α0+β0=0. Every linear combination of null-space vectors is therefore again in the null space. This closure is what elevates N(A) from a set to a subspace, and it is the reason a finite spanning set can describe an infinite collection exactly.

Generating a spanning set from the free variables

Reduce A and write each dependent variable in terms of the free ones. Setting free variable k to one and every other free variable to zero produces a vector zk in the null space. Doing this once per free variable yields nr vectors whose span is exactly N(A): any null-space vector is recovered by using its own free-variable values as coefficients. The vectors are automatically independent, because zk carries a one in the coordinate of free variable k where every other generated vector carries a zero.

Nullity, rank and where each lives

For an m×n matrix the null space is a subset of n, indexed by the columns, and has dimension nr. Note that m does not appear: adding more equations can only increase r and shrink the null space, but the ambient space is fixed by the number of columns. A common error is to place the null space in m by analogy with the vector of constants. The size check is that Ax must be defined, which forces x to have n entries.

The null space measures ambiguity in the driven problem

Suppose p satisfies Ap=b. Then for any zN(A) the vector p+z satisfies the same system, and conversely the difference of any two solutions lies in the null space. The entire solution set of a consistent system is therefore one particular solution translated by the null space. This single statement explains why a system with a trivial null space has at most one solution and why one with a large null space has a correspondingly large ambiguity, independent of which right-hand side is applied.

Trivial null space as a structural certificate

The statement N(A)={0} is equivalent to several others that appear elsewhere in the subject: the columns of A are linearly independent; r=n; and, when A is square, A is nonsingular and A row-reduces to the identity matrix. Establishing a trivial null space therefore does far more work than its statement suggests, which is why the computation is worth performing even when no homogeneous problem is at hand.

Procedure: computing the null space of a matrix

Row-reduce AReduce the coefficient matrix alone; the constants column of the homogeneous system is zero and carries no information.
Record r and the pivot columnsThe pivot index set D names the dependent variables; the remaining nr columns name the free variables.
Is r=n?If yes, there are no free variables and N(A)={0}. Report a trivial null space and stop.
Solve each pivot row for its dependent variableEach row of the reduced form already isolates one dependent variable in terms of the free ones.
Generate one vector per free variableSet one free variable to 1, the rest to 0, and read off the induced dependent values.
Verify and reportConfirm Azk=0 against the original matrix, then state N(A) as the span of the generated vectors.

Equations

Definition of the null space

EQ-NSM-01
N(A)={xnAx=0}

A set specified by a membership condition. For an m×n matrix the null space is a subset of n, indexed by the columns of A.

The null space is never empty

EQ-NSM-02
0N(A)for every matrix A

The zero vector satisfies every homogeneous equation, so the question is never whether the null space has an element but whether it has more than one.

Closure under linear combination

EQ-NSM-03
u,vN(A),α,βαu+βvN(A)

The property that makes the null space a subspace and allows an infinite set to be described exactly by a finite spanning set.

Spanning set from the free variables

EQ-NSM-04
N(A)=span({z1,z2,,znr})

One vector is generated per free variable by setting that variable to one and the remaining free variables to zero. The vectors are independent by construction.

Nullity

EQ-NSM-05
nullity(A)=dim(N(A))=nr

The dimension of the null space equals the number of columns minus the rank. The row count m plays no part in the formula.

Trivial null space criterion

EQ-NSM-06
N(A)={0}r=n

The null space collapses to the zero vector precisely when every column of the reduced form carries a leading one, equivalently when the columns of A are linearly independent.

Solution set of a consistent system as a translate

EQ-NSM-07
Ap=bS={p+zzN(A)}

One particular solution plus the entire null space gives every solution of the driven system. The null space is therefore the exact measure of ambiguity in the problem.

Variable Definitions

Symbols used on this page
SymbolNameMeaningDomain / type
AMatrixThe m×n matrix whose null space is soughtm x n matrix over C
N(A)Null spaceThe set of all vectors annihilated by Asubspace of C^n
xCandidate vectorA vector of size n tested for membership of the null spacevector in C^n
zkGenerated null vectorNull-space vector obtained by setting free variable k to one and the others to zerovector in C^n
nColumn countNumber of columns of A; the size of vectors in the null spacepositive integer
mRow countNumber of rows of A; does not appear in the nullity formulapositive integer
rRankNumber of non-zero rows in the reduced form of A0 to min(m,n)
nullity(A)NullityDimension of the null space, equal to nr0 to n
pParticular solutionAny single solution of a consistent driven system Ax=bvector in C^n

Worked Numerical Example

Problem statement

A sensor array is modelled by a 3×5 observation matrix relating five internal states to three measurements. Determine which state combinations produce identically zero readings — the unobservable directions of the array.

  1. State the matrix

    Each row is one sensor, each column one internal state. The null space of this matrix is exactly the set of state vectors that every sensor reports as zero.

    A=[122312434136235]
  2. Reduce the first pivot column

    Entry (1,1) is already a one. Apply R2R22R1 and R3R33R1. Column 2 is then empty below row 1, so it will be a non-pivot column and x2 will be free.

    [122310012300468]
  3. Reduce the second pivot column

    Scale R2 by 1 to create the leading one in column 3, then clear the column with R3R3+4R2 and R1R12R2.

    [120150012300024]
  4. Reduce the third pivot column

    Scale R3 by 12, then apply R1R1+R3 and R2R22R3 to complete the reduction.

    B=[120030010100012]
  5. Identify the free variables and solve

    Here r=3 with pivot columns D={1,3,4}, so x1, x3 and x4 are dependent and x2, x5 are free. The nullity is nr=53=2. Each pivot row is already solved for its dependent variable:

    x1=2x23x5,x3=x5,x4=2x5
  6. Generate the spanning vectors

    Take x2=1,x5=0 for the first, then x2=0,x5=1 for the second. The pattern of ones and zeros in coordinates 2 and 5 makes the two vectors visibly independent.

    z1=[21000],z2=[30121]
  7. Verify against the original matrix

    For z1 the three rows give 22=0, 44=0 and 66=0. For z2 they give 32+61=0, 63+8+1=0 and 92+6+5=0. Both are annihilated by A, and the check uses the original matrix rather than the reduced one.

  8. State the null space

    Every unobservable state combination is a linear combination of the two generated vectors, and no other vectors qualify.

    N(A)=span({z1,z2})
Result

The array is blind to a two-dimensional family of state combinations: nullity(A)=2 against five states, so only three independent quantities can be recovered from the three sensors. Any attempt to estimate all five states from this array is ill-posed, and the two spanning vectors state exactly which combinations must be constrained by additional sensors or prior information.

Applications & Industry Use

Control systems

Unobservable subspace of a plant

The null space of an observability matrix contains every initial state that produces identically zero output. Its dimension quantifies how much of the state cannot be reconstructed from measurements, and its spanning vectors identify precisely which state combinations require additional sensors.

Structural engineering

Mechanisms and inextensional modes

The null space of a compatibility matrix contains nodal displacement patterns that produce zero member extension. A non-trivial null space signals a mechanism or an inextensional mode, which must be either stiffened out or stabilised by prestress before the structure can carry load.

Robotics

Self-motion of a redundant manipulator

The null space of a Jacobian contains joint velocity vectors that produce no end-effector motion. Projecting a secondary objective onto that null space allows a redundant arm to avoid joint limits or obstacles while the primary task proceeds undisturbed.

Chemical engineering

Reaction extents at steady state

The null space of a stoichiometric matrix is the set of reaction rate vectors compatible with zero net accumulation. Its dimension is the number of independent reaction pathways, and a basis for it provides the coordinate system in which flux analysis is carried out.

Geophysics & imaging

Model null space in tomographic inversion

Ray coverage rarely constrains every model parameter. The null space of the forward operator contains model perturbations that produce no change in the predicted data, so any feature of a reconstructed image lying in that null space is an artefact of regularisation rather than of measurement.

Statistics & experimental design

Non-estimable contrasts

In a rank-deficient design matrix the null space consists of parameter vectors that leave every fitted value unchanged. Contrasts orthogonal to that null space are estimable; those with a component inside it are not, and reporting values for them is meaningless regardless of how the solver was configured.

Design Considerations

Report the null space, not a single null vector

A non-trivial null space is a subspace, and any single vector drawn from it is one direction among infinitely many. The useful deliverables are the dimension nr and a spanning set. Quoting one vector without its dimension invites the reader to assume the ambiguity is one-dimensional.

Choose the basis for its purpose

Elimination produces a basis with a one in each free coordinate, which is sparse and readable but arbitrarily scaled and generally not orthogonal. A singular value decomposition produces an orthonormal basis that is numerically far better behaved but loses the direct correspondence with individual variables. Select according to whether the basis will be interpreted or computed with.

Do not compute a null space by exact elimination on measured data

Rank is discontinuous in the entries, so a matrix that is null-space-bearing in theory will almost always reduce to full rank in floating point. Use the smallest singular values and their right singular vectors, with a tolerance stated explicitly, whenever the entries carry measurement error.

Watch the ambient space

The null space lives in n, determined by the number of columns, while the vector of constants lives in m. For a non-square matrix these are different spaces and confusing them produces an immediate size error. The left null space, defined by Aty=0, is the object that lives in m.

Use membership testing to validate, not to explore

Verifying that a candidate vector is annihilated by A costs a single matrix-vector product and is exact. Searching for null vectors by trial is hopeless. Reserve the cheap test for validating a computed basis and use reduction or an SVD to produce candidates in the first place.

Interpret nullity before acting on it

A large nullity means the model leaves much undetermined. Whether that is a feature or a fault depends on the application: in redundancy resolution it is capacity, in parameter identification it is failure. Decide which reading applies before adding constraints, since the remedies are opposite — exploit the freedom, or remove it.

Standards & Codes

Notation, interchange and numerical standards that govern how this material is written down, stored and computed in production systems.

Applicable standards, conventions and reference implementations
ReferenceTitleRelevance to this topic
ISO 80000-2Quantities and units — Part 2: MathematicsStandardises the script notation for named sets and the upright rendering of operator names such as dim and nullity, keeping N(A) typographically distinct from an ordinary variable.
LAPACK / BLAS referenceLinear Algebra PACKage reference implementationThe singular value decomposition routines xGESVD and xGESDD are the production route to a null-space basis, returning the trailing right singular vectors that span the numerical null space.
IEEE 754-2019IEEE Standard for Floating-Point ArithmeticDetermines the rounding behaviour that makes an exactly zero singular value unattainable in practice, and hence the need for an explicit tolerance in any computed nullity.
ISO 8373Robotics — VocabularyDefines redundancy and self-motion for manipulators, terms whose formal content is precisely the dimension and spanning set of a Jacobian null space.
ISO/IEC 40314Mathematical Markup Language (MathML) Version 3.0Encodes the set-builder definition and stacked basis vectors on this page semantically, preserving the distinction between the script N and an italic N.

Material Selection

For a mathematical topic, "material" is the numeric representation: the scalar field, storage format and precision the computation is built from.

Representation and precision selection
RepresentationSelect whenTrade-off
Exact rational arithmetic via eliminationInteger or symbolic matrices where the null-space basis must have exact, interpretable entries.Gives a sparse basis with a clean correspondence to the free variables, but coefficient growth limits it to modest sizes.
IEEE 754 binary64 with an SVDAny matrix assembled from measurement or from prior floating-point computation.Yields an orthonormal, well-conditioned basis and a graded view of near-nullity through the singular values, at roughly an order of magnitude more arithmetic.
Rank-revealing QR with column pivotingLarge matrices where an SVD is too costly but a defensible numerical rank is still required.Considerably cheaper than an SVD and usually reliable, but can misclassify rank for specially constructed matrices near the tolerance boundary.
Sparse null-space basesNetwork, circuit and finite-element matrices where nr is large and the basis vectors have local support.Produces physically interpretable, sparse vectors such as individual loops or mechanisms, but the basis is neither orthogonal nor unique.
Finite field arithmeticCoding theory, where the null space of a parity-check matrix is the code itself.Exact, fast and free of tolerance questions, but the dimension over a finite field may differ from the dimension of the same integer matrix over the rationals.
Iterative Krylov methods for the smallest singular subspaceVery large sparse matrices where only a low-dimensional null space is needed.Avoids forming a dense factorisation and scales to large problems, but convergence depends on the gap between the smallest singular values and requires careful stopping criteria.

Manufacturing Notes

Implementation notes — how the result is actually produced by hand, by algorithm and by library, including cost and numerical behaviour.

Cost of the computation

Reducing A to obtain a null-space basis costs about 23n3 operations for a square matrix, with the generation of the nr basis vectors adding only O(n(nr)) reads. A singular value decomposition costs several times more but delivers an orthonormal basis and a rank estimate with a defensible tolerance.

Hand procedure and a self-check

After reducing, write the dependent variables in terms of the free ones, then build one vector per free variable. A quick self-check is available before any multiplication: the sub-block of the basis vectors restricted to the free coordinates should be the identity matrix of size nr. If it is not, a free variable has been missed or double-counted.

Library behaviour

SymPy's Matrix.nullspace() returns exact basis vectors derived from the reduced form, matching the hand computation. SciPy's scipy.linalg.null_space returns an orthonormal basis from the SVD and accepts a tolerance, so its output spans the same subspace but will not agree entry for entry. Comparing the two requires comparing subspaces, not vectors.

Verification technique

Multiply the original matrix by each computed basis vector and check the result against the zero vector, using a norm rather than an equality test in floating point. Then confirm that the number of independent basis vectors equals nr; a basis that is annihilated but too small spans only part of the null space and will silently understate the ambiguity.

Near-null directions matter more than exact ones

In practice a matrix rarely has an exact null space, but often has directions in which it is nearly singular. The right singular vectors belonging to the smallest singular values identify those directions and are the numerically meaningful analogue. Reporting the singular values alongside the basis lets a reader judge how close to null each direction really is.

Failure Modes & Common Mistakes

Failure modes, root causes and prevention
Failure mode / mistakeImpactRoot causePrevention & detection
Placing the null space in the wrong ambient spacehighAssuming null-space vectors have m entries by analogy with the vector of constants, when they must have n.Check that Ax is defined: the vector must have as many entries as A has columns. The space of size m belongs to the left null space.
Reporting a single vector for a multi-dimensional null spacehighStopping after finding one non-trivial solution rather than generating one vector per free variable.Always compute nr first and confirm that the number of basis vectors produced matches it.
Computing a null space by exact elimination on floating-point datahighRounding promotes a structurally zero pivot to a non-zero one, so the routine reports a trivial null space.Use singular values against a tolerance scaled by the matrix norm; treat an elimination-based nullity as unreliable for measured data.
Assuming a non-trivial null space implies inconsistencymediumConflating a rank-deficient matrix with an unsolvable driven system.A large null space makes solutions non-unique, not non-existent. Consistency depends on b and must be tested separately.
Attaching absolute magnitude to a null vectormediumReading entries of a basis vector as physical quantities, when any scalar multiple is equally valid.Quote ratios or a stated normalisation; never report an unnormalised magnitude derived from a null-space computation.
Comparing two null-space bases entry by entrymediumExpecting an elimination-derived basis and an SVD-derived basis to agree, when they merely span the same subspace.Compare subspaces by checking mutual containment or by comparing orthogonal projectors, not by comparing individual vectors.
Ignoring near-null directionsmediumTreating nullity as a binary property and discarding directions with small but non-zero singular values.Report the smallest singular values alongside the rank verdict so that marginal directions are visible to the reader.
Forgetting that the null space always contains 0lowDescribing a trivial null space as empty rather than as containing exactly one element.Write N(A)={0}, never N(A)=; the null space of a matrix is never empty.

FAQs

Why define the null space for a matrix rather than for a system of equations?

Because it depends only on the coefficient matrix. Any two systems sharing a coefficient matrix share the same null space, whatever their right-hand sides, so attaching the object to the matrix removes an irrelevant dependency. It also makes the null space available for matrices that never arose from a system at all.

Can a null space be empty?

No. The zero vector satisfies A0=0 for every matrix, so the null space always contains at least one element. A matrix with no non-zero null vectors has N(A)={0}, which is a set with one element, not the empty set.

What is the relationship between the null space and the number of solutions of Ax=b?

If the system is consistent with particular solution p, its complete solution set is p plus every null-space vector. A trivial null space therefore gives at most one solution, and a null space of dimension k gives a k-parameter family. The null space measures the ambiguity, and consistency decides whether there is anything to be ambiguous about.

How large can the null space of an m×n matrix be?

Its dimension is nr, and r is at most min(m,n). So the nullity is at least nm when m<n, and at most n, achieved only by the zero matrix. The row count bounds the rank and therefore bounds how small the null space can be.

Is the null-space basis unique?

No. Any set of nr independent null vectors is a basis. The elimination procedure produces a distinguished one determined by the pivot pattern, and an SVD produces an orthonormal one. Both span the same subspace, which is the object that is unique; the basis is not.

How do I check whether a given vector is in the null space?

Compute Ax and compare it with the zero vector. This costs one matrix-vector product and requires no reduction. In floating point, compare Ax against Ax times the machine epsilon rather than testing for exact equality.

What is the difference between the null space and the left null space?

The null space consists of vectors x of size n with Ax=0; the left null space consists of vectors y of size m with Aty=0, equivalently combinations of the rows of A that vanish. The two live in different spaces and generally have different dimensions, related by nr and mr respectively.

References

  1. Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section HSE, subsection NSM. Licensed under the GNU Free Documentation License v1.2.
  2. ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
  3. Golub, G. H. and Van Loan, C. F. Matrix Computations, 4th edition. Johns Hopkins University Press, 2013.
  4. Strang, G. 'The fundamental theorem of linear algebra'. American Mathematical Monthly, 100(9), 1993.
  5. Anderson, E. et al. LAPACK Users' Guide, 3rd edition. Society for Industrial and Applied Mathematics, 1999.

AI Suggested Questions

  • Given a 4x7 matrix of rank 3, describe the null space precisely and explain why its dimension cannot be anything other than four.
  • Show that the basis vectors generated from free variables are linearly independent, using only the pattern of ones and zeros in the free coordinates.
  • Why does a singular value decomposition give a numerically better null-space basis than Gaussian elimination, and what does the smallest singular value tell me?
  • Explain how a Jacobian null space is used to implement a null-space projection controller for a redundant manipulator.
  • Compare the null space of a matrix with the null space of its transpose, and state how their dimensions are related.
  • How would I certify that two computed null-space bases span the same subspace when their vectors do not match?

Related Calculators

Continue learning

Algebraic and Geometric Multiplicities of Eigenvalues | KEVOS® MathematicsArticle · Project ManagementAmitsur’s Theorem on the Radical of a Polynomial Ring | KEVOS®Article · Project ManagementAmitsur’s Theorem on the Radical of an Algebra of Small Dimension | KEVOS®Article · Project ManagementArchetypes: Reference Catalogue of Worked Systems | KEVOS® MathematicsArticle · Project Management