Ma · Mathematics

How to Check Whether a Vector Lies in a Span

Published By the 9to5Science editorial team

At a glance

  1. 1. Build a linear combination

    Set an arbitrary linear combination of the given vectors equal to the target vector.

  2. 2. Write a system

    Match coordinates to obtain a system of linear equations for the coefficients.

  3. 3. Solve for coefficients

    If the system has a solution, the target belongs to the span; otherwise, it does not.

  4. 4. Check the result

    Substitute the coefficients into the combination and verify every coordinate.

Advertisement

Try it: Matrix calculator

A set of vectors determines a subspace: its span, consisting of every linear combination of those vectors. To decide whether a particular vector is included, you do not need to describe the whole subspace. You only need to check whether some choice of coefficients produces that vector.

The test is a system of linear equations. If the system has a solution, the target vector is in the span; if it has no solution, it is not.

Set the linear combination equal to the target

Suppose the given vectors are v1,…,vkv_1,\ldots,v_k and the target is bb. The question is whether there are scalars c1,…,ckc_1,\ldots,c_k such that

c1v1+c2v2+⋯+ckvk=b.c_1v_1+c_2v_2+\cdots+c_kv_k=b.

The scalars are unknowns. Write each vector in coordinates and equate corresponding coordinates. This gives a system of linear equations in c1,…,ckc_1,\ldots,c_k.

If the vectors are columns of a matrix AA, the same test is simply whether the matrix equation

Ax=bAx=b

has a solution. The column space of AA is the span of its columns, so bb lies in that span exactly when this system is consistent.

Worked example: a vector that is in the span

Check whether b=(4,5,2)b=(4,5,2) is in the span of

v1=(1,2,1),v2=(2,1,0).v_1=(1,2,1), \qquad v_2=(2,1,0).

Set up the linear combination:

c1(1,2,1)+c2(2,1,0)=(4,5,2).c_1(1,2,1)+c_2(2,1,0)=(4,5,2).

Matching coordinates gives

c1+2c2=4,2c1+c2=5,c1=2.\begin{aligned} c_1+2c_2&=4,\\ 2c_1+c_2&=5,\\ c_1&=2. \end{aligned}

The third equation gives c1=2c_1=2. The first then gives c2=1c_2=1, and the second is satisfied: 2(2)+1=52(2)+1=5. Thus the system has a solution, and

(4,5,2)=2(1,2,1)+(2,1,0).(4,5,2)=2(1,2,1)+(2,1,0).

Therefore, bb belongs to the span. The two given vectors also span a plane in R3\mathbb{R}^3; the calculation shows that this particular target lies in that plane.

Worked example: a vector that is not in the span

Keep the same two vectors, but use the target q=(4,5,3)q=(4,5,3). The coordinate equations become

c1+2c2=4,2c1+c2=5,c1=3.\begin{aligned} c_1+2c_2&=4,\\ 2c_1+c_2&=5,\\ c_1&=3. \end{aligned}

The first two equations give c1=2c_1=2 and c2=1c_2=1: doubling the first equation and subtracting the second gives 3c2=33c_2=3, so c2=1c_2=1 and then c1=2c_1=2. The third equation instead requires c1=3c_1=3. The equations contradict one another, so there is no solution. Hence qq is not in the span.

This also shows why checking all coordinates matters: matching only some coordinates does not establish membership.

Matrix method for larger problems

Place the given vectors as columns of AA and append the target as an extra column. Row-reduce the augmented matrix [A∣b][A\mid b]. If reduction produces a row of the form

[ 0  0  ⋯  0∣d ],d≠0,[\,0\;0\;\cdots\;0\mid d\,], \qquad d\ne 0,

the system is inconsistent, so bb is not in the span. If no such row appears, the system is consistent, and bb is in the span. There may be one solution or many; either is enough for membership.

Equivalently, compare ranks: bb is in the column space of AA exactly when rank⁡(A)=rank⁡([A∣b])\operatorname{rank}(A)=\operatorname{rank}([A\mid b]).

Common mistakes

  • Confusing spanning with independence. The vectors do not have to be linearly independent. Redundant vectors can still span a subspace, and membership is still determined by whether the system is consistent.
  • Expecting a unique answer. A target can have multiple representations when the given vectors are dependent. Existence, not uniqueness, is the test.
  • Using too few coordinate equations. In Rn\mathbb{R}^n, match all nn coordinates. A candidate combination that works in some coordinates but not others is not equal to the target.
  • Assuming the span fills the whole space. Two vectors in R3\mathbb{R}^3 usually span at most a plane, not all of R3\mathbb{R}^3. A target outside that plane will make the system inconsistent.
  • Misreading the question. The span of any set is a subspace by definition. The usual question is whether the given vector belongs to that span, not whether the span itself is a subspace.

References

  1. Linear Algebra and Its Applications, David C. Lay, Steven R. Lay, and Judi J. McDonald

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.