← LibraryTesting Subspaces | KEVOS® MathematicsProject Delivery · Project ManagementLesson 157/189← PrevNext →
ArticlePublished 8 Aug 202621 min readBy Kevin Jogin
Skip to content

Engineering/Mathematics/Vector Spaces

Testing Subspaces

A subset of a vector space is a subspace precisely when it is non-empty and closed under both operations — three conditions instead of ten axioms. The saving is not cosmetic: it turns subspace verification into a routine two-line calculation and makes whole families of sets recognisable at sight.

  • Core level
  • Stream: subspaces
  • Reading time 14 min
  • Ref KVS-ENG-MATH-0060
Taxonomy
Engineering / Mathematics
Prerequisite
Definition of a subspace; the ten vector space axioms
Test
Non-empty, closed under +, closed under scalar multiplication
Logical form
Equivalence — usable in both directions
Fastest disqualifier
0W
Immediate corollary
N(A) is a subspace of n

Overview

Verifying a subspace straight from the definition means walking all ten vector space axioms. Most of that walk is wasted effort, because six of the axioms are universally quantified identities that a subset inherits from its parent space for free, and a seventh — the existence of additive inverses — follows from closure under scalar multiplication via (1)u=u. What remains is a short, sharp test.

The result is stated as an equivalence: a subset W of a vector space V, endowed with V's operations, is a subspace if and only if W is non-empty, closed under vector addition and closed under scalar multiplication. Because it is an equivalence and not merely an implication, it works in both directions. Three conditions establish a subspace; the failure of any one of them refutes a subspace.

The non-emptiness condition is easy to under-rate. It is what supplies the zero vector: pick any zW, use scalar closure to place z in W, then use additive closure to place z+(z)=0 in W. In practice the condition is checked by exhibiting a single member, and the member usually chosen is 0 itself, which is why the zero-vector screen is the standard opening move.

The payoff extends well beyond individual verifications. The same three conditions prove, in a few lines each, that the null space of a matrix is a subspace, that a span is a subspace, and that upper-triangular matrices, trace-free matrices and polynomials vanishing at a fixed point are subspaces of their respective ambient spaces. Once these general results are available, most sets encountered in practice are recognised rather than verified.

Definition

Testing Subsets for Subspaces

TSS

Let V be a vector space and let WV carry the same vector addition and scalar multiplication as V. Then W is a subspace of V if and only if all three of the following hold:

  • W is non-empty, W;
  • if xW and yW then x+yW;
  • if α and xW then αxW.

Paraphrase: a subspace is a non-empty subset of a vector space that is closed under vector addition and scalar multiplication. The hypothesis that V is a vector space is doing real work and must not be dropped.

Trivial Subspaces

TS

For a vector space V, both V itself and the single-element set {0} satisfy the three conditions and are therefore subspaces. They are called the trivial subspaces of V.

Null Space of a Matrix is a Subspace

NSMS

Let A be an m×n matrix. Then the null space N(A)={xnAx=0} is a subspace of n.

Proved directly from the three conditions using distributivity of the matrix-vector product over addition and its commutation with scalars.

Concepts

Why three conditions suffice

The reverse implication is the substantive half. Assume the three conditions. Additive and scalar closure are two of the ten axioms outright. Six more — commutativity, associativity of addition, associativity of scalar multiplication, both distributive laws and 1u=u — are identities holding for every vector of V, hence for every vector of the subset W; restricting a universally quantified true statement cannot make it false. That leaves additive inverses and the zero vector, and both are manufactured from the three conditions rather than assumed.

Manufacturing inverses and the zero vector

For xW, scalar closure with α=1 gives (1)xW, and in any vector space (1)x=x, so additive inverses live inside W. For the zero vector, non-emptiness supplies some zW; the previous sentence supplies zW; additive closure then supplies z+(z)=0W. This chain is the reason non-emptiness cannot be dropped from the list — without a starting vector there is nothing to build the zero vector from.

The forward direction and its use as a refutation tool

The forward implication is immediate: a subspace is a vector space, so it contains a zero vector (hence is non-empty) and satisfies both closure axioms. Its practical value is contrapositive. To show a set is not a subspace it is enough to exhibit one specific failure — one pair of vectors whose sum escapes, or one scalar and one vector whose product escapes. A single counterexample settles the matter; no general argument is needed.

The three standard modes of failure

Candidate sets fail in three recognisable ways.

  • No zero vector: {x23x15x2=12} fails because 3(0)5(0)=012. Any non-zero constant on the right-hand side does this.
  • Additive closure fails: {x2x1x2=0} contains 0, and contains (1,0) and (0,1), but their sum (1,1) has x1x2=1. A product condition is non-linear and does not survive addition.
  • Scalar closure fails: {x2x1,x2} contains 0 and is closed under addition, but 12(2,3)=(1,32) escapes.
The three examples are worth memorising, because they map onto the three conditions exactly.

The null space as the flagship application

The three-condition test proves in half a page that N(A) is a subspace of n. Non-emptiness holds because A0=0, so a homogeneous system is always consistent. Additive closure follows from A(x+y)=Ax+Ay=0+0=0. Scalar closure follows from A(αx)=α(Ax)=α0=0. Both steps are properties of the matrix-vector product, not of the particular matrix, so the result holds for every A.

Recasting as a null space is often faster than testing

A set defined by several simultaneous homogeneous linear conditions on the entries of a vector can be tested condition by condition, which grows tedious quickly. It is faster to read the conditions as the rows of a coefficient matrix A, observe that the set is exactly N(A), and cite the null space theorem. The recognition step costs nothing and returns a spanning set as a by-product once the system is solved.

Decision path: is W a subspace of V?

Is V a vector space and does W inherit its operations?If the operations differ, the question of subspace does not arise. Confirm containment and operation inheritance first.
Can the set be recognised?If W is a null space, column space, row space, left null space or a span, cite the corresponding theorem and stop.
Is 0W?If no, W is not a subspace — stop. If yes, non-emptiness is settled and the closure tests remain.
Is W closed under addition?Take arbitrary x,yW and verify x+y passes the membership test. To refute, exhibit one escaping pair.
Is W closed under scalar multiplication?Take arbitrary α and xW and verify αx passes. To refute, exhibit one escaping scalar.
ConcludeAll three conditions met means W is a subspace, hence a vector space, and every vector space theorem applies to it.

Equations

The three-condition subspace test

EQ-TSS-01
Wis a subspaceWand(x,yWx+yW)and(α,xWαxW)

The equivalence in full. Both directions are used in practice: left to right to refute, right to left to establish.

Constructing the zero vector from the three conditions

EQ-TSS-02
zW(1)z=zW0=z+(z)W

Non-emptiness plus the two closure conditions deliver the zero vector. This is why 0W need not be assumed separately.

Additive closure of a null space

EQ-TSS-03
A(x+y)=Ax+Ay=0+0=0

Distributivity of the matrix-vector product over vector addition is the entire content of the additive closure step for N(A).

Scalar closure of a null space

EQ-TSS-04
A(αx)=α(Ax)=α0=0

Scalars commute past the matrix-vector product, so a scaled null space vector remains in the null space for every α.

Recasting simultaneous homogeneous conditions as a null space

EQ-TSS-05
W={x53x1+x25x3+7x4+x5=04x1+6x2+3x36x45x5=02x1+4x2+7x4+x5=0}=N(A)

The rows of the conditions become the rows of A. Recognition replaces three separate closure arguments with one citation.

A set that fails additive closure

EQ-TSS-06
[10]+[01]=[11]{x2x1x2=0}

A single escaping pair is a complete refutation. Note that the set does contain the zero vector, so the zero-vector screen alone would have passed it.

A set that fails scalar closure

EQ-TSS-07
12[23]=[132]{x2x1,x2}

The integer lattice contains 0 and is closed under addition, yet fails the third condition. All three conditions must be checked.

Variable Definitions

Symbols used on this page
SymbolNameMeaningDomain / type
VParent vector spaceThe ambient space whose axioms and operations W inheritsany vector space
WCandidate subsetThe subset being tested for subspace statussubset of V
zWitness vectorAny single member exhibited to establish non-emptinesselement of W
αScalarArbitrary multiplier in the scalar closure conditioncomplex number
ACoefficient matrixMatrix whose rows are the homogeneous conditions defining Wm x n matrix
N(A)Null spaceAll x with Ax=0; a subspace of nsubspace of C^n
Empty setThe set with no members; disqualified by the first conditionset
tr(S)TraceSum of the diagonal entries of a square matrix; a linear function of the entriescomplex number
M33Matrix spaceAll 3×3 matrices with complex entriesvector space of dimension 9

Worked Numerical Example

Problem statement

In plasticity modelling a stress state is decomposed into a hydrostatic part and a deviatoric part. The deviatoric states are the symmetric 3×3 matrices of zero trace. Establish that these form a subspace of M33 using the three-condition test, then show that two nearby-looking sets fail it.

  1. Fix the ambient space and the membership test

    Take V=M33, the 3×3 matrices with entrywise addition and scalar multiplication, which is a vector space. The candidate is the set of deviatoric states:

    W={SM33St=S and tr(S)=0}
  2. Condition one — non-empty

    Exhibit a member. The matrix with 1 in position (1,1), 1 in position (2,2) and zeros elsewhere is symmetric and has trace 11+0=0, so it lies in W and W. The zero matrix also qualifies, which is the usual choice.

    S0=[100010000],S0t=S0,tr(S0)=0
  3. Condition two — additive closure

    Let S,TW, so St=S, Tt=T, tr(S)=0 and tr(T)=0. Transposition and trace are both additive, so both parts of the membership test survive the sum:

    (S+T)t=St+Tt=S+T,tr(S+T)=tr(S)+tr(T)=0+0=0
  4. Condition three — scalar closure

    Let α and SW. Scalars pass through both transposition and trace:

    (αS)t=αSt=αS,tr(αS)=αtr(S)=α0=0
  5. Conclude for W

    All three conditions hold, so W is a subspace of M33 and therefore a vector space in its own right. Note what was not done: no commutativity, associativity or distributivity was checked, and no zero matrix or additive inverse was verified. The theorem supplied all seven remaining axioms.

  6. Counterexample one — a fixed non-zero pressure

    Replace the trace condition by tr(S)=3p0 with p00, describing states at one specified hydrostatic pressure. The zero matrix has trace 03p0, so 0W and the set is not a subspace. Superposition of two such states doubles the pressure, which is the physical reading of the same failure.

  7. Counterexample two — singular stress states

    Take the set of 3×3 matrices with det(S)=0, that is, stress states with at least one zero principal value. This set does contain the zero matrix, so the zero-vector screen passes. But additive closure fails:

    [100000000]+[000010001]=[100010001],det=10
  8. Read the counterexamples against the conditions

    The first set fails condition one by way of the zero vector; the second fails condition two despite containing the zero vector. Together they show why the zero-vector screen is a filter and not a proof, and why the determinant condition — being non-linear in the entries — cannot define a subspace.

Result

Deviatoric stress states form a six-dimensional subspace of the nine-dimensional space M33: symmetry removes three degrees of freedom and the trace condition removes one more. Because it is a subspace, deviatoric states may be superposed and scaled freely without leaving the deviatoric family, which is exactly the property that yield criteria such as von Mises depend on. The fixed-pressure family and the singular family have no such property, and any code that treats them as linear will produce inadmissible states.

Applications & Industry Use

Mechanical engineering

Deviatoric decomposition in plasticity

Yield criteria are formulated on the deviatoric part of the stress tensor. Establishing that deviatoric states form a subspace justifies projecting a stress state onto it linearly, and guarantees that the projection of a superposed load case is the superposition of the projections.

Electrical engineering

Zero-sequence-free current sets

In a balanced three-phase system the currents summing to zero form the null space of a single row vector of ones, hence a subspace. Filters and transformations that operate on this set can be applied to sums of load patterns without re-checking the balance condition.

Aerospace engineering

Trim-constrained control allocation

Actuator commands producing zero net moment about a chosen axis satisfy a homogeneous linear condition, so they form a subspace of the command space. Control allocation exploits this by adding null-space commands to redistribute effort without disturbing the trimmed state.

Chemical engineering

Element-conserving reaction vectors

Reaction extents that conserve every element are the null space of the atomic composition matrix. Recognising this set as a subspace, rather than testing it condition by condition, immediately gives the number of independent reactions as its dimension.

Computer graphics

Volume-preserving linear deformations

To first order, volume-preserving deformations are the trace-free matrices, which form a subspace of M33. Interpolating between two such deformations linearly stays inside the family, which is why trace-free representations are preferred for blending.

Data engineering

Centred and contrast-coded feature sets

Contrast codings in experimental design require coefficient vectors summing to zero. That set is a subspace, so contrasts can be added and rescaled and remain valid contrasts, which underpins the algebra of orthogonal contrast families.

Design Considerations

Recognise before you verify

The cheapest subspace proof is a citation. Before starting closure arguments, check whether the set is a null space, a column space, a row space, a left null space or a span, since each is a subspace by a standing theorem. Only genuinely novel descriptions warrant the three-condition test from scratch.

One counterexample refutes; no counterexample proves nothing

Because the test is an equivalence, exhibiting a single escaping sum or a single escaping scalar multiple is a complete refutation. The converse asymmetry matters: failing to find a counterexample after sampling is not evidence of a subspace. Establishing one requires an argument for arbitrary x, y and α.

Use arbitrary vectors, not examples, in the closure arguments

The additive and scalar closure conditions are universally quantified. A proof must begin "let x and y be arbitrary elements of W" and use only what membership guarantees. Substituting specific numbers demonstrates nothing beyond that particular pair, and is the single most common flaw in written verifications.

Watch the scalar field

Scalar closure must hold for every scalar in the field under consideration. A set closed under real scaling but not complex scaling is not a subspace of a complex vector space. Similarly, the integer lattice is closed under integer scaling but fails over or , which is precisely the third standard counterexample.

Non-linear membership tests are almost never subspaces

Determinant conditions, products of entries, ranks bounded above, norms bounded above and rank-one constraints all define sets that contain 0 but fail additive closure. If the membership test is not a system of homogeneous linear equations in the coordinates, expect failure and look for the counterexample rather than a proof.

Numerical tolerance changes the question

In floating point a residual is never exactly zero, so "Ax=0" becomes "Ax below a tolerance", and the tolerance-defined set is not a subspace: adding two vectors that each just satisfy the tolerance can produce one that does not. Keep the mathematical subspace and the numerical test conceptually separate, and document the tolerance.

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 set membership, the empty set , logical equivalence and the upright rendering of operator names such as tr and det used throughout the test.
IEEE 754-2019IEEE Standard for Floating-Point ArithmeticExplains why a numerically evaluated membership test yields a small residual rather than an exact zero, so the tolerance-defined set fails closure even when the underlying mathematical set does not.
LAPACK / BLAS referenceLinear Algebra PACKage reference implementationSupplies the rank-revealing routines (xGESVD, xGEQP3) used to obtain a basis for a null space in practice, which is the computational form of the null space subspace theorem.
ISO/IEC 40314Mathematical Markup Language (MathML) Version 3.0Encodes the set-builder notation and matrix displays used for the counterexamples, so their structure is machine-readable.
W3C WCAG 2.1 AAWeb Content Accessibility GuidelinesRequires the three test conditions to be presented as a semantic list rather than as an image, so the structure of the test is available to assistive technology.

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 arithmeticCertifying that a described set really is a subspace, or constructing an exact counterexample.The membership residual is exactly zero or not, so the verdict is unambiguous; intermediate coefficients can grow during elimination.
Symbolic entriesProving closure for a family of sets parameterised by unspecified constants, as in the deviatoric example.Handles the required "arbitrary vector" quantifier directly, but expression swell makes it impractical beyond modest sizes.
IEEE 754 binary64Testing membership of computed vectors against constraints derived from measured or meshed data.Efficient and standard, but membership becomes a tolerance decision and the tolerance-defined set is not itself closed.
Integer entries with exact testsCombinatorial or coding-theoretic settings where the constraint matrix has integer entries.Exact and fast, but note that restricting the vectors to integers destroys scalar closure and is a classic non-subspace.
Sparse constraint storageThe membership test consists of many conditions each involving a few coordinates.Makes very large null spaces tractable, but the closure verification must be phrased as a sparse matrix-vector product rather than an entrywise identity.
Symmetric packed storageThe ambient space is symmetric matrices, as for stress and covariance states.Halves memory and enforces the symmetry condition structurally, but the trace condition still has to be imposed explicitly.

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 test in practice

For a set defined by an m×n homogeneous constraint matrix, checking that a candidate vector is a member costs one matrix-vector product, about 2mn operations. The closure argument itself is symbolic and executes once at design time. Computing a basis for the resulting subspace costs a factorisation, roughly O(mn2) for a dense matrix.

Writing the proof by hand

Use a fixed template. Line one exhibits a member. Line two takes arbitrary x,yW, records exactly what membership gives, and evaluates the membership test on x+y. Line three does the same for αx. Deviating from the template usually means an unjustified assumption has been introduced about the particular vectors.

Constructing counterexamples systematically

To refute additive closure on a set defined by a non-linear condition, choose two vectors whose supports are disjoint, since the cross terms that break the condition then appear cleanly in the sum. To refute scalar closure on a discretely defined set, use a scalar of 12. Both recipes succeed on the first attempt for the standard families.

Library behaviour

SymPy's Matrix.nullspace returns an exact basis and so certifies the subspace directly. SciPy's scipy.linalg.null_space returns an orthonormal basis from an SVD with a singular value cutoff, so it returns a numerically defined approximation whose dimension depends on the tolerance passed. Neither library has a general subspace predicate; the recognition step remains the caller's responsibility.

Verification by round trip

After computing a basis B for a claimed subspace defined by Ax=0, verify AB=0 to machine precision and check that the number of basis vectors equals n minus the rank of A. A dimension mismatch usually indicates a tolerance set too loosely, admitting near-null directions as exact ones.

Failure Modes & Common Mistakes

Failure modes, root causes and prevention
Failure mode / mistakeImpactRoot causePrevention & detection
Omitting the non-emptiness conditionhighAssuming closure alone is sufficient; the empty set satisfies both closure conditions vacuously yet is not a subspace.Always exhibit an explicit member, normally by checking that 0 passes the membership test.
Proving closure with specific vectorshighSubstituting numeric examples instead of arbitrary x and y, so the universal quantifier is never discharged.Begin every closure argument with arbitrary symbolic members and use only the properties membership guarantees.
Accepting a set because 0 belongs to ithighTreating the zero-vector screen as sufficient; sets such as {x1x2=0} and {det=0} pass it and are not subspaces.Follow the screen with both closure checks, or find a counterexample if the condition is non-linear.
Checking only real scalarsmediumVerifying scalar closure for positive or real α only, missing failures at negative or complex values.Test with α=1 and, over , with a genuinely complex scalar before concluding.
Applying the test when the operations differmediumUsing the theorem on a subset that carries its own addition or scaling, so the inherited-axiom argument does not apply.State that W is endowed with the operations of V as an explicit hypothesis of every application.
Missing that a set is affine, not linearmediumA constraint exported with a non-zero right-hand side describes a translate of a subspace, not a subspace.Assert the right-hand side is zero, or decompose the set as a particular vector plus the associated homogeneous set.
Treating a numerical tolerance set as a subspacemediumDefining membership as a residual below a threshold; two members can sum to a non-member.Keep the mathematical subspace and its numerical test distinct, and never form long linear combinations of tolerance-qualified vectors.
Forgetting to verify containment in VlowTesting closure for a set whose elements are not actually elements of the claimed parent space, for example mismatched sizes.Confirm the type and size of every member against the parent space before starting.

FAQs

Why is non-emptiness listed separately when closure seems to imply it?

It does not. The empty set satisfies both closure conditions vacuously — there are no pairs to test — but has no zero vector, so it is not a vector space. Non-emptiness supplies a starting vector from which scalar and additive closure manufacture the zero vector.

Can I just check that the zero vector is in the set?

No. It is a necessary condition and an excellent first filter, but not sufficient. The set of vectors in 2 with x1x2=0 contains the zero vector and fails additive closure; the integer lattice contains it and fails scalar closure. Both closure conditions still have to be verified.

Do I need to check that additive inverses lie in the set?

No. Scalar closure with α=1 gives (1)xW, and in any vector space (1)x=x. The additive inverse axiom is therefore a consequence of the three conditions and is proved once inside the theorem rather than checked each time.

Why does the theorem require V to be a vector space?

Because six of the ten axioms are inherited from V by restriction. If V were merely a set with two operations, commutativity and the distributive laws would not be available to inherit, and the three conditions would prove nothing. The hypothesis is doing genuine work.

Is the intersection of two subspaces a subspace?

Yes, and the three-condition test proves it quickly. The intersection contains 0 since both subspaces do; a sum of two members lies in each subspace by their individual closure, hence in the intersection; the same argument handles scalar multiples. Unions, by contrast, are almost never subspaces.

Is the set of n×n matrices of rank at most k a subspace?

No, except in the degenerate cases k=0 or kn. It contains the zero matrix and is closed under scalar multiplication, but rank is subadditive rather than additive: two rank-one matrices can sum to a rank-two matrix. This is one of the most frequently mis-stated examples in applied work.

How does the null space theorem shorten a verification?

A set described by several simultaneous homogeneous linear conditions on the coordinates is exactly the null space of the matrix whose rows are those conditions. Recognising the pattern replaces a condition-by-condition closure argument with one citation, and solving the system supplies a spanning set at the same time.

References

  1. Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section S, Subsection TS, Theorem TSS. Licensed under the GNU Free Documentation License v1.2.
  2. Halmos, P. R. Finite-Dimensional Vector Spaces, 2nd edition. Springer, 1974.
  3. Horn, R. A. and Johnson, C. R. Matrix Analysis, 2nd edition. Cambridge University Press, 2013.
  4. ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
  5. Anderson, E. et al. LAPACK Users' Guide, 3rd edition. Society for Industrial and Applied Mathematics, 1999.

AI Suggested Questions

  • Give me a subset of M22 that contains the zero matrix, is closed under scalar multiplication, and still fails to be a subspace.
  • Prove that the intersection of two subspaces is a subspace, then show by example that the union usually is not.
  • Why does the set of matrices of rank at most one fail additive closure, and what is the smallest counterexample?
  • Show how a set defined by four simultaneous homogeneous conditions on 7 becomes a null space, and compute its dimension.
  • In floating-point arithmetic, how should I define membership in a null space so that the tolerance is defensible?
  • Walk me through the three-condition test for the set of upper-triangular matrices inside Mnn.

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