← LibrarySpanning Sets of Null Spaces | KEVOS® MathematicsProject Delivery · Project ManagementLesson 149/189← PrevNext →
ArticlePublished 8 Aug 202620 min readBy Kevin Jogin
Skip to content

Engineering/Mathematics/Vectors

Spanning Sets of Null Spaces

The null space of a matrix is an infinite set, yet nr 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
nr, one per free variable
Result
N(A)=span({z1,,znr})
Extra property
The vectors are automatically linearly independent
Needs the system?
No — built directly from the reduced matrix

Overview

The null space of an m×n 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 nr vectors, one for each free variable, and their span is the null space. Every entry of every vector is a 1, a 0, 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 fj 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 nr is therefore the nullity.

Definition

Spanning Sets for Null Spaces

SSNS

Let A be an m×n matrix and let B be a row-equivalent matrix in reduced row-echelon form with r non-zero rows, pivot column indices D={d1,,dr} and non-pivot column indices F={f1,,fnr}. Define nr vectors zj of size n by

  • [zj]i=1 when i=fj;
  • [zj]i=0 when iF and ifj;
  • [zj]i=[B]k,fj when i=dkD.
Then N(A)=span({z1,z2,,znr}).

When r=n there are no free variables, the list is empty, and the span of the empty set is taken to be {0} — consistent with a nonsingular matrix having a trivial null space.

Null Space of a Matrix

NSM

For an m×n matrix A, the null space is N(A)={xnAx=0}: the solution set of the homogeneous system with coefficient matrix A. It always contains 0 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 c takes its dependent entries from that column, so c=0.

What remains is a plain linear combination of the zj 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 A alone, identify the non-pivot columns, and for each build a vector of size n: place a 1 in that column's own position, 0 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 k of the non-pivot column, negated, goes into position dk — not position k. When the pivots do not sit on the diagonal, ignoring this is the standard route to a wrong answer.

Why the negation appears

Row k of the reduced matrix reads xdk+j[B]k,fjxfj=0, because the leading one in column dk is alone in its column and the right-hand side is zero. Solving for the dependent variable gives xdk=j[B]k,fjxfj.

Setting xfj=1 and all other free variables to zero leaves xdk=[B]k,fj, 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 α1z1++αnrznr=0 and read entry fj. Only zj has a non-zero entry there, and it is 1, so entry fj of the combination is αj. Hence αj=0 for every j, 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 nr 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 A, 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 A and that both sets have the same cardinality nr; if so, they describe the same space.

What the vectors mean physically

Each zj 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 nr 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

Row-reduce the coefficient matrixReduce A alone to its reduced row-echelon form B. The augmented column of zeros is unnecessary.
Partition the columnsRecord the pivot indices D={d1,,dr} and the non-pivot indices F={f1,,fnr}.
Is nr=0?If the rank equals the number of columns there are no free variables and N(A)={0}. Stop.
Lay in the ones and zerosCreate nr vectors of size n. In vector j put 1 at position fj and 0 at every other position in F.
Distribute the negated columnFor vector j, take column fj of B and place its negated entry k at position dk, for k=1,,r.
VerifyConfirm Azj=0 for every j using the original matrix, not the reduced one.

Equations

Null space as a span

EQ-SSNS-01
N(A)=span({z1,z2,,znr})

An infinite subspace described exactly by nr vectors of size n.

Entries of the spanning vectors

EQ-SSNS-02
[zj]i={1i=fj0iF,ifj[B]k,fji=dkD

The 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-03
N(A)={xnAx=0}

The condition being converted into a description. Membership is easy to test and impossible to enumerate.

Pivot row of a homogeneous system

EQ-SSNS-04
xdk=[B]k,f1xf1[B]k,f2xf2[B]k,fnrxfnr

Row k 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-05
[j=1nrαjzj]fk=αk

Entry fk of any combination equals its own coefficient, so a vanishing combination forces every coefficient to vanish. The vectors are therefore independent.

Nullity

EQ-SSNS-06
nullity(A)=dimN(A)=nr

Because the constructed set is both spanning and independent, its size is the dimension of the null space.

Trivial null space criterion

EQ-SSNS-07
N(A)={0}r=n

Full column rank leaves no free variables, so the construction produces no vectors and the null space collapses to the origin.

Variable Definitions

Symbols used on this page
SymbolNameMeaningDomain / type
ACoefficient matrixThe m×n matrix whose null space is soughtm x n matrix
BReduced formReduced row-echelon form of Am x n matrix
zjSpanning vectorNull space vector associated with free variable xfjvector in C^n
DPivot index setColumns of the reduced form carrying a leading onesubset of 1..n
FNon-pivot index setColumns with no leading one; the free variablessubset of 1..n
rRankNumber of non-zero rows of the reduced form0 to min(m,n)
nrNullityNumber of spanning vectors; dimension of the null spacenon-negative integer
N(A)Null spaceSet of all vectors annihilated by Asubspace of C^n
[B]k,fjNon-pivot entryEntry of the reduced form in pivot row k and free column fjcomplex 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.

  1. The sensitivity matrix

    Four sensors respond to five branch quantities according to A. Any state change in the null space produces no reading anywhere, and is therefore invisible to the instrumentation.

    A=[11103102132111421110]
  2. 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 r=3 non-zero rows.

    B=[10201013040001200000]
  3. Partition the columns

    Leading ones appear in columns 1, 2 and 4, so D={1,2,4} with d1=1, d2=2, d3=4. The remaining columns give F={3,5} with f1=3 and f2=5. Two spanning vectors are required, since nr=53=2.

  4. Build the first vector from column 3

    Place 1 at position f1=3 and 0 at position 5. Column 3 of B is (2,3,0) across the three pivot rows; negated, its entries go into positions d1=1, d2=2 and d3=4 as 2, +3 and 0.

    z1=[23100]
  5. Build the second vector from column 5

    Place 1 at position f2=5 and 0 at position 3. Column 5 of B is (1,4,2) across the pivot rows; negated, its entries go into positions 1, 2 and 4 as +1, 4 and 2.

    z2=[14021]
  6. Verify against the original matrix

    Row 1 of A against z1: 2+31+0+0=0. Row 2: 2+0+2+0+0=0. Row 3: 4+3+1+0+0=0. Row 4: 4+3+1+0+0=0. All four vanish, so z1N(A).

    Az1=0,Az2=0
  7. Verify the second vector

    Row 1 of A against z2: 14+0+0+3=0. Row 2: 1+0+0+23=0. Row 3: 24+02+4=0. Row 4: 24+0+2+0=0. Both vectors are confirmed.

  8. State the null space

    The spanning set is complete, and its 0/1 pattern in positions 3 and 5 guarantees independence, so it is in fact a basis and the nullity is 2.

    N(A)=span({[23100],[14021]})
Result

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

Structural engineering

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.

Metrology & instrumentation

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.

Chemical engineering

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.

Robotics

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.

Power & utility networks

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.

Statistics & machine learning

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 A alone — but then do not mistake column n for a constants column when reading the pivot pattern.

Watch the pivot positions, not the row numbers

The negated entry from pivot row k goes into position dk of the vector, which equals k only when the pivots happen to sit on the diagonal. Record D 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 r 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.

Applicable standards, conventions and reference implementations
ReferenceTitleRelevance to this topic
ISO 80000-2Quantities and units — Part 2: MathematicsFixes the notation for the null space, spans and the case-defined entries used to specify the constructed vectors.
LAPACK / BLAS referenceLinear Algebra PACKage reference implementationAn 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-2019IEEE Standard for Floating-Point ArithmeticGoverns the rounding of the reduction, and hence the rank decision that fixes how many spanning vectors are produced.
ISO/IEC 40314Mathematical Markup Language (MathML) Version 3.0Encodes the case-defined entry specification and the column vectors so they remain machine-readable and navigable.
IEC 61970Energy 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 and precision selection
RepresentationSelect whenTrade-off
Exact rational arithmeticSymbolic 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 denominatorsInteger 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 basisMeasured 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 reductionWell-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 orderingLarge 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 arithmeticCoding theory, where the null space of a parity-check matrix is the code itself.Exact, fast and yields a genuinely finite space of size qnr, 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 O(mnmin(m,n)) operations. Assembling the nr vectors afterwards involves no arithmetic beyond sign changes and costs O(n(nr)) 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 dk 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 Azj=0 against the original matrix, not the reduced one, so that an arithmetic slip during reduction is caught. Also confirm the count is nr: 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 nr vectors, that each vector of one is annihilated by A, 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 modes, root causes and prevention
Failure mode / mistakeImpactRoot causePrevention & detection
Omitting the negationhighCopying entries of the free column into the pivot positions without changing sign.Derive the entries from the explicit equation xdk=j[B]k,fjxfj rather than from memory, and verify with Azj=0.
Placing the negated entries in the wrong positionshighPutting entry k of the free column at position k instead of position dk.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 vectorshighCounting zero rows or pivot columns instead of non-pivot columns.The count is nr where n is the number of columns of A. Cross-check that the number of vectors equals the number of free variables.
Including the augmented column as a free variablemediumReducing an augmented matrix of zeros and treating column n+1 as a variable column.Reduce the coefficient matrix alone, or explicitly exclude index n+1 from F.
Using an echelon form instead of the reduced formmediumStopping 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 onelowTreating 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 pointhighA 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 systemmediumForgetting 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 1 and the rest to 0 produces one solution, and every solution is a combination of these. The count is nr, 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 fj only zj is non-zero, and there it equals 1, so entry fj of any combination is its own coefficient αj. 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 {0}. 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 c=0 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

  1. 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.
  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. Pellegrino, S. and Calladine, C. R. Matrix analysis of statically and kinematically indeterminate frameworks. International Journal of Solids and Structures, 22(4), 1986.
  5. 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

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