Engineering/Mathematics/Vectors
Spanning Sets of Null Spaces
The null space of a matrix is an infinite set, yet vectors read straight off the reduced row-echelon form span it exactly. Each free variable contributes one vector, built from a single one, zeros in the other free positions and the negated entries of its column.
- Core level
- Stream: subspaces
- Reading time 14 min
- Ref KVS-ENG-MATH-0023
- Taxonomy
- Engineering / Mathematics
- Prerequisite
- Null space; span; reduced row-echelon form
- Vector count
- , one per free variable
- Result
- Extra property
- The vectors are automatically linearly independent
- Needs the system?
- No — built directly from the reduced matrix
Overview
The null space of an matrix is the set of all vectors annihilated by it. Defined that way it is a condition, not a description: you can test membership but you cannot list the members, and for any matrix with a non-trivial null space there are infinitely many. Turning that condition into a finite description is what this construction does.
The recipe produces exactly vectors, one for each free variable, and their span is the null space. Every entry of every vector is a , a , or the negative of an entry from a non-pivot column of the reduced row-echelon form. No arithmetic beyond sign changes is required once the reduction is complete, which makes the construction mechanical enough to be implemented directly and quick enough to be done by hand.
Structurally this is the homogeneous specialisation of the vector form of a general solution set. Because the constants column of a homogeneous system is zero and stays zero under every row operation, the fixed vector vanishes and the solution set degenerates from an affine translate into a pure span. That is precisely why the null space is a subspace while a general solution set is not.
The vectors carry a bonus that the statement does not advertise. The rigid pattern of a single one in position and zeros in all other free positions makes any non-trivial combination of them non-zero, so the set is automatically linearly independent. A spanning set that is also independent is a basis, so this construction delivers a basis for the null space at no extra cost — and the count is therefore the nullity.
Definition
Spanning Sets for Null Spaces
SSNSLet be an matrix and let be a row-equivalent matrix in reduced row-echelon form with non-zero rows, pivot column indices and non-pivot column indices . Define vectors of size by
- when ;
- when and ;
- when .
When there are no free variables, the list is empty, and the span of the empty set is taken to be — consistent with a nonsingular matrix having a trivial null space.
Null Space of a Matrix
NSMFor an matrix , the null space is : the solution set of the homogeneous system with coefficient matrix . It always contains and is closed under addition and scalar multiplication.
Concepts
Why the fixed vector disappears
Apply the general vector-form construction to the augmented matrix of the homogeneous system. Its final column is entirely zero, and every elementary row operation maps a zero column to a zero column, so the reduced form also has a zero final column. The fixed vector takes its dependent entries from that column, so .
What remains is a plain linear combination of the with the free variables as coefficients — that is, a span. This is the exact point at which a solution set stops being an affine translate and becomes a subspace, and it is the reason the null space, alone among solution sets, is closed under addition.
Reading the vectors straight from the reduced matrix
The construction does not require the homogeneous system to be written out. Row-reduce alone, identify the non-pivot columns, and for each build a vector of size : place a in that column's own position, in the other non-pivot positions, and distribute the negated entries of that column into the pivot positions in order.
The word in order carries the weight. Entry of the non-pivot column, negated, goes into position — not position . When the pivots do not sit on the diagonal, ignoring this is the standard route to a wrong answer.
Why the negation appears
Row of the reduced matrix reads , because the leading one in column is alone in its column and the right-hand side is zero. Solving for the dependent variable gives .
Setting and all other free variables to zero leaves , which is exactly the third clause of the definition. The sign is not a convention; it is the transposition of a term across an equals sign.
Automatic linear independence
Consider a combination and read entry . Only has a non-zero entry there, and it is , so entry of the combination is . Hence for every , and the only relation is the trivial one.
The set is therefore linearly independent as well as spanning, which makes it a basis of the null space. That yields the nullity as immediately, without any separate argument about dimension. The whole conclusion rests on the 0/1 pattern in the free positions.
Spanning sets are not unique
The vectors produced here are uniquely determined by , since the reduced row-echelon form is unique. The null space they span is not tied to them: any basis of that subspace describes it equally well, and an SVD-based routine returns an orthonormal basis with no zeros or ones in sight.
When two tools report different null space bases, the correct comparison is of the subspaces, not the vectors. Check that each reported vector is annihilated by and that both sets have the same cardinality ; if so, they describe the same space.
What the vectors mean physically
Each is a state the matrix cannot see: an internal redistribution producing no output. In an equilibrium matrix they are self-stress states, in a flow network they are circulating patterns, in a manipulator Jacobian they are self-motions, in a design matrix they are directions of parameter change that leave every prediction unaltered.
The count is therefore a direct measure of hidden freedom in a model. A large nullity often signals an over-parametrised or under-constrained formulation rather than a genuinely flexible design, and inspecting the individual vectors usually reveals which physical redundancy is responsible.
Constructing a spanning set for the null space
Equations
Null space as a span
EQ-SSNS-01An infinite subspace described exactly by vectors of size .
Entries of the spanning vectors
EQ-SSNS-02The complete recipe. Only the third clause involves data from the matrix, and it involves it only through a sign change.
Defining property of the null space
EQ-SSNS-03The condition being converted into a description. Membership is easy to test and impossible to enumerate.
Pivot row of a homogeneous system
EQ-SSNS-04Row of the reduced matrix solved for its dependent variable. Setting one free variable to one and the rest to zero yields the third clause above.
Independence from the free-position pattern
EQ-SSNS-05Entry of any combination equals its own coefficient, so a vanishing combination forces every coefficient to vanish. The vectors are therefore independent.
Nullity
EQ-SSNS-06Because the constructed set is both spanning and independent, its size is the dimension of the null space.
Trivial null space criterion
EQ-SSNS-07Full column rank leaves no free variables, so the construction produces no vectors and the null space collapses to the origin.
Variable Definitions
| Symbol | Name | Meaning | Domain / type |
|---|---|---|---|
| Coefficient matrix | The matrix whose null space is sought | m x n matrix | |
| Reduced form | Reduced row-echelon form of | m x n matrix | |
| Spanning vector | Null space vector associated with free variable | vector in C^n | |
| Pivot index set | Columns of the reduced form carrying a leading one | subset of 1..n | |
| Non-pivot index set | Columns with no leading one; the free variables | subset of 1..n | |
| Rank | Number of non-zero rows of the reduced form | 0 to min(m,n) | |
| Nullity | Number of spanning vectors; dimension of the null space | non-negative integer | |
| Null space | Set of all vectors annihilated by | subspace of C^n | |
| Non-pivot entry | Entry of the reduced form in pivot row and free column | complex scalar |
Worked Numerical Example
Problem statement
A five-branch measurement network yields four sensor equations. Determine every state change the instrumentation cannot detect — that is, produce a spanning set for the null space of the sensitivity matrix — and verify it against the original matrix.
The sensitivity matrix
Four sensors respond to five branch quantities according to . Any state change in the null space produces no reading anywhere, and is therefore invisible to the instrumentation.
Row-reduce the coefficient matrix alone
The system is homogeneous, so the constants column would remain zero throughout and is omitted. The reduced form has non-zero rows.
Partition the columns
Leading ones appear in columns , and , so with , , . The remaining columns give with and . Two spanning vectors are required, since .
Build the first vector from column 3
Place at position and at position . Column of is across the three pivot rows; negated, its entries go into positions , and as , and .
Build the second vector from column 5
Place at position and at position . Column of is across the pivot rows; negated, its entries go into positions , and as , and .
Verify against the original matrix
Row of against : . Row : . Row : . Row : . All four vanish, so .
Verify the second vector
Row of against : . Row : . Row : . Row : . Both vectors are confirmed.
State the null space
The spanning set is complete, and its 0/1 pattern in positions and guarantees independence, so it is in fact a basis and the nullity is .
Two independent state changes are invisible to this instrumentation, and every invisible change is a combination of them. The sensor set observes only a three-dimensional slice of a five-dimensional state space, so two additional independent sensors would be needed for full observability — and the two vectors say precisely which directions those sensors must be sensitive to.
Applications & Industry Use
Self-stress modes of a tensegrity
The null space of an equilibrium matrix is the space of member force distributions in equilibrium with no external load. The constructed vectors are an explicit basis of self-stress modes, and their count is the degree of static indeterminacy quoted in a design report.
Unobservable state directions
The null space of a sensitivity matrix contains exactly the state changes that produce no measurement. Building a basis identifies which physical quantities remain unresolved and guides sensor placement to eliminate them.
Independent reactions from an atomic matrix
The null space of the element-by-species matrix is the space of stoichiometrically valid reactions. The constructed vectors are a set of independent reactions, and the nullity is the number of extents that must be measured to close the mass balance.
Self-motion basis for redundant arms
For a manipulator with more joints than task degrees of freedom, the null space of the Jacobian is spanned by joint velocity patterns that hold the tool still. These are the directions used for secondary objectives such as obstacle and joint-limit avoidance.
Loop flows in a meshed network
For a network incidence matrix, the null space is spanned by circulating flows around independent loops. The nullity is the cyclomatic number of the graph, and the basis vectors are the loop patterns used to parametrise feasible dispatch.
Non-identifiable parameter directions
The null space of a design matrix contains the parameter changes that leave every fitted value unchanged. A basis shows which contrasts are unestimable, which determines what may honestly be reported and where regularisation is needed.
Design Considerations
Reduce the coefficient matrix, not an augmented one
For a homogeneous system the constants column is zero and remains zero, so carrying it is pure overhead. Reduce alone — but then do not mistake column for a constants column when reading the pivot pattern.
Watch the pivot positions, not the row numbers
The negated entry from pivot row goes into position of the vector, which equals only when the pivots happen to sit on the diagonal. Record explicitly during the reduction and index into it rather than assuming.
Prefer an orthonormal basis for numerical work
The pivot-based vectors are exact, readable and cheap, but they can be badly scaled and nearly parallel when the matrix is ill-conditioned. For measured data, use the trailing right singular vectors instead: they are orthonormal, well conditioned and come with a numerical rank criterion.
The nullity is a discontinuous quantity
A tiny perturbation can change and therefore the number of vectors produced. Any report of a null space from floating-point data must state the tolerance used and, ideally, the singular values on either side of it.
Interpret a large nullity before exploiting it
High nullity usually indicates over-parametrisation, duplicated constraints or a missing physical relation rather than genuine design freedom. Inspect the basis vectors for recognisable patterns before treating the freedom as available.
Preserve the variable ordering with the vectors
The vectors are meaningless without knowing which entry corresponds to which physical unknown, and a column permutation before reduction silently changes that mapping. Transmit the ordering alongside the vectors as part of the same record.
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 | Fixes the notation for the null space, spans and the case-defined entries used to specify the constructed vectors. |
LAPACK / BLAS reference | Linear Algebra PACKage reference implementation | An orthonormal null space basis is obtained from the trailing right singular vectors returned by xGESVD or xGESDD; no LAPACK routine produces the pivot-based vectors described here, which reflects the numerical preference for orthogonal methods. |
IEEE 754-2019 | IEEE Standard for Floating-Point Arithmetic | Governs the rounding of the reduction, and hence the rank decision that fixes how many spanning vectors are produced. |
ISO/IEC 40314 | Mathematical Markup Language (MathML) Version 3.0 | Encodes the case-defined entry specification and the column vectors so they remain machine-readable and navigable. |
IEC 61970 | Energy management system application program interface (CIM) | Standardises network topology models from which incidence matrices are built; the null space of such a matrix is the loop-flow space, so the construction operates directly on standardised data. |
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 | Symbolic or integer matrices where the basis must be exact and reportable. | Produces exactly the vectors the theorem describes with an unambiguous nullity, but coefficient growth limits the practical matrix size. |
| Integer basis by clearing denominators | Integer matrices where an integer-valued null space basis is wanted for downstream combinatorial use. | Removes fractions and is convenient for reaction or loop bases, but the vectors are no longer normalised and their magnitudes can vary widely. |
| IEEE 754 binary64 with SVD-based basis | Measured or simulated data where rank is approximate. | Gives an orthonormal, numerically stable basis with a defensible tolerance, at roughly an order of magnitude more arithmetic than elimination. |
| IEEE 754 binary64 with row reduction | Well-conditioned matrices where speed matters and the pivot pattern is trustworthy. | Cheap and preserves the readable 0/1 structure, but the vectors can be poorly scaled and the rank decision is fragile. |
| Sparse elimination with fill-reducing ordering | Large network or finite element matrices with a small nullity. | Keeps the factorisation tractable, but the resulting null space vectors are usually dense, so the output may dwarf the input. |
| Finite field arithmetic | Coding theory, where the null space of a parity-check matrix is the code itself. | Exact, fast and yields a genuinely finite space of size , but the structure need not mirror the rational case. |
Manufacturing Notes
Implementation notes — how the result is actually produced by hand, by algorithm and by library, including cost and numerical behaviour.
Cost profile
The reduction dominates: about operations. Assembling the vectors afterwards involves no arithmetic beyond sign changes and costs in data movement. Computing the null space is therefore essentially free once a reduction has been performed for another purpose.
Hand procedure
Work one free column at a time and complete a whole vector before starting the next. Write the ones and zeros in the free positions first, then walk down the free column of the reduced matrix, negating each entry and dropping it into the pivot position of the same row. Working entry-by-position rather than entry-by-row is what keeps the indexing straight.
Library behaviour
SymPy's Matrix.nullspace() returns exactly these vectors, complete with the 0/1 pattern. SciPy's scipy.linalg.null_space returns an orthonormal basis from the SVD with an rcond tolerance, and the two outputs will look nothing alike while spanning the same subspace. MATLAB's null(A) defaults to the orthonormal form and offers null(A,'r') for the rational, pivot-based one.
Verification technique
Check against the original matrix, not the reduced one, so that an arithmetic slip during reduction is caught. Also confirm the count is : a correct-looking vector set of the wrong size means the rank or the free-column identification is wrong.
Comparing two null space bases
To confirm that two bases describe the same subspace, verify that both have vectors, that each vector of one is annihilated by , and that each is in the span of the other — the last being one small consistency test per vector. Comparing the vectors entry by entry is not a valid test.
Failure Modes & Common Mistakes
| Failure mode / mistake | Impact | Root cause | Prevention & detection |
|---|---|---|---|
| Omitting the negation | high | Copying entries of the free column into the pivot positions without changing sign. | Derive the entries from the explicit equation rather than from memory, and verify with . |
| Placing the negated entries in the wrong positions | high | Putting entry of the free column at position instead of position . | Record the pivot index set explicitly and index through it. The two coincide only when the pivots lie on the diagonal. |
| Producing the wrong number of vectors | high | Counting zero rows or pivot columns instead of non-pivot columns. | The count is where is the number of columns of . Cross-check that the number of vectors equals the number of free variables. |
| Including the augmented column as a free variable | medium | Reducing an augmented matrix of zeros and treating column as a variable column. | Reduce the coefficient matrix alone, or explicitly exclude index from . |
| Using an echelon form instead of the reduced form | medium | Stopping after forward elimination, leaving non-zero entries above the leading ones. | Complete the back-clearing. The recipe assumes each pivot row expresses its dependent variable purely in terms of free variables. |
| Assuming the basis is the only one | low | Treating a differently shaped basis from another tool as a contradiction. | Compare subspaces, not vectors: check the counts match and that each vector of one set lies in the span of the other. |
| Spurious null space vectors in floating point | high | A small but genuine pivot rejected by a loose tolerance, inflating the nullity. | Use a scaled tolerance relative to the matrix norm, or compute the basis from the SVD and report the singular values around the cut. |
| Applying the construction to an inhomogeneous system | medium | Forgetting that the fixed vector vanishes only because the right-hand side is zero. | For a non-zero right-hand side use the full vector form, which adds a particular solution to this span. |
FAQs
Why is there exactly one vector per free variable?
Because the free variables parametrise the solution set: setting one of them to and the rest to produces one solution, and every solution is a combination of these. The count is , which is also the dimension of the null space.
Do I have to write out the homogeneous system?
No. The construction reads directly off the reduced row-echelon form of the coefficient matrix. Writing the system out is a useful check when learning the recipe, and it is how the signs are derived, but it is not part of the procedure.
Are the constructed vectors linearly independent?
Yes, automatically. In the free position only is non-zero, and there it equals , so entry of any combination is its own coefficient . A vanishing combination therefore forces all coefficients to vanish, making the set a basis.
What happens when the matrix has full column rank?
There are no free variables, no vectors are produced, and the null space is . For a square matrix that is exactly the nonsingular case, and it is why a nonsingular coefficient matrix gives a unique solution for every right-hand side.
How does this differ from the vector form of a general solution set?
It is the same construction with the fixed vector removed. For a homogeneous system the constants column of the reduced augmented matrix is zero, so and only the direction vectors remain — turning an affine translate into a span.
Why does SciPy give me completely different vectors?
Because it computes an orthonormal basis from the singular value decomposition rather than the pivot-based one. Both span the same subspace. The orthonormal basis is numerically better behaved; the pivot-based one is exact, sparser and easier to interpret against the original variables.
Can the spanning vectors be scaled or combined?
Yes. Any invertible recombination gives another basis of the same null space, and clearing denominators to obtain integer vectors is common practice for reaction and loop bases. Only the span is determined by the matrix; the particular vectors are determined by the procedure.
References
- Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section SS, Subsection SSNS. 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.
- Pellegrino, S. and Calladine, C. R. Matrix analysis of statically and kinematically indeterminate frameworks. International Journal of Solids and Structures, 22(4), 1986.
- Anderson, E. et al. LAPACK Users' Guide, 3rd edition. Society for Industrial and Applied Mathematics, 1999.
AI Suggested Questions
- Given a 4x6 matrix, produce the pivot-based null space basis and the orthonormal SVD basis, then verify they span the same subspace.
- Show what goes wrong if the negated entries are placed at row index k instead of pivot index d_k, using a matrix whose pivots are off-diagonal.
- For a graph incidence matrix, explain why the nullity equals the number of independent loops and exhibit the loop basis.
- How should the numerical rank tolerance be chosen so that the reported nullity of a measured matrix is defensible?
- Derive the third clause of the construction from the pivot-row equation, making the sign change explicit.
- Compare the null space basis produced by SymPy, SciPy and MATLAB on the same rank-deficient matrix and explain the differences.
Related Calculators
Construct the pivot-based spanning set for the null space of a matrix, with an orthonormal alternative.
RREF CalculatorReduce a matrix to reduced row-echelon form and report the pivot and free column index sets.
Matrix Rank & Nullity CalculatorCompute rank and nullity with a selectable tolerance, and list the singular values around the rank cut.
