Span, independence, basis, dimension
Build span and linear independence into the notion of a basis, prove that dimension is well defined, and read off coordinates in any basis.
A subspace is defined by closure under linear combination, but that tells you nothing about how many vectors you need to generate it, or whether some of them are redundant. This lesson makes those questions precise.
Span
The span of a set of vectors is the set of all linear combinations:
Span is always a subspace (closure is built in by definition), and it is the smallest subspace containing every . "Smallest" means: any subspace that contains all must contain their span.
Linear independence
A list is linearly independent if the only solution to
is . Otherwise the list is linearly dependent, and at least one vector in it can be written as a combination of the others (subtract the nonzero-coefficient term from both sides).
The condition captures redundancy: a dependent list contains at least one vector that contributes nothing to the span, because it already lives in the span of its neighbors.
Basis and coordinates
A basis of is a list that is both spanning and independent. The two conditions together are precisely what is needed to give every element of a unique representation[1].
Theorem. If is a basis of , then every can be written as for a unique tuple .
Proof. Spanning gives existence. Suppose there are two representations:
Subtracting: . Independence forces each coefficient to be zero, so for all .
The unique tuple is the coordinate vector of in the given basis. Coordinates turn abstract vector-space arguments into concrete computations.
Dimension is well defined
Different bases of the same space might have different sizes, in principle. The exchange lemma shows they cannot.
Exchange lemma. If spans and is linearly independent in , then [2].
Proof sketch. Each can be written in terms of the . Start with the spanning set and swap in : since it is a nontrivial combination of the , at least one is redundant once is present; remove it. The resulting set still spans . Repeat for : each swap removes one and the spanning property is preserved. We can only do this while are available, so .
Corollary. All bases of have the same number of elements.
Proof. If has elements and has : applying the lemma with spanning and independent gives ; then swap roles to get . So .
The common size is the dimension . For it is ; for degree- polynomials it is .
Checking bases numerically
A finite set of vectors in forms a basis for its span when the matrix whose columns are those vectors has full column rank. Gaussian elimination (or the SVD) reveals rank, and hence whether independence holds.
import numpy as np
# Candidate basis for R^3
B = np.column_stack([
[1.0, 0.0, 2.0], # b1
[0.0, 1.0,-1.0], # b2
[2.0, 1.0, 3.0], # b3 = 2*b1 + b2 -> dependent!
])
rank = np.linalg.matrix_rank(B)
print("rank:", rank) # 2, not 3 -> columns are dependent
# A genuinely independent set:
B2 = np.column_stack([
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
])
print("rank:", np.linalg.matrix_rank(B2)) # 3 -> basis for R^3
# Coordinates of v in the B2 basis (trivial here, but general route: solve Bx=v):
v = np.array([3.0, -1.0, 5.0])
x = np.linalg.solve(B2, v)
print("coordinates:", x) # [3, -1, 5]The rank check catches the dependent column; solving the system recovers coordinates.
Exercises
Exercise 1. Decide whether , , are linearly independent in . If they are dependent, exhibit an explicit nontrivial combination equal to .
Solution
Step 1. Test for a relation . Try the guess suggested by the entries. The third coordinate gives , so .
Step 2. The first coordinate gives , so . Check the second coordinate: , which matches 's second entry.
Step 3. So , i.e. with coefficients . The list is linearly dependent.
Exercise 2. Let be a basis of a 2-dimensional space , and set , . Show is also a basis, and find the coordinates of in the basis .
Solution
Step 1. By the corollary, any independent list of vectors in is a basis, so it suffices to show independence. Suppose . Expanding, . Independence of forces and , hence . So is independent and therefore a basis.
Step 2. Write . Matching against gives and .
Step 3. Adding the two equations: , so and . The coordinate vector of in is . Check: .
Exercise 3 (code). The polynomials of degree at most form a space of dimension with standard basis . Represent , , and by their coordinate vectors in that basis, and verify numerically that they form a basis of the space (full rank), then recover the coordinates of in this new basis.
Solution
import numpy as np
# Columns are coordinate vectors in the standard basis {1, t, t^2}.
B = np.column_stack([
[1.0, 1.0, 0.0], # 1 + t
[1.0, -1.0, 0.0], # 1 - t
[0.0, 0.0, 1.0], # t^2
])
assert np.linalg.matrix_rank(B) == 3 # full rank -> basis of degree<=2 polys
p = np.array([5.0, 3.0, -2.0]) # 5 + 3t - 2t^2 in standard coords
x = np.linalg.solve(B, p) # coordinates in the new basis
print("coordinates:", x) # [4, 1, -2]
# Reconstruct: x0*(1+t) + x1*(1-t) + x2*t^2 must equal p.
assert np.allclose(B @ x, p)The new vectors have full rank, so they are a basis, and the recovered coordinates rebuild : .
With the space and its dimension pinned down, the next lesson asks what happens to dimension when a linear map connects two spaces.
References
- [1]Axler, S. (2015). Linear Algebra Done Right (3rd ed.), ch. 2. Springer. Span, independence, and bases (doi:10.1007/978-3-319-11080-6).↩
- [2]Strang, G. (2016). Introduction to Linear Algebra (5th ed.). Wellesley-Cambridge Press. The exchange argument and the well-definedness of dimension.↩