Span Calculator
Find the span of a set of vectors, calculate its dimension, and identify a basis. This calculator uses matrix rank and reduced row-echelon form (RREF) to determine which vectors contribute independent directions to the span.
You can also enter a target vector to check whether it belongs to the span and obtain one linear-combination representation when it does.
Enter your vectors
Enter one vector per line. Every vector must have the same number of components.
What is the span of vectors?
The span of a set of vectors is the set of every vector that can be created by taking a linear combination of the given vectors. A linear combination multiplies each vector by a scalar and adds the resulting vectors together.
Span(v1, ..., vk) = {c1v1 + ... + ckvk : c1, ..., ck ∈ R}
The coefficients can be any real numbers. Because all linear combinations include the zero vector and are closed under addition and scalar multiplication, a span is always a vector subspace.
How to calculate the span using matrix rank
The dimension of a span is the number of independent directions represented by the input vectors. Matrix rank provides a systematic way to find this number.
- Write each input vector as a column of a matrix.
- Use Gaussian elimination to reduce the matrix to row-echelon form or RREF.
- Count the pivot columns.
- The number of pivots is the matrix rank and the dimension of the span.
- The corresponding original columns form a basis for the span.
dim(Span(v1, ..., vk)) = rank(A)
Here, A is the matrix whose columns are the given vectors. The basis must be taken from the original columns corresponding to the pivot columns of the reduced matrix, not from the columns of the RREF itself.
Example 1: The span is a plane in R³
Consider these three vectors:
v2 = (0, 1, 0)
v3 = (1, 1, 0)
The third vector is the sum of the first two:
Therefore, the third vector does not add a new independent direction. The rank is 2, and the span is the xy-plane in R³:
A basis is {(1, 0, 0), (0, 1, 0)}.
Example 2: Spanning all of R³
Consider the standard basis vectors:
v2 = (0, 1, 0)
v3 = (0, 0, 1)
These vectors are linearly independent. Their matrix has rank 3, which equals the dimension of R³. Consequently, every vector in R³ can be expressed as a linear combination of them.
Example 3: Dependent vectors in R²
Suppose the vectors are (1, 2), (2, 4), and (3, 6).
Each vector is a scalar multiple of (1, 2). They all point along the same line through the origin.
(3, 6) = 3(1, 2)
The span has dimension 1, and a basis is {(1, 2)}.
Span, basis, and dimension
Span
The span is the complete set of all linear combinations of the given vectors.
Basis
A basis is a linearly independent set of vectors that generates the same span. It contains enough vectors to represent every vector in that subspace, without unnecessary dependent vectors.
Dimension
The dimension of a subspace is the number of vectors in any basis for that subspace. It is also the rank of a matrix whose columns generate the subspace.
When do vectors span Rⁿ?
A collection of vectors in Rⁿ spans the entire space exactly when its matrix has rank n. At least n vectors are required, although having n or more vectors does not automatically guarantee that they span the space.
Frequently asked questions
1. What does span mean in linear algebra?
The span of vectors is the set of all possible linear combinations of those vectors. For example, the span of one nonzero vector in R² is a line through the origin.
2. How do I find the dimension of a span?
Put the vectors into a matrix as columns and calculate its rank using row reduction. The rank is the dimension of the span.
3. How do I find a basis for the span?
Reduce the matrix to RREF and identify the pivot columns. Select the corresponding columns from the original matrix. These original vectors form a basis for the span.
4. Can two vectors span R³?
No. Two vectors can generate a subspace of dimension at most 2. Since R³ has dimension 3, at least three vectors are needed to span all of R³.
5. Can more than three vectors span R³?
Yes. Four or more vectors can span R³, but some of them must be linearly dependent. A basis for R³ still contains exactly three vectors.
6. Does the span always contain the zero vector?
Yes. Set every coefficient in a linear combination equal to zero. The result is the zero vector, so it belongs to every span.
7. How do I check if a vector belongs to a span?
Solve A c = b, where A contains the input vectors as columns and b is the target vector. The target belongs to the span if the system is consistent. This calculator performs that test when you enter an optional target vector.
8. What is the difference between span and linear independence?
Span describes which vectors can be generated by a set. Linear independence describes whether any vector in that set can be formed from the others. A set can span a space while containing redundant vectors.