Subspace Basis Calculator

Use this Subspace Basis Calculator to enter values, adjust options, and review results in a compact responsive workspace.

Results are calculated automatically as you enter data.

Vectors

Each row is one vector. Use matching coordinate counts across all vectors.

Target vector (optional)

Formula and row-reduction steps
ResultEnter at least one vector.

▼ See explanations and tips below ▼

What Is a Basis for a Span?

A basis is a compact way to describe all vectors that can be built from a given set of vectors. If you start with vectors \(v_1, v_2, \ldots, v_m\), their span is the set of every possible linear combination of those vectors:

$$ \operatorname{span}(v_1, v_2, \ldots, v_m) = \left\{c_1v_1+c_2v_2+\cdots+c_mv_m : c_1,c_2,\ldots,c_m \in \mathbb{R}\right\} $$

The span may be a line, a plane, all of \(\mathbb{R}^n\), or a lower-dimensional subspace inside \(\mathbb{R}^n\). A basis for that span is a smaller set of vectors that still reaches the same subspace, with no redundant vector included.

In plain language, a basis answers two questions at once:

  • Which vectors are actually needed to describe the span?
  • How many independent directions does the span have?

That second number is the dimension of the span. In matrix language, it is the rank of the matrix formed from the vectors.


Why Bases, Rank, and RREF Matter

Vector sets can contain repeated information. For example, in \(\mathbb{R}^3\), the vector \([1,1,2]\) is redundant if you already have \([1,0,1]\) and \([0,1,1]\), because:

$$ [1,1,2] = [1,0,1] + [0,1,1] $$

A basis removes that redundancy while keeping the same span. This is useful in linear algebra because it helps you describe subspaces efficiently, solve systems of equations, compare dimensions, and understand whether a target vector can be written as a combination of other vectors.

Reduced row echelon form, or RREF, is one of the most practical tools for doing this. Row reduction reveals pivot columns, and pivot columns identify which original vectors are needed for a pivot-column basis.


Key Terms to Know

  • Vector: An ordered list of coordinates, such as \([2,-1,4]\).
  • Linear combination: A sum of scalar multiples of vectors, such as \(c_1v_1+c_2v_2\).
  • Span: The set of all linear combinations of a group of vectors.
  • Subspace: A set of vectors that is closed under vector addition and scalar multiplication.
  • Basis: A set of vectors that spans a subspace and is linearly independent.
  • Dimension: The number of vectors in any basis for a subspace.
  • Rank: The number of pivot columns in a matrix; for a matrix of column vectors, it equals the dimension of the column space.
  • Pivot column: A column corresponding to a leading entry after row reduction.
  • RREF: Reduced row echelon form, a standardized row-reduced form of a matrix.
  • Redundant vector: A vector that does not add a new independent direction to the span.

How Finding a Basis for a Span Works

To find a basis for the span of vectors \(v_1, v_2, \ldots, v_m\), place the vectors as columns of a matrix:

$$ A = \begin{bmatrix} | & | & & | \\ v_1 & v_2 & \cdots & v_m \\ | & | & & | \end{bmatrix} $$

Then row-reduce \(A\) to \(\operatorname{RREF}(A)\). The pivot columns of the original matrix \(A\) form a basis for the span of the original vectors.

The word original is important. The basis vectors are not usually the columns of the RREF matrix itself. RREF tells you which column positions are pivots, and you then take the vectors in those same positions from the original input.

The main relationships are:

$$ \dim\left(\operatorname{span}(v_1,\ldots,v_m)\right) = \operatorname{rank}(A) $$
$$ \text{The vectors span all of } \mathbb{R}^n \Longleftrightarrow \operatorname{rank}(A)=n $$
$$ \text{The vectors are linearly independent} \Longleftrightarrow \operatorname{rank}(A)=m $$

Here, \(n\) is the ambient dimension, meaning the number of coordinates in each vector, and \(m\) is the number of input vectors.

Testing Whether a Target Vector Is in the Span

A target vector \(b\) is in the span of the input vectors when there are coefficients \(c_1,c_2,\ldots,c_m\) such that:

$$ c_1v_1+c_2v_2+\cdots+c_mv_m=b $$

Using the matrix \(A\) whose columns are the input vectors, this is the same as solving:

$$ A c = b $$

where

$$ c = \begin{bmatrix}c_1\\c_2\\ \vdots \\ c_m\end{bmatrix} $$

The target vector belongs to the span exactly when this system is consistent. A common rank test expresses the same idea as:

$$ b \in \operatorname{span}(v_1,\ldots,v_m) \Longleftrightarrow \operatorname{rank}(A)=\operatorname{rank}([A\mid b]) $$

If the ranks are equal, adding \(b\) as an augmented column did not introduce a new independent direction. If the augmented matrix has larger rank, then \(b\) is outside the span.


Examples of Finding a Basis and Testing Span Membership

Example 1: Two Vectors That Span \(\mathbb{R}^2\)

Suppose the input vectors are:

$$ v_1=\begin{bmatrix}1\\0\end{bmatrix}, \qquad v_2=\begin{bmatrix}0\\1\end{bmatrix} $$

Place them as columns:

$$ A=\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} $$

The matrix is already in RREF, and both columns are pivot columns. Therefore, the basis is \(\{v_1,v_2\}\), the rank is \(2\), and the vectors span all of \(\mathbb{R}^2\).

If the target vector is

$$ b=\begin{bmatrix}4\\-2\end{bmatrix} $$

then

$$ 4v_1-2v_2 = 4\begin{bmatrix}1\\0\end{bmatrix} -2\begin{bmatrix}0\\1\end{bmatrix} = \begin{bmatrix}4\\-2\end{bmatrix} $$

So \(b\) is in the span, with coefficients \(c_1=4\) and \(c_2=-2\).


Example 2: A Redundant Vector in \(\mathbb{R}^3\)

Now consider:

$$ v_1=\begin{bmatrix}1\\0\\1\end{bmatrix}, \qquad v_2=\begin{bmatrix}0\\1\\1\end{bmatrix}, \qquad v_3=\begin{bmatrix}1\\1\\2\end{bmatrix} $$

Because \(v_3=v_1+v_2\), the third vector does not add a new direction. The matrix of column vectors is:

$$ A=\begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 1 & 1 & 2 \end{bmatrix} $$

Row reduction gives:

$$ \operatorname{RREF}(A)= \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{bmatrix} $$

The pivot columns are columns \(1\) and \(2\), so one basis for the span is:

$$ \left\{ \begin{bmatrix}1\\0\\1\end{bmatrix}, \begin{bmatrix}0\\1\\1\end{bmatrix} \right\} $$

The rank is \(2\), so the span is a \(2\)-dimensional subspace of \(\mathbb{R}^3\), not all of \(\mathbb{R}^3\).


Example 3: Target Vector Inside the Span

Using the same vectors from Example 2, test:

$$ b=\begin{bmatrix}3\\2\\5\end{bmatrix} $$

Since the span consists of vectors of the form

$$ c_1\begin{bmatrix}1\\0\\1\end{bmatrix} +c_2\begin{bmatrix}0\\1\\1\end{bmatrix} = \begin{bmatrix}c_1\\c_2\\c_1+c_2\end{bmatrix} $$

we can choose \(c_1=3\) and \(c_2=2\):

$$ 3v_1+2v_2 = \begin{bmatrix}3\\2\\5\end{bmatrix} $$

So \(b\) is in the span. If a redundant vector such as \(v_3\) is also present, there may be more than one coefficient representation. A calculator may show one valid representation by setting free variables to \(0\).


Example 4: Target Vector Outside the Span

Again use the same input vectors, but now test:

$$ b=\begin{bmatrix}3\\2\\6\end{bmatrix} $$

The first two coordinates would require \(c_1=3\) and \(c_2=2\), which would make the third coordinate \(c_1+c_2=5\), not \(6\). Therefore:

$$ \begin{bmatrix}3\\2\\6\end{bmatrix} \notin \operatorname{span}(v_1,v_2,v_3) $$

Equivalently, the augmented matrix \([A\mid b]\) has larger rank than \(A\), so the system \(Ac=b\) is inconsistent.


How to Interpret the Result

The most important result is the dimension of the span. This is the rank of the matrix whose columns are the input vectors.

If the dimension of the span equals the ambient dimension \(n\), the vectors span all of \(\mathbb{R}^n\). For example, a rank of \(3\) in \(\mathbb{R}^3\) means the vectors can reach every vector in \(\mathbb{R}^3\).

If the dimension is less than \(n\), the vectors span a lower-dimensional subspace. In \(\mathbb{R}^3\), a rank of \(1\) means a line through the origin, and a rank of \(2\) often represents a plane through the origin.

The basis vector labels identify which original input vectors are pivot vectors. If the result says the basis vectors are \(v_1\) and \(v_2\), it means those original vectors form a basis for the span. Non-pivot vectors are redundant for the current vector order and numerical tolerance.

The linear independence result compares rank with the number of input vectors. If the rank equals the number of vectors, the vectors are linearly independent. If the rank is smaller, at least one vector can be built from the others.

For a target vector \(b\), the membership result has four possible meanings:

  • In span: The target can be written as a linear combination of the input vectors.
  • Not in span: No combination of the input vectors reaches the target.
  • Not tested: No target vector was entered.
  • Uncertain: The result depends on a tolerance-sensitive direction, so the calculator cannot safely classify membership at its current floating-point precision.

When coefficients are shown, they give one valid way to express \(b\) as a linear combination of the input vectors. If the input vectors are dependent, that representation may not be the only possible one.


Common Mistakes and Misconceptions

One common mistake is mixing up rows and columns. Even if vectors are entered in separate rows in an interface, the calculation for a span often places them as columns of the matrix \(A\). Pivot columns then refer to original vectors, not coordinate rows.

Another mistake is assuming that RREF columns themselves are the basis vectors. RREF is used to identify pivot positions. The basis for the original span uses the corresponding columns from the original matrix.

Be careful with blank cells. In this calculator, blank coordinate cells are treated as \(0\). Leaving a cell blank by accident can change the vector set, the rank, and the membership result.

Also watch the format of numeric inputs. Decimal and negative coordinates are appropriate, but symbolic expressions and exact fractional text such as 1/2 are not treated as exact rational numbers here. Enter a decimal such as 0.5 when needed.

Finally, do not assume that one displayed coefficient table is the full solution set. If the vector set is dependent, there may be infinitely many coefficient choices for the same target vector. A displayed representation can still be correct even when other representations also exist.


When to Use a Subspace Basis Calculation

Use this kind of calculation when you need to:

  • Find a smaller independent set that spans the same vectors.
  • Determine whether vectors are linearly independent or redundant.
  • Find the dimension of a span or column space.
  • Check whether vectors span all of \(\mathbb{R}^n\).
  • Test whether a target vector belongs to the span.
  • Express a target vector as a linear combination of input vectors.
  • Understand the pivot structure behind a system of linear equations.

These tasks appear often in linear algebra courses, matrix methods, data science foundations, computer graphics, engineering mathematics, and any subject that uses systems of linear equations.


Limitations and Things to Keep in Mind

A calculator can help organize the row-reduction process, but the result still depends on the assumptions of the calculation.

This calculator works with real numeric coordinates. It does not handle symbolic variables, exact rational notation such as 1/2, complex numbers, NaN, or infinity as valid coordinates.

Inputs are limited to 20 vectors, 10 coordinates per vector, and 15 significant digits per coordinate. Values that underflow the browser's numeric range are rejected rather than silently changed to zero.

The calculation uses floating-point arithmetic with scale-normalized, dimension-aware tolerances. Nearly dependent directions are reported as tolerance-sensitive instead of being silently classified by a fixed absolute cutoff. The calculator verifies span residuals, basis orthogonality, and any displayed membership coefficients before reporting success.

Displayed matrix entries and coefficients may be rounded. Very large or very small nonzero values may be shown in exponential notation. For classroom work that requires exact fractions, you may still need to verify the result by hand or with an exact symbolic tool.

The pivot-column basis is one basis, not every possible basis. Changing the order of the input vectors can change which pivot columns are selected, even when the span itself stays the same.

For target membership, verified coefficients give one solution when the target is in the span. If non-pivot variables exist, they are set to \(0\), so the output is not a full parametric family. Membership is marked uncertain when it depends on a tolerance-sensitive direction or a normalization loss.

The visual summary is geometric in two dimensions. In higher dimensions, a summary graphic can help identify pivot and redundant vectors, but it is not a true picture of the full subspace.


How to Use This Calculator

  1. Enter each input vector in its own row labeled \(v_1\), \(v_2\), and so on.
  2. Make sure all vectors have the same number of coordinates. Use the add-vector and add-coordinate controls if you need more entries.
  3. Leave a coordinate blank only when you mean \(0\).
  4. Optionally enter a target vector \(b\) to test whether it lies in the span. Leave all target cells blank to skip membership testing.
  5. To import vectors, paste one vector per line, with coordinates separated by spaces, commas, or semicolons.
  6. Review the span dimension, ambient dimension, pivot basis vectors, independence summary, membership status, RREF tables, coefficient table, row operations, and visual summary.
  7. Use the graph download option if you want to save the current visual as a PNG.

Frequently Asked Questions

What is the difference between span and basis?

The span is the full set of all vectors you can make from linear combinations of the input vectors. A basis is a linearly independent set that produces that same span with no redundant vectors.


Why do pivot columns form a basis?

Pivot columns mark the original vectors that add new independent directions. The non-pivot columns can be written as combinations of earlier pivot columns, so they are not needed to span the same column space.


Does the basis depend on the order of the input vectors?

The span does not change just because you reorder the vectors, but the pivot-column basis can change. Row reduction selects pivots from the matrix columns, so a different column order may produce a different valid basis.


What does it mean if the vectors are linearly dependent?

It means at least one vector is redundant: it can be written as a linear combination of other vectors in the set. In rank terms, the rank is smaller than the number of input vectors.


What does rank tell me about the span?

Rank tells you the dimension of the span. If \(m\) vectors in \(\mathbb{R}^n\) have rank \(r\), then they span an \(r\)-dimensional subspace of \(\mathbb{R}^n\).


How do I know if the vectors span all of \(\mathbb{R}^n\)?

The vectors span all of \(\mathbb{R}^n\) when the rank equals \(n\), the number of coordinates in each vector. If the rank is smaller than \(n\), the span is only a lower-dimensional subspace.


Why might the coefficient representation not be unique?

If the input vectors are linearly dependent, there can be free variables in the system \(Ac=b\). That means the same target vector may have more than one linear-combination representation.


What happens if one input vector is the zero vector?

The zero vector cannot add a new direction to the span. It will not be a pivot vector, and it makes the set dependent if there are other vectors in the set.


Sources and References

Books

  1. Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra. Georgia Institute of Technology, 2017. Sections 1.3 “Parametric Form,” 2.3 “Matrix Equations,” and 2.7 “Basis and Dimension.” Accessed July 4, 2026.
  2. Ken Kuttler. A First Course in Linear Algebra. Lyryx / Mathematics LibreTexts, CC BY 4.0. Section 4.10 “Spanning, Linear Independence and Basis in \(\mathbb{R}^n\).” Accessed July 4, 2026.

Online and Official Sources

  1. MIT OpenCourseWare. Lecture 6: Column Space and Nullspace. 18.06 Linear Algebra, Spring 2010. Massachusetts Institute of Technology. Accessed July 4, 2026.
  2. MIT OpenCourseWare. Lecture 7: Solving \(Ax=0\): Pivot Variables, Special Solutions. 18.06 Linear Algebra, Spring 2010. Massachusetts Institute of Technology. Accessed July 4, 2026.