About the exam
Midterm 1 is on Friday, September 25th in class. You will have 50 minutes. No calculators, notes, phones, or other aids are allowed, so practice doing the arithmetic by hand. The exam has 7 problems worth 100 points, plus an optional extra credit problem. Show your work on every problem. The exam covers everything we have done so far, which corresponds to Sections 1.1 through 2.4 of the textbook.
What you need to know
- Many ways to say the same thing. (1.1, 2.3) Translate freely between a system of linear equations, its augmented matrix, a vector equation $x_1 v_1 + \cdots + x_n v_n = b$, a matrix equation $Ax = b$, and the question of whether $b$ is in $\sp\{v_1, \dots, v_n\}$. Know what $A$, $x$, and $b$ are in each case, and know how to go in every direction.
- Row reduction. (1.2) The three row operations: swap two rows, scale a row by a nonzero number, add a multiple of one row to another. Row echelon form and reduced row echelon form, pivots, pivot columns, and free variables. Be able to row reduce a $3 \times 5$ augmented matrix by hand without errors.
- Counting solutions. (1.2) A system has no solutions exactly when its echelon form has a row $[\,0 \cdots 0 \mid c\,]$ with $c \neq 0$. A consistent system has exactly one solution when every variable is a pivot variable, and infinitely many when there is at least one free variable. You can read all of this off an echelon form, so you do not need to go all the way to reduced row echelon form to count solutions.
- The general solution. (1.3) Starting from reduced row echelon form, set each free variable equal to a parameter and solve for the pivot variables to write down every solution at once.
- Vectors and their geometry. (2.1) Vector addition (tip to tail), scalar multiplication (stretching, shrinking, reversing), subtraction, and linear combinations, all of which you should be able to draw.
- Span. (2.2) The definition $\sp\{v_1, \dots, v_k\} := \{c_1 v_1 + \cdots + c_k v_k : c_i \in \RR\}$. To decide whether $b$ is in the span, row reduce the augmented matrix $[\,v_1\ \cdots\ v_k \mid b\,]$. The number of ways to write $b$ as a linear combination of the $v_i$ is the number of solutions of that system.
- Homogeneous systems. (2.4) A system $Ax = 0$ always has the solution $x = 0$. Its solution set is a span, so any linear combination of solutions is again a solution. Know how to find the solution set of $Ax = 0$ and write it as a span.
- Matrix multiplication. (2.3) When $AB$ is defined and what size it is. The entry of $AB$ in row $i$ and column $j$ is row $i$ of $A$ times column $j$ of $B$. The vector $Ax$ is the linear combination of the columns of $A$ with coefficients from $x$.
Practice problems
The problems below are similar in style to the problems on the exam. Work them by hand under exam conditions, then check your row reductions with the Row Reducer. The problem sets are also good practice.
Problem 1
Consider the system of linear equations
Do not solve the system.
Write the augmented matrix of the system.
Solution
\[ \left[\begin{array}{rrr|r} 1 & -2 & 1 & 5\\ 3 & 1 & 0 & -1\\ -1 & 0 & 4 & 2 \end{array}\right]. \]
Write the system as a vector equation.
Solution
\[ x_1 \begin{bmatrix*}[r] 1 \\ 3 \\ -1 \end{bmatrix*} + x_2 \begin{bmatrix*}[r] -2 \\ 1 \\ 0 \end{bmatrix*} + x_3 \begin{bmatrix} 1 \\ 0 \\ 4 \end{bmatrix} = \begin{bmatrix*}[r] 5 \\ -1 \\ 2 \end{bmatrix*}. \]
Write the system as a matrix equation $Ax = b$. Say explicitly what $A$, $x$, and $b$ are.
Solution
The equation is $Ax = b$ with \[ A = \begin{bmatrix*}[r] 1 & -2 & 1 \\ 3 & 1 & 0 \\ -1 & 0 & 4 \end{bmatrix*},\qquad x = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix},\qquad b = \begin{bmatrix*}[r] 5 \\ -1 \\ 2 \end{bmatrix*}. \]
Rewrite the question “Does this system have a solution?” as a question about whether one vector is in the span of some other vectors.
Solution
The system has a solution if and only if \[ \begin{bmatrix*}[r] 5 \\ -1 \\ 2 \end{bmatrix*} \in \sp\left\{ \begin{bmatrix*}[r] 1 \\ 3 \\ -1 \end{bmatrix*},\ \begin{bmatrix*}[r] -2 \\ 1 \\ 0 \end{bmatrix*},\ \begin{bmatrix} 1 \\ 0 \\ 4 \end{bmatrix} \right\}. \]
Now go the other way. Write the question “Is $(2, -1, 3)$ in $\sp\{(1, 0, 2), (3, 1, -1)\}$?” as a system of linear equations, and write down its augmented matrix.
Solution
The vector $(2, -1, 3)$ is in the span exactly when the vector equation \[ x_1 \begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix} + x_2 \begin{bmatrix*}[r] 3 \\ 1 \\ -1 \end{bmatrix*} = \begin{bmatrix*}[r] 2 \\ -1 \\ 3 \end{bmatrix*} \] has a solution. Reading off the coordinates, this is the system
\[\begin{aligned} x_1 + 3x_2 &= 2\\ x_2 &= -1\\ 2x_1 - x_2 &= 3, \end{aligned}\]with augmented matrix \[ \left[\begin{array}{rr|r} 1 & 3 & 2\\ 0 & 1 & -1\\ 2 & -1 & 3 \end{array}\right]. \]
Problem 2
Each of the following augmented matrices is in row echelon form. For each one, decide whether the corresponding system has no solutions, one solution, or infinitely many solutions. If the system is consistent, say which variables are free.
\( \blue{ \left[\begin{array}{rrr|r} 2 & 1 & -1 & 3\\ 0 & 1 & 4 & 0\\ 0 & 0 & 2 & 6 \end{array}\right] } \) For this one, also find the solution.
Solution
One solution. Every column on the left has a pivot, so there are no free variables, and there is no row of the form $[\,0\ 0\ 0 \mid c\,]$ with $c \neq 0$. To find the solution we work from the bottom up. The last row says $2x_3 = 6$, so $x_3 = 3$. The middle row says $x_2 + 4x_3 = 0$, so $x_2 = -12$. The top row says $2x_1 + x_2 - x_3 = 3$, so $2x_1 = 3 + 12 + 3 = 18$ and $x_1 = 9$. The solution is $(x_1, x_2, x_3) = (9, -12, 3)$.
\( \blue{ \left[\begin{array}{rrrr|r} 1 & 0 & 2 & 5 & 1\\ 0 & 0 & 1 & -1 & 2\\ 0 & 0 & 0 & 0 & 0 \end{array}\right] } \)
Solution
Infinitely many solutions. The system is consistent since the only zero row has a zero on the right. The pivots are in columns 1 and 3, so $x_2$ and $x_4$ are free.
\( \blue{ \left[\begin{array}{rr|r} 1 & 3 & 2\\ 0 & 1 & 4\\ 0 & 0 & 1 \end{array}\right] } \)
Solution
No solutions. The last row is the equation $0x_1 + 0x_2 = 1$, which is never true. Note that there are more equations than unknowns here, and that alone does not tell you anything: the system in part (a) also has three equations, and it has a solution.
\( \blue{ \left[\begin{array}{rrr|r} 1 & 2 & -1 & 0\\ 0 & 0 & 0 & 0 \end{array}\right] } \)
Solution
Infinitely many solutions. The system is consistent, and the only pivot is in column 1, so $x_2$ and $x_3$ are free. This is the single equation $x_1 + 2x_2 - x_3 = 0$, whose solutions form a plane.
Problem 3
Let \[ A = \begin{bmatrix*}[r] 2 & 0 & -1 & 3\\ 1 & 4 & 2 & -2\\ 0 & -3 & 1 & 5 \end{bmatrix*},\qquad B = \begin{bmatrix*}[r] 1 & 2\\ 0 & -1\\ 3 & 4\\ -2 & 0 \end{bmatrix*}. \]
What size is $AB$? Is $BA$ defined?
Solution
$A$ is $3 \times 4$ and $B$ is $4 \times 2$, so $AB$ is $3 \times 2$. The product $BA$ would need the number of columns of $B$ (which is $2$) to equal the number of rows of $A$ (which is $3$), so $BA$ is not defined.
Compute the entry in the 2nd row and 2nd column of $AB$.
Solution
This entry is the 2nd row of $A$ times the 2nd column of $B$: \[ (1)(2) + (4)(-1) + (2)(4) + (-2)(0) = 2 - 4 + 8 + 0 = 6. \]
Compute the entry in the 3rd row and 1st column of $AB$.
Solution
This entry is the 3rd row of $A$ times the 1st column of $B$: \[ (0)(1) + (-3)(0) + (1)(3) + (5)(-2) = 0 + 0 + 3 - 10 = -7. \]
Compute the whole matrix $AB$.
Solution
Computing each of the six entries as a row of $A$ times a column of $B$ gives \[ AB = \begin{bmatrix*}[r] -7 & 0\\ 11 & 6\\ -7 & 7 \end{bmatrix*}. \] For example, the entry in the 1st row and 1st column is $(2)(1) + (0)(0) + (-1)(3) + (3)(-2) = 2 - 3 - 6 = -7$.
Problem 4
Let \[ A = \begin{bmatrix*}[r] 1 & 2 \\ 3 & -1 \end{bmatrix*},\qquad B = \begin{bmatrix*}[r] 2 & 0 \\ 1 & -1 \end{bmatrix*},\qquad x = \begin{bmatrix*}[r] 2 \\ -1 \end{bmatrix*}. \]
Compute $AB$ and $BA$. Are they equal?
Solution
\[ AB = \begin{bmatrix} (1)(2) + (2)(1) & (1)(0) + (2)(-1) \\ (3)(2) + (-1)(1) & (3)(0) + (-1)(-1) \end{bmatrix} = \begin{bmatrix*}[r] 4 & -2 \\ 5 & 1 \end{bmatrix*}, \] \[ BA = \begin{bmatrix} (2)(1) + (0)(3) & (2)(2) + (0)(-1) \\ (1)(1) + (-1)(3) & (1)(2) + (-1)(-1) \end{bmatrix} = \begin{bmatrix*}[r] 2 & 4 \\ -2 & 3 \end{bmatrix*}. \] They are not equal. The order of multiplication matters for matrices, even when both products are defined and have the same size.
Compute $Ax$, and then write $Ax$ as a linear combination of the columns of $A$.
Solution
\[ Ax = \begin{bmatrix} (1)(2) + (2)(-1) \\ (3)(2) + (-1)(-1) \end{bmatrix} = \begin{bmatrix} 0 \\ 7 \end{bmatrix}. \] The entries of $x$ are the coefficients of the columns of $A$: \[ Ax = 2 \begin{bmatrix} 1 \\ 3 \end{bmatrix} - 1 \begin{bmatrix*}[r] 2 \\ -1 \end{bmatrix*} = \begin{bmatrix} 0 \\ 7 \end{bmatrix}. \]
Find all vectors $y$ with $Ay = \begin{bmatrix} 4 \\ 5 \end{bmatrix}$.
Solution
Writing $y = (y_1, y_2)$, the matrix equation $Ay = (4, 5)$ is the system
\[\begin{aligned} y_1 + 2y_2 &= 4\\ 3y_1 - y_2 &= 5. \end{aligned}\]We row reduce the augmented matrix. \[ \begin{aligned} &\left[\begin{array}{cc|c} 1 & 2 & 4 \\ 3 & \llap{$-$}1 & 5 \end{array}\right] \xrightarrow{R_{2} \to R_{2} - 3\,R_{1}} \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & \llap{$-$}7 & \llap{$-$}7 \end{array}\right] \\[4pt] &\xrightarrow{R_{2} \to -\frac{1}{7}\,R_{2}} \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & 1 & 1 \end{array}\right] \xrightarrow{R_{1} \to R_{1} - 2\,R_{2}} \left[\begin{array}{cc|c} 1 & 0 & 2 \\ 0 & 1 & 1 \end{array}\right] \end{aligned} \] There is exactly one solution, $y = (2, 1)$. As a check, $A y = 2(1, 3) + 1(2, -1) = (4, 5)$.
Problem 5
The vectors $v$ and $w$ are drawn on each grid below. On each grid, draw the requested vector as an arrow starting at the origin.
$v + w$
Solution
Reading off the grid, $v = (2, 1)$ and $w = (-1, 2)$, so $v + w = (1, 3)$. Slide $w$ so that its tail sits at the tip of $v$; the sum goes from the origin to the tip of the moved copy.
$2v - w$
Solution
We have $2v - w = (4, 2) - (-1, 2) = (5, 0)$. Stretch $v$ to twice its length, then add $-w$, which points opposite to $w$.
$2w - v$
Solution
We have $2w - v = (-2, 4) - (2, 1) = (-4, 3)$.
Describe $\sp\{v, w\}$ geometrically.
Solution
Since $v$ and $w$ are not parallel, their linear combinations fill up the whole plane: $\sp\{v, w\} = \RR^2$. One way to see this is that the system $x_1 v + x_2 w = b$, whose augmented matrix is $[\,v\ w \mid b\,]$, has a pivot in each of the two columns on the left no matter what $b$ is, so it always has a solution.
Problem 6
In each part, how many ways are there to write $b$ as a linear combination of $v_1, v_2, v_3$: none, one, or infinitely many? Justify your answer. If $b$ is in $\sp\{v_1, v_2, v_3\}$, also write it explicitly as a linear combination.
\( \blue{ v_1 = \begin{bmatrix*}[r] 1 \\ 2 \\ -1 \end{bmatrix*},\quad v_2 = \begin{bmatrix*}[r] 2 \\ 5 \\ -1 \end{bmatrix*},\quad v_3 = \begin{bmatrix*}[r] 0 \\ -1 \\ 1 \end{bmatrix*},\quad b = \begin{bmatrix} 3 \\ 8 \\ 3 \end{bmatrix} } \)
Solution
We row reduce the augmented matrix $[\,v_1\ v_2\ v_3 \mid b\,]$.
\[ \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 2 & 0 & 3 \\ 2 & 5 & \llap{$-$}1 & 8 \\ \llap{$-$}1 & \llap{$-$}1 & 1 & 3 \end{array}\right] \xrightarrow{R_{2} \to R_{2} - 2\,R_{1}} \left[\begin{array}{ccc|c} 1 & 2 & 0 & 3 \\ 0 & 1 & \llap{$-$}1 & 2 \\ \llap{$-$}1 & \llap{$-$}1 & 1 & 3 \end{array}\right] \\[4pt] &\xrightarrow{R_{3} \to R_{3} + R_{1}} \left[\begin{array}{ccc|c} 1 & 2 & 0 & 3 \\ 0 & 1 & \llap{$-$}1 & 2 \\ 0 & 1 & 1 & 6 \end{array}\right] \xrightarrow{R_{3} \to R_{3} - R_{2}} \left[\begin{array}{ccc|c} 1 & 2 & 0 & 3 \\ 0 & 1 & \llap{$-$}1 & 2 \\ 0 & 0 & 2 & 4 \end{array}\right] \end{aligned} \] This is in echelon form with a pivot in each of the three columns on the left and no inconsistent row, so there is exactly one way. Solving from the bottom up, $x_3 = 2$, then $x_2 = 2 + x_3 = 4$, then $x_1 = 3 - 2x_2 = -5$. So \[ b = -5v_1 + 4v_2 + 2v_3. \] You can check this directly: $-5(1, 2, -1) + 4(2, 5, -1) + 2(0, -1, 1) = (3, 8, 3)$.
\( \blue{ v_1 = \begin{bmatrix*}[r] 1 \\ -1 \\ 2 \end{bmatrix*},\quad v_2 = \begin{bmatrix} 1 \\ 1 \\ 0 \end{bmatrix},\quad v_3 = \begin{bmatrix*}[r] 2 \\ -1 \\ 3 \end{bmatrix*},\quad b = \begin{bmatrix} 0 \\ 1 \\ 2 \end{bmatrix} } \)
Solution
We row reduce the augmented matrix $[\,v_1\ v_2\ v_3 \mid b\,]$.
\[ \begin{aligned} &\left[\begin{array}{ccc|c} 1 & 1 & 2 & 0 \\ \llap{$-$}1 & 1 & \llap{$-$}1 & 1 \\ 2 & 0 & 3 & 2 \end{array}\right] \xrightarrow{R_{2} \to R_{2} + R_{1}} \left[\begin{array}{ccc|c} 1 & 1 & 2 & 0 \\ 0 & 2 & 1 & 1 \\ 2 & 0 & 3 & 2 \end{array}\right] \\[4pt] &\xrightarrow{R_{3} \to R_{3} - 2\,R_{1}} \left[\begin{array}{ccc|c} 1 & 1 & 2 & 0 \\ 0 & 2 & 1 & 1 \\ 0 & \llap{$-$}2 & \llap{$-$}1 & 2 \end{array}\right] \xrightarrow{R_{3} \to R_{3} + R_{2}} \left[\begin{array}{ccc|c} 1 & 1 & 2 & 0 \\ 0 & 2 & 1 & 1 \\ 0 & 0 & 0 & 3 \end{array}\right] \end{aligned} \] The last row says $0 = 3$, so the system is inconsistent and there are no ways to write $b$ as a linear combination of $v_1, v_2, v_3$. In other words, $b$ is not in $\sp\{v_1, v_2, v_3\}$.
Problem 7
Find the general solution of the vector equation \[ \blue{ x_1 \begin{bmatrix} 0 \\ 1 \\ 2 \end{bmatrix} + x_2 \begin{bmatrix} 3 \\ 0 \\ 1 \end{bmatrix} + x_3 \begin{bmatrix*}[r] -3 \\ 2 \\ 3 \end{bmatrix*} + x_4 \begin{bmatrix*}[r] 0 \\ 1 \\ -1 \end{bmatrix*} = \begin{bmatrix} 3 \\ 1 \\ 9 \end{bmatrix}. } \]
Solution
The augmented matrix has the four vectors on the left as its columns and the vector on the right as its augmented column. We row reduce.
\[ \begin{aligned} &\left[\begin{array}{cccc|c} 0 & 3 & \llap{$-$}3 & 0 & 3 \\ 1 & 0 & 2 & 1 & 1 \\ 2 & 1 & 3 & \llap{$-$}1 & 9 \end{array}\right] \xrightarrow{R_{1} \leftrightarrow R_{2}} \left[\begin{array}{cccc|c} 1 & 0 & 2 & 1 & 1 \\ 0 & 3 & \llap{$-$}3 & 0 & 3 \\ 2 & 1 & 3 & \llap{$-$}1 & 9 \end{array}\right] \\[4pt] &\xrightarrow{R_{3} \to R_{3} - 2\,R_{1}} \left[\begin{array}{cccc|c} 1 & 0 & 2 & 1 & 1 \\ 0 & 3 & \llap{$-$}3 & 0 & 3 \\ 0 & 1 & \llap{$-$}1 & \llap{$-$}3 & 7 \end{array}\right] \xrightarrow{R_{2} \to \frac{1}{3}\,R_{2}} \left[\begin{array}{cccc|c} 1 & 0 & 2 & 1 & 1 \\ 0 & 1 & \llap{$-$}1 & 0 & 1 \\ 0 & 1 & \llap{$-$}1 & \llap{$-$}3 & 7 \end{array}\right] \\[4pt] &\xrightarrow{R_{3} \to R_{3} - R_{2}} \left[\begin{array}{cccc|c} 1 & 0 & 2 & 1 & 1 \\ 0 & 1 & \llap{$-$}1 & 0 & 1 \\ 0 & 0 & 0 & \llap{$-$}3 & 6 \end{array}\right] \xrightarrow{R_{3} \to -\frac{1}{3}\,R_{3}} \left[\begin{array}{cccc|c} 1 & 0 & 2 & 1 & 1 \\ 0 & 1 & \llap{$-$}1 & 0 & 1 \\ 0 & 0 & 0 & 1 & \llap{$-$}2 \end{array}\right] \\[4pt] &\xrightarrow{R_{1} \to R_{1} - R_{3}} \left[\begin{array}{cccc|c} 1 & 0 & 2 & 0 & 3 \\ 0 & 1 & \llap{$-$}1 & 0 & 1 \\ 0 & 0 & 0 & 1 & \llap{$-$}2 \end{array}\right] \end{aligned} \] The matrix is now in reduced row echelon form with pivots in columns 1, 2, and 4, so $x_3$ is the only free variable. Setting $x_3 = t$, the three rows say $x_1 + 2t = 3$, $x_2 - t = 1$, and $x_4 = -2$. The general solution is therefore \[ (x_1, x_2, x_3, x_4) = (3 - 2t,\ 1 + t,\ t,\ -2). \]
Problem 8
Let \[ A = \begin{bmatrix*}[r] 1 & -1 & 2 & 0\\ 2 & -2 & 3 & 1 \end{bmatrix*}. \] Find all solutions of the homogeneous equation $Ax = 0$, and write the solution set as a span.
Solution
We row reduce the coefficient matrix. There is no need to carry along an augmented column of zeros, since row operations never change it.
\[ \begin{aligned} &\begin{bmatrix} 1 & \llap{$-$}1 & 2 & 0 \\ 2 & \llap{$-$}2 & 3 & 1 \end{bmatrix} \xrightarrow{R_{2} \to R_{2} - 2\,R_{1}} \begin{bmatrix} 1 & \llap{$-$}1 & 2 & 0 \\ 0 & 0 & \llap{$-$}1 & 1 \end{bmatrix} \\[4pt] &\xrightarrow{R_{2} \to -R_{2}} \begin{bmatrix} 1 & \llap{$-$}1 & 2 & 0 \\ 0 & 0 & 1 & \llap{$-$}1 \end{bmatrix} \xrightarrow{R_{1} \to R_{1} - 2\,R_{2}} \begin{bmatrix} 1 & \llap{$-$}1 & 0 & 2 \\ 0 & 0 & 1 & \llap{$-$}1 \end{bmatrix} \end{aligned} \] The pivots are in columns 1 and 3, so $x_2 = s$ and $x_4 = t$ are free, and the rows say $x_1 = s - 2t$ and $x_3 = t$. The general solution is \[ (x_1, x_2, x_3, x_4) = (s - 2t,\ s,\ t,\ t) = s\,(1, 1, 0, 0) + t\,(-2, 0, 1, 1), \] so the solution set is $\sp\{(1, 1, 0, 0),\ (-2, 0, 1, 1)\}$.
Let $B$ be a matrix for which the vectors \[ p = \begin{bmatrix*}[r] 1 \\ 0 \\ 2 \\ -1 \end{bmatrix*},\qquad q = \begin{bmatrix*}[r] 2 \\ 1 \\ 0 \\ 3 \end{bmatrix*} \] are both solutions of the homogeneous equation $Bx = 0$. Find a solution of $Bx = 0$ with $x_1 = 4$ and $x_3 = 4$.
Solution
The solution set of a homogeneous system is a span, so every linear combination $sp + tq$ is a solution. The first and third coordinates of $sp + tq$ are $s + 2t$ and $2s$, so we need
\[\begin{aligned} s + 2t &= 4\\ 2s &= 4. \end{aligned}\]The second equation gives $s = 2$, and then the first gives $t = 1$. The solution is \[ x = 2p + q = \begin{bmatrix} 2 \\ 0 \\ 4 \\ -2 \end{bmatrix} + \begin{bmatrix*}[r] 2 \\ 1 \\ 0 \\ 3 \end{bmatrix*} = \begin{bmatrix} 4 \\ 1 \\ 4 \\ 1 \end{bmatrix}. \]
Explain why the solution set of the equation $x_1 + x_2 = 1$ is not a span.
Solution
Every span contains the zero vector, since $0 = 0 \cdot v_1 + \cdots + 0 \cdot v_k$. But $(0, 0)$ does not satisfy $x_1 + x_2 = 1$, so the solution set is not a span. Geometrically, the solution set is a line that does not pass through the origin, while any span in $\RR^2$ is the origin, a line through the origin, or the whole plane.
Problem 9
Let \[ v_1 = \begin{bmatrix*}[r] 1 \\ 2 \\ -1 \end{bmatrix*},\qquad v_2 = \begin{bmatrix} 2 \\ 3 \\ 1 \end{bmatrix},\qquad b = \begin{bmatrix} 3 \\ 4 \\ h \end{bmatrix}, \] where $h$ is an unknown number.
For which values of $h$ is $b$ in $\sp\{v_1, v_2\}$?
Solution
We row reduce the augmented matrix $[\,v_1\ v_2 \mid b\,]$, carrying $h$ along as if it were a number. \[ \begin{aligned} &\left[\begin{array}{cc|c} 1 & 2 & 3 \\ 2 & 3 & 4 \\ \llap{$-$}1 & 1 & h \end{array}\right] \xrightarrow{R_{2} \to R_{2} - 2\,R_{1}} \left[\begin{array}{cc|c} 1 & 2 & 3 \\ 0 & \llap{$-$}1 & \llap{$-$}2 \\ \llap{$-$}1 & 1 & h \end{array}\right] \xrightarrow{R_{3} \to R_{3} + R_{1}} \left[\begin{array}{cc|c} 1 & 2 & 3 \\ 0 & \llap{$-$}1 & \llap{$-$}2 \\ 0 & 3 & h + 3 \end{array}\right] \\[4pt] &\xrightarrow{R_{3} \to R_{3} + 3\,R_{2}} \left[\begin{array}{cc|c} 1 & 2 & 3 \\ 0 & \llap{$-$}1 & \llap{$-$}2 \\ 0 & 0 & h - 3 \end{array}\right] \end{aligned} \] The last row is the equation $0 = h - 3$. If $h \neq 3$ this is impossible and the system has no solutions, so $b$ is not in the span. If $h = 3$ the last row is $0 = 0$ and the system is consistent. So $b$ is in $\sp\{v_1, v_2\}$ exactly when $h = 3$.
For that value of $h$, write $b$ as a linear combination of $v_1$ and $v_2$.
Solution
With $h = 3$, the second row says $-x_2 = -2$, so $x_2 = 2$, and the first row says $x_1 + 2x_2 = 3$, so $x_1 = -1$. Therefore \[ b = -v_1 + 2v_2, \] and indeed $-(1, 2, -1) + 2(2, 3, 1) = (3, 4, 3)$. Geometrically, $\sp\{v_1, v_2\}$ is a plane through the origin in $\RR^3$, and the vectors $(3, 4, h)$ form a vertical line that crosses the plane at exactly one point.