Dimension Formulas for Subspaces

How large is the space you get by combining two subspaces? Suppose UU and WW are subspaces of a finite-dimensional vector space. Each has a known dimension. You also know how large their overlap U∩WU\cap W is. Is the dimension of the combined space U+WU+W determined by these three numbers? If so, how? This question is not idle bookkeeping. It is the linear-algebraic shadow of inclusion–exclusion. It governs everything from counting solutions of simultaneous linear systems to computing ranks of block matrices. The formula that answers this question, dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)\dim(U+W) = \dim U + \dim W - \dim(U\cap W), is one of the most quietly powerful identities in the subject. It converts a question about a sum into a question about intersections and dimensions. The sum operation is hard to visualize directly, since vectors in U+WU+W can be split into pieces from UU and WW in many different ways. Intersections and dimensions, by contrast, are far more tractable. This is the exact linear-algebra analogue of ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A\cup B| = |A|+|B|-|A\cap B| for finite sets. The proof strategy, extending a basis of the overlap outward in two directions, is a template used throughout the subject. A special and especially clean case occurs when U∩W={0}U \cap W = \{0\}. Then the formula collapses to dim⁡(U+W)=dim⁡U+dim⁡W\dim(U+W) = \dim U + \dim W. One says the sum is a Direct Sum. This is the dimension count that makes direct sum decompositions so useful. It helps in building explicit bases, verifying that a space splits into independent pieces, and organizing linear maps via invariant subspaces. The formula also generalizes cleanly. For direct sums of any finite number of subspaces, dimensions simply add. This article gives the precise statement and a complete non-circular proof by basis extension. It includes worked numerical examples that show the formula in action for genuinely different subspaces. It also gives a counterexample demonstrating why finite-dimensionality is essential. Finally, it looks at how the identity generalizes and where it appears across mathematics.

Key takeaways
  • The formula dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)\dim(U+W) = \dim U + \dim W - \dim(U \cap W) holds for any subspaces U,WU, W of a finite-dimensional vector space.
  • It is proved by extending a basis of U∩WU \cap W to bases of UU and of WW separately, then showing the union is a basis of U+WU+W.
  • When U∩W={0}U \cap W = \{0\}, the formula simplifies to dim⁡(U⊕W)=dim⁡U+dim⁡W\dim(U \oplus W) = \dim U + \dim W.
  • The identity generalizes to finite direct sums: dim⁡(U1⊕⋯⊕Uk)=∑idim⁡Ui\dim(U_1 \oplus \cdots \oplus U_k) = \sum_i \dim U_i, but for three or more subspaces there is no simple inclusion–exclusion analogue for U1+U2+U3U_1+U_2+U_3.
  • The formula fails if the ambient space (or the relevant subspaces) are infinite-dimensional, since "dimension" arithmetic on infinite cardinals behaves differently.
  • Key idea: counting a sum of subspaces is really counting how much overlap you subtracted twice when you added the two dimensions.

Where this lives today

The sum–intersection dimension formula is a workhorse well beyond pure linear algebra courses.

  • Linear systems and rank–nullity companions: When solving simultaneous systems of linear equations defined by two different subspaces (e.g., solution sets of two separate homogeneous systems), the formula computes the dimension of the combined solution space and detects when the systems are "independent enough" to force a large intersection, directly informing consistency and uniqueness questions tied to Rank–Nullity Theorem.
  • Coding theory and cryptography: Linear error-correcting codes are subspaces of Fqn\mathbb{F}_q^n; combining two codes via sum and intersection, and tracking dimensions, is used in analyzing code concatenation and in secret-sharing schemes built from linear codes.
  • Computer graphics and robotics: Configuration spaces and constraint subspaces (e.g., the space of joint velocities satisfying multiple simultaneous linear constraints) are intersected, and their dimensions computed via this formula, to determine the true degrees of freedom of a mechanical system.
  • Statistics: In linear regression and the analysis of variance, model subspaces (column spaces of design matrices) are summed and intersected; the formula underlies dimension counts used in computing degrees of freedom for nested and combined models.
  • Quantum mechanics: Subspaces of a Hilbert space corresponding to eigenspaces or symmetry sectors combine according to the same dimension arithmetic (in the finite-dimensional setting), governing degeneracy counts when two conserved quantities' eigenspaces overlap.
  • Algebraic geometry and combinatorics: Grassmannians, the parameter spaces of kk-dimensional subspaces of an nn-dimensional space, rely on exactly this dimension calculus to define Schubert cell dimensions and intersection conditions.
  • Foreshadowing further theory: The dimension formula is also the seed of the idea behind Quotient Spaces: one can prove dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)\dim(U+W) = \dim U + \dim W - \dim(U \cap W) again, more conceptually, via the isomorphism (U+W)/W≅U/(U∩W)(U+W)/W \cong U/(U\cap W), a fact that becomes available once quotient space dimension theory is developed.

Ask the tutor: Can you show me how to compute dim⁡(U∩W)\dim(U \cap W) when UU and WW are each given as solution sets of homogeneous linear systems, rather than as spans of vectors?

DefinitionSum, Intersection, and Direct Sum of Subspaces

Let VV be a vector space over a field F\mathbb{F}, and let U,W⊆VU, W \subseteq V be subspaces. The sum of UU and WW is

U+W:={ u+w:u∈U, w∈W }.U + W := \{\, u + w : u \in U,\ w \in W \,\}.

This is itself a subspace of VV: it contains 0=0+00 = 0+0, and it is closed under addition and scalar multiplication because (u1+w1)+(u2+w2)=(u1+u2)+(w1+w2)∈U+W(u_1+w_1)+(u_2+w_2) = (u_1+u_2)+(w_1+w_2) \in U+W and c(u+w)=(cu)+(cw)∈U+Wc(u+w) = (cu)+(cw) \in U+W. The intersection U∩WU \cap W is also a subspace of VV (a standard fact: the intersection of any collection of subspaces is a subspace). The sum U+WU+W is called a direct sum, written U⊕WU \oplus W, if every vector v∈U+Wv \in U+W can be written as u+wu+w (with u∈Uu\in U, w∈Ww\in W) in exactly one way. A standard equivalent characterization is:

U+W is direct  ⟺  U∩W={0}.U+W \text{ is direct} \iff U \cap W = \{0\}.

If VV is finite-dimensional, dim⁡V\dim V denotes the number of vectors in any basis of VV (well-defined since all bases of a finite-dimensional space have the same size).

Intuition

Think of UU and WW as two flat sheets (subspaces) sitting inside a room (VV). If the sheets only touch at the origin, gluing them together to form U+WU+W costs you nothing: every direction in UU is genuinely new relative to WW, and vice versa, so the dimensions simply add. But if the sheets already share a whole line, or plane, of common directions, then when you list a spanning set for UU together with a spanning set for WW, the shared directions get counted twice. The formula's job is to subtract that double-counted overlap exactly once — precisely as in ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A\cap B| for finite sets. The proof strategy makes this precise: start with a basis for the "shared part" U∩WU \cap W, then extend it in two independent directions — once using vectors that live only in UU, once using vectors that live only in WW. The claim is that combining all three pieces (the shared basis, the UU-only extension, the WW-only extension) gives a basis for U+WU+W, with no redundancy and nothing missing.

Figure
Two planes through a line in R3\mathbb{R}^3: dim⁡U=dim⁡W=2\dim U = \dim W = 2, dim⁡(U∩W)=1\dim(U\cap W)=1, so dim⁡(U+W)=2+2−1=3\dim(U+W)=2+2-1=3.
U ∩ W (dim 1) U (dim 2) W (dim 2) dim(U+W) = 2 + 2 − 1 = 3

Theorem and Proof

TheoremDimension Formula for Sums of Subspaces

Let VV be a finite-dimensional vector space over a field F\mathbb{F}, and let U,W⊆VU, W \subseteq V be subspaces. Then UU, WW, U∩WU\cap W, and U+WU+W are all finite-dimensional, and

dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W).\dim(U+W) = \dim U + \dim W - \dim(U\cap W).
Proof

Setup. Since VV is finite-dimensional and every subspace of a finite-dimensional vector space is finite-dimensional (a basic consequence of the fact that any linearly independent list in VV has length at most dim⁡V\dim V), each of UU, WW, U∩WU\cap W, and U+WU+W (all subspaces of VV) is finite-dimensional. Write

dim⁡U=m,dim⁡W=n,dim⁡(U∩W)=k.\dim U = m, \qquad \dim W = n, \qquad \dim(U\cap W) = k.

Since U∩W⊆UU \cap W \subseteq U and U∩W⊆WU\cap W \subseteq W, we have k≤mk \le m and k≤nk \le n.

Step 1: Extend a basis of the intersection. Choose a basis e1,…,eke_1, \dots, e_k of U∩WU \cap W (if k=0k=0, this is the empty list). By the Basis Extension Theorem (also called the Steinitz exchange / extension lemma: any linearly independent list in a finite-dimensional space extends to a basis), extend this list to a basis of UU:

e1,…,ek,  u1,…,um−ke_1, \dots, e_k, \; u_1, \dots, u_{m-k}

and independently extend the same list e1,…,eke_1,\dots,e_k to a basis of WW:

e1,…,ek,  w1,…,wn−k.e_1, \dots, e_k, \; w_1, \dots, w_{n-k}.

(This is possible for both UU and WW because e1,…,eke_1,\dots,e_k is a linearly independent list lying inside UU, and separately lying inside WW, since U∩W⊆UU \cap W \subseteq U and U∩W⊆WU\cap W \subseteq W.)

Step 2: Claim. The list

B=e1,…,ek,  u1,…,um−k,  w1,…,wn−k\mathcal{B} = e_1,\dots,e_k,\; u_1,\dots,u_{m-k},\; w_1,\dots,w_{n-k}

of length k+(m−k)+(n−k)=m+n−kk + (m-k) + (n-k) = m+n-k is a basis of U+WU+W. If we prove this, then

dim⁡(U+W)=m+n−k=dim⁡U+dim⁡W−dim⁡(U∩W),\dim(U+W) = m+n-k = \dim U + \dim W - \dim(U\cap W),

which is exactly the claimed formula.

Step 3: B\mathcal{B} spans U+WU+W. Any vector v∈U+Wv \in U + W can be written v=u+wv = u + w with u∈Uu \in U, w∈Ww \in W. Since e1,…,ek,u1,…,um−ke_1,\dots,e_k,u_1,\dots,u_{m-k} is a basis of UU, we can write uu as a linear combination of the eie_i's and uju_j's. Since e1,…,ek,w1,…,wn−ke_1,\dots,e_k,w_1,\dots,w_{n-k} is a basis of WW, we can write ww as a linear combination of the eie_i's and wlw_l's. Adding these expressions writes v=u+wv = u+w as a linear combination of all the vectors in B\mathcal{B}. Hence B\mathcal{B} spans U+WU+W.

Step 4: B\mathcal{B} is linearly independent. Suppose scalars a1,…,aka_1,\dots,a_k, b1,…,bm−kb_1,\dots,b_{m-k}, c1,…,cn−kc_1,\dots,c_{n-k} satisfy

∑i=1kaiei+∑j=1m−kbjuj+∑l=1n−kclwl=0.(∗)\sum_{i=1}^k a_i e_i + \sum_{j=1}^{m-k} b_j u_j + \sum_{l=1}^{n-k} c_l w_l = 0. \tag{$\ast$}

Rearrange as

∑i=1kaiei+∑j=1m−kbjuj=−∑l=1n−kclwl.\sum_{i=1}^k a_i e_i + \sum_{j=1}^{m-k} b_j u_j = -\sum_{l=1}^{n-k} c_l w_l.

The left side is a vector in UU (linear combination of basis vectors of UU); the right side is a vector in WW (linear combination of the wl∈Ww_l \in W, up to sign, still in WW since WW is a subspace). Since the two sides are equal, this common vector, call it xx, lies in U∩WU \cap W. Because x∈U∩Wx \in U \cap W and e1,…,eke_1,\dots,e_k is a basis of U∩WU\cap W, we can write

x=∑i=1kdieix = \sum_{i=1}^k d_i e_i

for some scalars did_i. In particular,

−∑l=1n−kclwl=x=∑i=1kdiei,-\sum_{l=1}^{n-k} c_l w_l = x = \sum_{i=1}^k d_i e_i,

so

∑i=1kdiei+∑l=1n−kclwl=0.\sum_{i=1}^k d_i e_i + \sum_{l=1}^{n-k} c_l w_l = 0.

But e1,…,ek,w1,…,wn−ke_1,\dots,e_k,w_1,\dots,w_{n-k} is a basis of WW, hence linearly independent; the only way a linear combination of a linearly independent list vanishes is if all coefficients are 00. Thus c1=⋯=cn−k=0c_1 = \cdots = c_{n-k} = 0 (and also all di=0d_i = 0, though we do not need that fact further). Substituting cl=0c_l = 0 for all ll back into (∗)(\ast) gives

∑i=1kaiei+∑j=1m−kbjuj=0.\sum_{i=1}^k a_i e_i + \sum_{j=1}^{m-k} b_j u_j = 0.

But e1,…,ek,u1,…,um−ke_1,\dots,e_k,u_1,\dots,u_{m-k} is a basis of UU, hence linearly independent, forcing a1=⋯=ak=0a_1=\cdots=a_k=0 and b1=⋯=bm−k=0b_1=\cdots=b_{m-k}=0. All coefficients in (∗)(\ast) are therefore zero, so B\mathcal{B} is linearly independent.

Conclusion. By Steps 3 and 4, B\mathcal{B} is a basis of U+WU+W consisting of m+n−km+n-k vectors, so

dim⁡(U+W)=m+n−k=dim⁡U+dim⁡W−dim⁡(U∩W).■\dim(U+W) = m + n - k = \dim U + \dim W - \dim(U\cap W). \qquad \blacksquare
∎
CorollaryDimension of a Direct Sum

Let VV be a finite-dimensional vector space and U,W⊆VU, W \subseteq V subspaces with U∩W={0}U \cap W = \{0\}. Then

dim⁡(U⊕W)=dim⁡U+dim⁡W.\dim(U \oplus W) = \dim U + \dim W.
Proof

By the equivalence stated in the definition, U∩W={0}U\cap W = \{0\} means the sum U+WU+W is direct, i.e. U+W=U⊕WU+W = U\oplus W (the same set, with the direct-sum property). Since dim⁡(U∩W)=dim⁡{0}=0\dim(U\cap W) = \dim\{0\} = 0, the Dimension Formula for Sums of Subspaces gives

dim⁡(U+W)=dim⁡U+dim⁡W−0=dim⁡U+dim⁡W,\dim(U+W) = \dim U + \dim W - 0 = \dim U + \dim W,

and since U+W=U⊕WU+W = U\oplus W as sets, dim⁡(U⊕W)=dim⁡U+dim⁡W\dim(U\oplus W) = \dim U + \dim W. ■\blacksquare

∎
CorollaryDimension of a Finite Direct Sum

Let VV be finite-dimensional and let U1,…,Uk⊆VU_1, \dots, U_k \subseteq V be subspaces such that

V=U1⊕U2⊕⋯⊕Uk,V = U_1 \oplus U_2 \oplus \cdots \oplus U_k,

meaning every v∈Vv \in V is uniquely expressible as v=u1+⋯+ukv = u_1 + \cdots + u_k with ui∈Uiu_i \in U_i. Then

dim⁡V=dim⁡U1+dim⁡U2+⋯+dim⁡Uk.\dim V = \dim U_1 + \dim U_2 + \cdots + \dim U_k.
Proof

We induct on kk. The base case k=1k=1 is trivial (V=U1V = U_1). For the inductive step, suppose the result holds for direct sums of k−1k-1 subspaces. Let W=U1⊕⋯⊕Uk−1W = U_1 \oplus \cdots \oplus U_{k-1} (a subspace of VV, and it is genuinely a direct sum of these k−1k-1 subspaces because the uniqueness of the decomposition v=u1+⋯+ukv = u_1+\cdots+u_k for VV restricts to uniqueness of u1+⋯+uk−1u_1+\cdots+u_{k-1} representations within WW). By the inductive hypothesis,

dim⁡W=dim⁡U1+⋯+dim⁡Uk−1.\dim W = \dim U_1 + \cdots + \dim U_{k-1}.

Now V=W⊕UkV = W \oplus U_k: every v∈Vv\in V decomposes as w+ukw + u_k with w∈W,uk∈Ukw \in W, u_k \in U_k, and this decomposition is unique because the full decomposition v=u1+⋯+ukv=u_1+\cdots+u_k is unique and w=u1+⋯+uk−1w = u_1+\cdots+u_{k-1} is determined by ww's own unique decomposition within WW. In particular W∩Uk={0}W \cap U_k = \{0\}: if x∈W∩Ukx \in W\cap U_k is nonzero, then x=xx = x gives two different decompositions of xx as (element of WW) ++ (element of UkU_k), namely x+0x+0 and 0+x0+x, contradicting uniqueness unless x=0x=0. By the direct-sum dimension corollary just proved,

dim⁡V=dim⁡(W⊕Uk)=dim⁡W+dim⁡Uk=dim⁡U1+⋯+dim⁡Uk−1+dim⁡Uk.\dim V = \dim(W \oplus U_k) = \dim W + \dim U_k = \dim U_1 + \cdots + \dim U_{k-1} + \dim U_k.

This completes the induction. ■\blacksquare

∎

Worked examples

Example 1: Two planes in R4\mathbb{R}^4 meeting in a line. Let V=R4V = \mathbb{R}^4. Define

U=span⁡{(1,0,1,0), (0,1,0,1)},W=span⁡{(1,0,1,0), (1,1,1,−1)}.U = \operatorname{span}\{(1,0,1,0),\,(0,1,0,1)\}, \qquad W = \operatorname{span}\{(1,0,1,0),\,(1,1,1,-1)\}.

Both UU and WW are 22-dimensional (each spanning list is clearly linearly independent, since neither spanning vector is a scalar multiple of the other in either list — check the second coordinates 0,10,1 for UU and the ratio of first coordinates 1,11,1 against last coordinates 0,−10,-1 for WW). Finding U∩WU \cap W. A vector in UU has the form a(1,0,1,0)+b(0,1,0,1)=(a,b,a,b)a(1,0,1,0) + b(0,1,0,1) = (a, b, a, b). A vector in WW has the form c(1,0,1,0)+d(1,1,1,−1)=(c+d, d, c+d, −d)c(1,0,1,0) + d(1,1,1,-1) = (c+d,\, d,\, c+d,\, -d). Setting these equal:

a=c+d,b=d,a=c+d,b=−d.a = c+d,\quad b = d,\quad a = c+d,\quad b = -d.

The second and fourth equations give b=db = d and b=−db = -d, so d=−dd = -d, forcing d=0d = 0 (over R\mathbb{R}, or any field of characteristic ≠2\ne 2). Then b=0b = 0 and a=ca = c. So every common vector has the form (a,0,a,0)=a(1,0,1,0)(a, 0, a, 0) = a(1,0,1,0). Thus U∩W=span⁡{(1,0,1,0)}U \cap W = \operatorname{span}\{(1,0,1,0)\}, which is 11-dimensional (the vector (1,0,1,0)(1,0,1,0) is nonzero). Applying the formula.

dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)=2+2−1=3.\dim(U+W) = \dim U + \dim W - \dim(U\cap W) = 2 + 2 - 1 = 3.

Direct check. U+WU + W is spanned by (1,0,1,0),(0,1,0,1),(1,1,1,−1)(1,0,1,0), (0,1,0,1), (1,1,1,-1). Row-reduce:

(10100101111−1)→R3→R3−R1−R2(10100101000−2),\begin{pmatrix} 1&0&1&0\\ 0&1&0&1\\ 1&1&1&-1 \end{pmatrix} \xrightarrow{R_3 \to R_3 - R_1 - R_2} \begin{pmatrix} 1&0&1&0\\ 0&1&0&1\\ 0&0&0&-2 \end{pmatrix},

which has rank 33 (three nonzero pivot rows, and no further cancellation is possible). This confirms dim⁡(U+W)=3\dim(U+W) = 3, matching the formula, and since 3<43 < 4, U+WU+W is a proper subspace of R4\mathbb{R}^4 — in particular U+W≠VU+W \ne V here.

Example 2: Polynomial subspaces (a direct sum case). Let V=P4(R)V = \mathcal{P}_4(\mathbb{R}), the real polynomials of degree at most 44, with dim⁡V=5\dim V = 5 (basis 1,x,x2,x3,x41, x, x^2, x^3, x^4). Define

U={ p∈P4(R):p(x)=p(−x) }(even polynomials),U = \{\, p \in \mathcal{P}_4(\mathbb{R}) : p(x) = p(-x) \,\} \quad (\text{even polynomials}),
W={ p∈P4(R):p(−x)=−p(x) }(odd polynomials).W = \{\, p \in \mathcal{P}_4(\mathbb{R}) : p(-x) = -p(x) \,\} \quad (\text{odd polynomials}).

Dimension of UU. An even polynomial of degree ≤4\le 4 has the form a+bx2+cx4a + bx^2 + cx^4, so U=span⁡{1,x2,x4}U = \operatorname{span}\{1, x^2, x^4\}, and this list is linearly independent (it consists of monomials of distinct degrees, which are always linearly independent — a linear dependence among monomials of different degrees would force a nonzero polynomial identity of the form ∑cixni=0\sum c_i x^{n_i}=0, impossible unless all ci=0c_i=0 by comparing coefficients). Hence dim⁡U=3\dim U = 3. Dimension of WW. An odd polynomial of degree ≤4\le 4 has the form bx+cx3bx + cx^3 (no constant, x2x^2, or x4x^4 term, since those are even-degree). So W=span⁡{x,x3}W = \operatorname{span}\{x, x^3\}, linearly independent by the same monomial argument, giving dim⁡W=2\dim W = 2. Intersection. If p∈U∩Wp \in U \cap W then p(x)=p(−x)p(x) = p(-x) and p(−x)=−p(x)p(-x) = -p(x) simultaneously, so p(x)=−p(x)p(x) = -p(x), i.e. 2p(x)=02p(x) = 0, forcing p=0p = 0 (valid since R\mathbb{R} has characteristic 00, so 2≠02 \ne 0). Hence U∩W={0}U \cap W = \{0\}, so dim⁡(U∩W)=0\dim(U\cap W) = 0, and the sum is direct. Applying the formula.

dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)=3+2−0=5=dim⁡V.\dim(U + W) = \dim U + \dim W - \dim(U\cap W) = 3 + 2 - 0 = 5 = \dim V.

Since U+WU + W is a 55-dimensional subspace of the 55-dimensional space VV, in fact U+W=VU+W = V (a subspace of the same finite dimension as the whole space must equal the whole space, since a proper subspace has strictly smaller dimension — itself a consequence of the Basis Extension Theorem). So every polynomial of degree ≤4\le 4 decomposes uniquely as (even part) ++ (odd part), confirming the familiar even–odd decomposition of polynomials as an instance of V=U⊕WV = U \oplus W:

p(x)=p(x)+p(−x)2⏟even, in U+p(x)−p(−x)2⏟odd, in W.p(x) = \underbrace{\tfrac{p(x)+p(-x)}{2}}_{\text{even, in } U} + \underbrace{\tfrac{p(x)-p(-x)}{2}}_{\text{odd, in } W}.
CounterexampleWhy finite-dimensionality is needed

Drop the hypothesis that VV (equivalently, that UU and WW) is finite-dimensional, and the naive numerical formula breaks down, because "dimension" for infinite-dimensional spaces is an infinite cardinal, and cardinal arithmetic does not support subtraction the way the formula implicitly requires. Let V=RNV = \mathbb{R}^{\mathbb{N}}-type space, concretely take V=R[x]V = \mathbb{R}[x], the space of all polynomials (no degree bound), which is infinite-dimensional with basis 1,x,x2,x3,…1, x, x^2, x^3, \dots. Let

U={ p∈R[x]:p(x)=p(−x) } (even polynomials, all degrees),W={ p∈R[x]:p(−x)=−p(x) } (odd polynomials, all degrees).U = \{\, p \in \mathbb{R}[x] : p(x) = p(-x) \,\} \ (\text{even polynomials, all degrees}), \qquad W = \{\, p \in \mathbb{R}[x] : p(-x) = -p(x) \,\} \ (\text{odd polynomials, all degrees}).

Exactly as in Example 2, U∩W={0}U \cap W = \{0\}, and UU has basis 1,x2,x4,…1, x^2, x^4, \dots, WW has basis x,x3,x5,…x, x^3, x^5, \dots — both are infinite-dimensional, with dim⁡U=dim⁡W=dim⁡V=ℵ0\dim U = \dim W = \dim V = \aleph_0 (countably infinite dimension). The even–odd decomposition still shows V=U⊕WV = U \oplus W. If one tried to blindly apply dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)\dim(U+W) = \dim U + \dim W - \dim(U\cap W) as an equation of numbers, one would attempt

ℵ0=ℵ0+ℵ0−0,\aleph_0 = \aleph_0 + \aleph_0 - 0,

which is technically a true statement about cardinal arithmetic (ℵ0+ℵ0=ℵ0\aleph_0 + \aleph_0 = \aleph_0), but it is not informative: the same equation ℵ0=ℵ0+ℵ0\aleph_0 = \aleph_0 + \aleph_0 would hold even if U∩WU \cap W were forced to be some other infinite-dimensional space, so the formula's proof method (extending a basis of the intersection by disjoint finite complements and counting) simply does not go through — there is no meaningful subtraction of infinite cardinals that recovers a well-defined "leftover count." The finite basis-extension argument in the proof crucially used that m,n,km, n, k are finite integers so that expressions like m−km-k and n−kn-k make sense and the induction/counting arguments terminate. This is exactly why the hypothesis "VV finite-dimensional" appears in the theorem: it is not a cosmetic simplification but the load-bearing assumption that makes the arithmetic in the formula meaningful and the extension argument valid.

Scope, edge cases & common traps

SituationWhat happens
U∩W={0}U \cap W = \{0\}Formula reduces to dim⁡(U⊕W)=dim⁡U+dim⁡W\dim(U\oplus W) = \dim U + \dim W
U⊆WU \subseteq WThen U∩W=UU \cap W = U, so dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡U=dim⁡W\dim(U+W) = \dim U + \dim W - \dim U = \dim W, consistent with U+W=WU + W = W
U=WU = Wdim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)=dim⁡U+dim⁡U−dim⁡U=dim⁡U\dim(U+W) = \dim U + \dim W - \dim(U\cap W) = \dim U + \dim U - \dim U = \dim U, consistent with U+W=UU+W = U
dim⁡U+dim⁡W>dim⁡V\dim U + \dim W > \dim VForces dim⁡(U∩W)≥dim⁡U+dim⁡W−dim⁡V>0\dim(U \cap W) \ge \dim U + \dim W - \dim V > 0, i.e. U,WU,W must intersect nontrivially
Three or more subspacesNo simple inclusion–exclusion formula for dim⁡(U1+U2+U3)\dim(U_1+U_2+U_3) in general (see below)
Infinite-dimensional VVThe formula's proof breaks; cardinal arithmetic does not recover the identity meaningfully

A frequent trap: students assume the three-subspace analogue

dim⁡(U1+U2+U3)∑dim⁡Ui−∑i<jdim⁡(Ui∩Uj)+dim⁡(U1∩U2∩U3),\dim(U_1+U_2+U_3) \overset{?}{=} \sum \dim U_i - \sum_{i<j}\dim(U_i \cap U_j) + \dim(U_1\cap U_2 \cap U_3),

mimicking set-theoretic inclusion–exclusion. This is false in general for subspaces. A standard counterexample: in R2\mathbb{R}^2, let U1=span⁡{(1,0)}U_1 = \operatorname{span}\{(1,0)\}, U2=span⁡{(0,1)}U_2=\operatorname{span}\{(0,1)\}, U3=span⁡{(1,1)}U_3=\operatorname{span}\{(1,1)\}. Each pairwise intersection is {0}\{0\} and the triple intersection is {0}\{0\}, so the right side would give 1+1+1−0−0−0+0=31+1+1-0-0-0+0 = 3. But U1+U2+U3=R2U_1+U_2+U_3 = \mathbb{R}^2 has dimension 22, not 33. The two-subspace formula is a genuine theorem; it does not extend by naive analogy to three or more subspaces.

The mathematician behind it

Origins · 1 minHermann Grassmann and how this was discovered
HG
Hermann Grassmann
1809–1877 · German mathematician, linguist, and physicist

Hermann Grassmann developed the foundational ideas of what we now call vector spaces, linear independence, dimension, and the sum/intersection dimension formula in his 1844 treatise Die lineale Ausdehnungslehre ("The Theory of Linear Extension"), decades before the abstract vector space axioms were formalized by others. Working largely in isolation as a secondary-school teacher in Stettin, Grassmann introduced an algebra of "extensive quantities" that anticipated exterior algebra, and within it he proved the dimension-counting relationships between subspaces (which he called "regions") that are now packaged as the dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)\dim(U+W) = \dim U + \dim W - \dim(U\cap W) identity. His work was so far ahead of the mathematical vocabulary of his time that it was largely unrecognized during his life; he also made major contributions to Sanskrit philology and linguistics, for which he was better known by contemporaries. The dimension formula bearing this conceptual lineage is sometimes called Grassmann's dimension formula in tribute to this pioneering, underappreciated work.

History
- 1809: Hermann Grassmann born in Stettin, Prussia (now Szczecin, Poland).
- 1844: Publishes Die lineale Ausdehnungslehre, introducing extensive algebra and subspace dimension relations.
- 1862: Publishes a revised, more rigorous second edition of the Ausdehnungslehre, still largely overlooked by mainstream mathematicians.
- 1888–1890s: Later mathematicians (including Giuseppe Peano) recognize and formalize Grassmann's ideas within the emerging axiomatic theory of vector spaces.
- 1877: Hermann Grassmann dies in Stettin, his algebraic work gaining full recognition only posthumously.
Why does the formula subtract dim⁡(U∩W)\dim(U\cap W) instead of adding it?

Because listing a basis of UU together with a basis of WW double-counts every direction that lies in both. If x∈U∩Wx \in U \cap W, then xx (or a multiple of it) effectively appears once via the basis of UU and again via the basis of WW, even though it represents only one independent direction in U+WU+W. The proof handles this precisely: it builds a basis of U+WU+W by taking a basis of U∩WU \cap W once, then adding only the extra directions needed to reach all of UU, and separately only the extra directions needed to reach all of WW. Subtracting dim⁡(U∩W)\dim(U\cap W) in the final formula corrects for the fact that a naive sum dim⁡U+dim⁡W\dim U + \dim W would count the overlapping directions twice.

Does U∩W={0}U \cap W = \{0\} guarantee U+WU + W equals the whole ambient space VV?

No. The condition U∩W={0}U \cap W = \{0\} only guarantees that the sum is direct, meaning dim⁡(U+W)=dim⁡U+dim⁡W\dim(U+W) = \dim U + \dim W; it says nothing about whether this sum fills up all of VV. For example, in R3\mathbb{R}^3, let U=span⁡{(1,0,0)}U = \operatorname{span}\{(1,0,0)\} and W=span⁡{(0,1,0)}W = \operatorname{span}\{(0,1,0)\}. Then U∩W={0}U \cap W = \{0\}, and dim⁡(U+W)=1+1=2\dim(U+W) = 1+1 = 2, but U+WU + W is only the xyxy-plane, a proper subspace of R3\mathbb{R}^3. To conclude U⊕W=VU \oplus W = V, one additionally needs dim⁡U+dim⁡W=dim⁡V\dim U + \dim W = \dim V.

How does this formula relate to rank of matrices?

If UU and WW are column spaces (or row spaces) of two matrices with the same number of rows, then U+WU+W is the column space of the matrix formed by placing the two matrices' columns side by side, and its dimension is the rank of that combined matrix. The formula then says the rank of the combined matrix equals the sum of the individual ranks minus the dimension of the overlap of their column spaces, which is a useful tool in numerical linear algebra for predicting when concatenating data (or constraint) matrices increases effective rank versus introduces redundancy.

Is there an intersection-dimension formula, i.e., can I always compute dim⁡(U∩W)\dim(U \cap W) directly instead of via the sum?

Yes — you can rearrange the theorem's formula as dim⁡(U∩W)=dim⁡U+dim⁡W−dim⁡(U+W)\dim(U \cap W) = \dim U + \dim W - \dim(U+W), provided you already know or can compute dim⁡(U+W)\dim(U+W) (for instance, by row-reducing a spanning set for U+WU+W, as in Example 1). In practice, this rearranged form is often exactly how the intersection's dimension is computed in concrete examples: it is usually easier to find a basis for U+WU+W by combining spanning sets and row-reducing than to solve directly for the intersection, especially when UU and WW are given by spanning sets rather than defining equations.

Does the formula hold over any field, or only over R\mathbb{R} or C\mathbb{C}?

The formula holds over any field F\mathbb{F}, for any finite-dimensional vector space VV over F\mathbb{F}. Nothing in the proof (basis extension, spanning, linear independence arguments) uses any property special to R\mathbb{R} or C\mathbb{C}, such as an ordering or completeness; it only uses the vector space axioms and the Basis Extension Theorem, both of which hold verbatim over an arbitrary field. The one subtlety is characteristic: in Example 2's argument that U∩W={0}U\cap W=\{0\} for even/odd polynomials, we used 2≠02 \ne 0, which fails in characteristic 22 — but that is a feature of that specific example, not a limitation of the general dimension formula itself.

What is the fastest way to remember which term gets subtracted?

Picture merging two lists of basis vectors, one for UU and one for WW: their union spans U+WU+W but may be linearly dependent exactly because of the shared directions in U∩WU \cap W. The number of "redundant" vectors introduced by this overlap is precisely dim⁡(U∩W)\dim(U\cap W), so you subtract that amount from the naive total dim⁡U+dim⁡W\dim U + \dim W to get the true dimension of the union's span. A quick sanity check: if U=WU=W, the formula must give back dim⁡U\dim U, and indeed dim⁡U+dim⁡W−dim⁡(U∩W)=dim⁡U+dim⁡U−dim⁡U=dim⁡U\dim U + \dim W - \dim(U\cap W) = \dim U + \dim U - \dim U = \dim U checks out.

How does this connect to quotient spaces?

Once Quotient Spaces are available, there is a slicker proof: the map U→(U+W)/WU \to (U+W)/W sending u↦u+Wu \mapsto u + W is a linear surjection with kernel exactly U∩WU \cap W (since u+W=Wu+W = W iff u∈Wu \in W, iff u∈U∩Wu \in U \cap W for u∈Uu \in U). The Rank–Nullity Theorem applied to this map gives dim⁡U=dim⁡(U∩W)+dim⁡((U+W)/W)\dim U = \dim(U\cap W) + \dim\big((U+W)/W\big), and since dim⁡((U+W)/W)=dim⁡(U+W)−dim⁡W\dim\big((U+W)/W\big) = \dim(U+W) - \dim W, rearranging recovers exactly dim⁡(U+W)=dim⁡U+dim⁡W−dim⁡(U∩W)\dim(U+W) = \dim U + \dim W - \dim(U\cap W). This quotient-space proof is more conceptual but relies on machinery (quotient spaces and their dimension formula) built on top of the basis-extension techniques used in the direct proof given here.

Before this

Where this leads