Engineering/Mathematics/Systems of Linear Equations
Null Space of a Matrix
The null space of a matrix is the set of every vector that 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
- Always contains
- The zero vector
- Dimension
- , the nullity of
- Lives in
- , indexed by the columns of
Overview
Every homogeneous system 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 — the null space of .
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 , identify the free variables, and generate one vector per free variable by setting it to one and the others to zero. The resulting vectors span and are independent by construction, so they form a basis and the dimension of the null space — the nullity — is exactly . When there are no free variables and the null space collapses to .
The engineering value of the null space is that it measures what a linear model cannot see. Vectors in 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
NSMThe null space of an matrix , written , is the set of all column vectors of size that are solutions of the homogeneous system . Equivalently, .
The definition attaches to the matrix, not to a system. There is no requirement that arose from a system of equations, and no right-hand side is involved.
Trivial Null Space
TNSA matrix whose null space contains only the zero vector, . This occurs precisely when the reduced row-echelon form of has a leading one in every column, so that and no free variables remain. A trivial null space is a strong statement about : no non-zero vector is annihilated, and the columns of are linearly independent.
Nullity
NOMThe dimension of , written , equal to the number of free variables of the homogeneous system. It counts the independent directions in that 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 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 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 and then evaluating equation at gives times its value at plus times its value at , which is . Every linear combination of null-space vectors is therefore again in the null space. This closure is what elevates 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 and write each dependent variable in terms of the free ones. Setting free variable to one and every other free variable to zero produces a vector in the null space. Doing this once per free variable yields vectors whose span is exactly : any null-space vector is recovered by using its own free-variable values as coefficients. The vectors are automatically independent, because carries a one in the coordinate of free variable where every other generated vector carries a zero.
Nullity, rank and where each lives
For an matrix the null space is a subset of , indexed by the columns, and has dimension . Note that does not appear: adding more equations can only increase 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 by analogy with the vector of constants. The size check is that must be defined, which forces to have entries.
The null space measures ambiguity in the driven problem
Suppose satisfies . Then for any the vector 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 is equivalent to several others that appear elsewhere in the subject: the columns of are linearly independent; ; and, when is square, is nonsingular and 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
Equations
Definition of the null space
EQ-NSM-01A set specified by a membership condition. For an matrix the null space is a subset of , indexed by the columns of .
The null space is never empty
EQ-NSM-02The 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-03The 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-04One 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-05The dimension of the null space equals the number of columns minus the rank. The row count plays no part in the formula.
Trivial null space criterion
EQ-NSM-06The null space collapses to the zero vector precisely when every column of the reduced form carries a leading one, equivalently when the columns of are linearly independent.
Solution set of a consistent system as a translate
EQ-NSM-07One 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
| Symbol | Name | Meaning | Domain / type |
|---|---|---|---|
| Matrix | The matrix whose null space is sought | m x n matrix over C | |
| Null space | The set of all vectors annihilated by | subspace of C^n | |
| Candidate vector | A vector of size tested for membership of the null space | vector in C^n | |
| Generated null vector | Null-space vector obtained by setting free variable to one and the others to zero | vector in C^n | |
| Column count | Number of columns of ; the size of vectors in the null space | positive integer | |
| Row count | Number of rows of ; does not appear in the nullity formula | positive integer | |
| Rank | Number of non-zero rows in the reduced form of | 0 to min(m,n) | |
| Nullity | Dimension of the null space, equal to | 0 to n | |
| Particular solution | Any single solution of a consistent driven system | vector in C^n |
Worked Numerical Example
Problem statement
A sensor array is modelled by a observation matrix relating five internal states to three measurements. Determine which state combinations produce identically zero readings — the unobservable directions of the array.
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.
Reduce the first pivot column
Entry is already a one. Apply and . Column is then empty below row , so it will be a non-pivot column and will be free.
Reduce the second pivot column
Scale by to create the leading one in column , then clear the column with and .
Reduce the third pivot column
Scale by , then apply and to complete the reduction.
Identify the free variables and solve
Here with pivot columns , so , and are dependent and , are free. The nullity is . Each pivot row is already solved for its dependent variable:
Generate the spanning vectors
Take for the first, then for the second. The pattern of ones and zeros in coordinates and makes the two vectors visibly independent.
Verify against the original matrix
For the three rows give , and . For they give , and . Both are annihilated by , and the check uses the original matrix rather than the reduced one.
State the null space
Every unobservable state combination is a linear combination of the two generated vectors, and no other vectors qualify.
The array is blind to a two-dimensional family of state combinations: 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
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.
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.
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.
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.
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.
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 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 , determined by the number of columns, while the vector of constants lives in . For a non-square matrix these are different spaces and confusing them produces an immediate size error. The left null space, defined by , is the object that lives in .
Use membership testing to validate, not to explore
Verifying that a candidate vector is annihilated by 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.
| Reference | Title | Relevance to this topic |
|---|---|---|
ISO 80000-2 | Quantities and units — Part 2: Mathematics | Standardises the script notation for named sets and the upright rendering of operator names such as and , keeping typographically distinct from an ordinary variable. |
LAPACK / BLAS reference | Linear Algebra PACKage reference implementation | The 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-2019 | IEEE Standard for Floating-Point Arithmetic | Determines 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 8373 | Robotics — Vocabulary | Defines redundancy and self-motion for manipulators, terms whose formal content is precisely the dimension and spanning set of a Jacobian null space. |
ISO/IEC 40314 | Mathematical Markup Language (MathML) Version 3.0 | Encodes the set-builder definition and stacked basis vectors on this page semantically, preserving the distinction between the script and an italic . |
Material Selection
For a mathematical topic, "material" is the numeric representation: the scalar field, storage format and precision the computation is built from.
| Representation | Select when | Trade-off |
|---|---|---|
| Exact rational arithmetic via elimination | Integer 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 SVD | Any 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 pivoting | Large 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 bases | Network, circuit and finite-element matrices where 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 arithmetic | Coding 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 subspace | Very 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 to obtain a null-space basis costs about operations for a square matrix, with the generation of the basis vectors adding only 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 . 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 ; 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 mode / mistake | Impact | Root cause | Prevention & detection |
|---|---|---|---|
| Placing the null space in the wrong ambient space | high | Assuming null-space vectors have entries by analogy with the vector of constants, when they must have . | Check that is defined: the vector must have as many entries as has columns. The space of size belongs to the left null space. |
| Reporting a single vector for a multi-dimensional null space | high | Stopping after finding one non-trivial solution rather than generating one vector per free variable. | Always compute first and confirm that the number of basis vectors produced matches it. |
| Computing a null space by exact elimination on floating-point data | high | Rounding 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 inconsistency | medium | Conflating a rank-deficient matrix with an unsolvable driven system. | A large null space makes solutions non-unique, not non-existent. Consistency depends on and must be tested separately. |
| Attaching absolute magnitude to a null vector | medium | Reading 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 entry | medium | Expecting 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 directions | medium | Treating 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 | low | Describing a trivial null space as empty rather than as containing exactly one element. | Write , never ; 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 for every matrix, so the null space always contains at least one element. A matrix with no non-zero null vectors has , 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 ?
If the system is consistent with particular solution , its complete solution set is plus every null-space vector. A trivial null space therefore gives at most one solution, and a null space of dimension gives a -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 matrix be?
Its dimension is , and is at most . So the nullity is at least when , and at most , 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 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 and compare it with the zero vector. This costs one matrix-vector product and requires no reduction. In floating point, compare against 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 of size with ; the left null space consists of vectors of size with , equivalently combinations of the rows of that vanish. The two live in different spaces and generally have different dimensions, related by and respectively.
References
- 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.
- ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
- Golub, G. H. and Van Loan, C. F. Matrix Computations, 4th edition. Johns Hopkins University Press, 2013.
- Strang, G. 'The fundamental theorem of linear algebra'. American Mathematical Monthly, 100(9), 1993.
- 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
Compute a spanning set for from the free variables, with the nullity reported and each vector verified.
Matrix Rank & Nullity CalculatorReport and for any matrix, by exact elimination or by singular values with a selectable tolerance.
Null Space Membership TestEvaluate for a candidate vector and report the residual norm against a scaled tolerance.
