TITLE: How to determine if vector b is in the span of matrix A?
QUESTION [6 upvotes]: Given a matrix A = \begin{bmatrix}
1 &2  &3 \\ 
4 &5  &6 \\ 
7 &8  &9 
\end{bmatrix}
Determine if vector $b$ is in $span(A)$
where 
$$
b = \begin{bmatrix}
1  \\ 
2  \\ 
4  
\end{bmatrix}
$$

REPLY [9 votes]: First we address $\mathrm{Span}(A)$,
$$\mathrm{Span}(A) = \left\{ \left[ \begin{array}{c} x_1\\ x_2\\ x_3\\ \end{array}\right] : \left[ \begin{array}{c} x_1\\ x_2\\ x_3\\ \end{array}\right] = a \left[\begin{array}{c} 1\\ 4\\ 7\\ \end{array}\right] + b \left[\begin{array}{c} 2\\ 5\\ 8\\ \end{array}\right] + c \left[\begin{array}{c} 3\\ 6\\ 9\\ \end{array}\right]. a,b,c \in \mathbb{R} \right\}.$$
From this definition we can see that asking if vector $\vec{b} \in \mathrm{Span}(A)$ is equivalent to asking if there exists a vector $\vec{x}$ such that $A\vec{x} = \vec{b}$,
because $$\vec{x} = \left[\begin{array}{c} x_1\\ x_2\\ x_3\\ \end{array}\right],$$
then $$A\vec{x} = \left[\begin{array}{ccc} 1 & 2 & 3\\ 4& 5 & 6\\ 7 & 8 & 9\\ \end{array}\right] \left[ \begin{array}{c} x_1\\ x_2\\ x_3 \end{array}\right] = x_1 \left[ \begin{array}{c} 1\\ 4\\ 7 \end{array}\right] + x_2 \left[ \begin{array}{c} 2\\ 5\\ 8 \end{array}\right] + x_3 \left[ \begin{array}{c} 3\\ 6\\ 9 \end{array}\right].$$
So if there exists $x_1, x_2, x_3$ such that the final line equals $\vec{b}$, then we know $\vec{b}$ is in $\mathrm{Span}(A)$. This means it suffices to ask if there exists a $\vec{x}$ such that $A\vec{x} = \vec{b}$.
This final equation is equivalent to the matrix equation:
$$\left[\begin{array}{ccc} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{array} \right] \vec{x} = \left[\begin{array}{c} 1\\ 2\\ 4\\ \end{array}\right],$$
which we can convert to the system:
$$\left[\begin{array}{ccc|c}
  1 & 2 & 3 & 1\\
  4 & 5 & 6 & 2\\
  7 & 8 & 9 & 4\\
\end{array}\right].$$
As you might have learned, we solve this system by row reduction (I used technology for this step, your instructor may require row reduction by hand):
$$\mathrm{RREF}\left(\left[\begin{array}{ccc|c}
  1 & 2 & 3 & 1\\
  4 & 5 & 6 & 2\\
  7 & 8 & 9 & 4\\
\end{array}\right]\right) = \left[\begin{array}{ccc|c}
  1 & 0 & 0 & \frac{-4}{3}\\
  0 & 1 & 0 & \frac{8}{3} \\
  0 & 0 & 1 & -1\\
\end{array}\right]. $$
This implies the vector $\vec{x}$ we seek is given by:
$$\vec{x} = \left[\begin{array}{c} \frac{-4}{3}\\ \frac{8}{3} \\ -1\\ \end{array} \right].$$
The existence of this $\vec{x}$ alone guarantees $\vec{b} \in \mathrm{Span}(A)$, but lets check our answer by computing $A\vec{x}$.
$$A\vec{x} = \left[\begin{array}{ccc} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{array} \right] \left[\begin{array}{c} \frac{-4}{3}\\ \frac{8}{3} \\ -1\\ \end{array} \right] = \left[\begin{array}{c} 1\\ 2 \\ 4\\ \end{array} \right], $$
as desired.
Some things to think about: are there any vectors in $\mathbb{R}^3$ that are not in Span($A$)? If so can you find them, if not can you justify it? Hope this answer helps!