# Find whether vector w belongs in the span

$$v_1=[1,0,1,2]$$ $$v_2 = [0,1,1,3]$$ $$v_3 = [2,1,3,7]$$ $$w = [1,2,3,4]$$

We are supposed to determine if $w$ is in $\operatorname{span}(v_1,v_2,v_3)$.

• What have you done so far?
– EPS
Commented Sep 18, 2014 at 21:44
• Form the matrix $\begin{bmatrix} v_1|v_2|v_3|w\end{bmatrix}$ and then use row reduction to see if the corresponding linear system is consistent. Commented Sep 18, 2014 at 21:55
• First I checked if v1,v2,v3 are linearly dependent. Without calculation I figure they have to be because in Gaussian elimination there would be a free column which would imply linear dependence. To check if w is in the span would I just have to apply Gaussian elimination again?
– bob
Commented Sep 18, 2014 at 21:56
• Yes, you want to use Gaussian elimination, and you didn't need to check to see if $v_1,v_2,v_3$ were linearly dependent first. Commented Sep 18, 2014 at 23:12

Create a matrix $A=[v_1 | v_2 | v_3 | w]:$

$A =\left[\begin{array}{cccc} 1 & 0 & 2 & 1 \\ 0 & 1 & 1 & 2 \\ 1 & 1 & 3 & 3 \\ 2 & 3 & 7 & 4 \end{array}\right]$

Now just calculate the rank of $A$. If the rank comes out to be $4$, then $w$ cannot be written as a linear combination of $v_1,v_2,v_3$.

Otherwise, we can say that w is in the span of $v_1,v_2,v_3$.

Correct me if wrong.

Let us take the vectors $v_1$, $v_2$ and $v_3$ and perform elementary row operations until we get reduced row echelon form.

$$\begin{pmatrix} 1 & 0 & 1 & 2 \\ 0 & 1 & 1 & 3 \\ 2 & 1 & 3 & 7 \end{pmatrix}\sim \begin{pmatrix} 1 & 0 & 1 & 2 \\ 0 & 1 & 1 & 3 \\ 0 & 1 & 1 & 3 \end{pmatrix}\sim \begin{pmatrix} \boxed{1} & 0 & 1 & 2 \\ 0 & \boxed{1} & 1 & 3 \\ 0 & 0 & 0 & 0 \end{pmatrix}$$

Since elementary row operations do not change the row space, the non-zero rows of the last matrix span the same subspace. So now we have a rather simple basis consisting of the vectors $u_1=[1,0,1,2]$ and $u_2=[0,1,1,3]$ and we are asking whether $w\in\operatorname{span}(u_1,u_2)$.

Now it suffices to look at the numbers in the first and second position in the vector $w$, since this is where the pivots are in the rref.

So $w$ can only be a linear combination of $u_1$ and $u_2$ if it is equal to $$u_1+2u_2=[1,2,3,8].$$

Therefore we see that $w\notin \operatorname{span} (u_1,u_2)= \operatorname{span}(v_1,v_2,v_3)$.

See also this similar question: Finding whether a vector is in the span of a set of vectors

The vector $w$ will be in the span of the given set of vectors if you can write $w$ as a linear combination of the vectors. That is, provided that $w$ is in the span, you will have $$w=c_1v_1+c_2v_2+c_3v_3$$ $w$ will be in the span if you can find at least one set of solutions for the coefficients.

• I don't understand the edit. Aren't we only concerned whether $w$ is a linear combination of the vectors $v_i$? And surely $w\neq\mathbf0$. Commented Jul 5, 2017 at 0:22

The row reduced form: \begin{align} \mathbf{A} &\to \mathbf{E}_{\mathbf{A}} \\ % \left[ \begin{array}{ccc} 1 & 0 & 2 \\ 0 & 1 & 1 \\ 1 & 1 & 3 \\ 2 & 3 & 7 \\ \end{array} \right] % &\to % \left[ \begin{array}{ccc} 1 & 0 & 2 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{array} \right] % \end{align} Therefore the matrix rank is $\rho = 2$.

We have two elementary columns, 1 and 2. If $w$ is in the span of the column space then we must have $$\left[ \begin{array}{c} 1 \\ 2 \\ 3 \\ 4 \end{array} \right] = \alpha \left[ \begin{array}{c} 1 \\ 0 \\ 1 \\ 2 \end{array} \right] + \beta \left[ \begin{array}{c} 0 \\ 1 \\ 1 \\ 3 \end{array} \right]$$ The first two elements reveal the answer: $w$ is not in the span.

The vector $w$ can be resolved into $\color{blue}{range}$ and $\color{red}{null}$ space components \begin{align} w &= \color{blue}{w_{\mathcal{R}(\mathbf{A})}} + \color{red}{w_{\mathcal{N}(\mathbf{A})^{*}}} \\ % \left[ \begin{array}{c} 1 \\ 2 \\ 3 \\ 4 \end{array} \right] &= \frac{1}{17} % \color{blue}{\left[ \begin{array}{c} 21 \\ 50 \\ 71 \\ 56 \\ \end{array} \right]} + \frac{1}{17} \color{red}{\left[ \begin{array}{r} -4 \\ -16 \\ -20 \\ 12 \\ \end{array} \right]} % \end{align}