Linear AlgebraVectors3 of 5
Vectors · 3

Linear Combinations

We know how to reach a point on a grid using standard steps right and up, and now we want to find where we land, and which targets we can reach, when we can only move along two fixed diagonal vectors.

1

What Is a Linear Combination?

Suppose we can only make two diagonal moves, Move A=[1,2]\moveA{\text{Move A} = [1, 2]} and Move B=[3,1]\moveB{\text{Move B} = [3, 1]}, and we want to find where we land when we set the A dial to 2\moveA{\text{A dial to } 2} and the B dial to 1\moveB{\text{B dial to } 1}.

What Is a Linear Combination?
(0,0)(0, 0)
(3,2)\htmlClass{lc-blue}{(3, 2)}
33
22
(0,0)(0, 0)
2×[12]\htmlClass{lc-green}{2} \times \htmlClass{lc-green}{\begin{bmatrix} 1 \\ 2 \end{bmatrix}}
1×[31]\htmlClass{lc-pink}{1} \times \htmlClass{lc-pink}{\begin{bmatrix} 3 \\ 1 \end{bmatrix}}
[55]\htmlClass{lc-blue}{\begin{bmatrix} 5 \\ 5 \end{bmatrix}}
Text solution
Scale each move by its dial and chain them tip-to-tailWe multiply each vector by its dial setting and add the two scaled moves together.
2×[1,2]+1×[3,1]⏟linear combination\displaystyle \underbrace{\moveA{2} \times \moveA{[1, 2]} + \moveB{1} \times \moveB{[3, 1]}}_{\text{linear combination}} =landing vector\displaystyle = \target{\text{landing vector}}
Count total steps right in the top rowThe top entries only track horizontal movement, so we add the steps right from two of Move A and one of Move B.
Top row (right):2(1)+1(3)\displaystyle \text{Top row (right):} \quad \moveA{2(1)} + \moveB{1(3)} =2+3\displaystyle = \moveA{2} + \moveB{3} =5\displaystyle = \target{5}
Count total steps up in the bottom rowThe bottom entries only track vertical movement, so we add the steps up in the exact same way.
Bottom row (up):2(2)+1(1)\displaystyle \text{Bottom row (up):} \quad \moveA{2(2)} + \moveB{1(1)} =4+1\displaystyle = \moveA{4} + \moveB{1} =5\displaystyle = \target{5}
Combine the two rows into the landing vectorPutting the total steps right over the total steps up gives our final position on the board.
2×[1,2]+1×[3,1]\displaystyle \moveA{2} \times \moveA{[1, 2]} + \moveB{1} \times \moveB{[3, 1]} =[5,5]\displaystyle = \target{[5, 5]}

So setting the A dial to 2\moveA{2} and the B dial to 1\moveB{1} lands us at [5,5]\target{[5, 5]}, which is 55 steps right and 55 steps up from (0,0)(0, 0).

Now what happens if we hold the A dial\moveA{\text{A dial}} at 2\moveA{2} and turn the B dial\moveB{\text{B dial}} to any number we want?

Keeping the A dial at 2 while scaling Move B slides the landing spot along a single straight line parallel to B.
2

Finding the Dial Settings for a Target

Now let's work backward: we want to reach the target [7,4]\target{[7, 4]} using Move A=[1,2]\moveA{\text{Move A} = [1, 2]} and Move B=[3,1]\moveB{\text{Move B} = [3, 1]}, and we need to find the unknown dial settings a\moveA{a} and b\moveB{b} that get us there.

Finding the Dial Settings for a Target
a×[12]+b×[31]=[74]\htmlClass{lc-green}{a} \times \htmlClass{lc-green}{\begin{bmatrix} 1 \\ 2 \end{bmatrix}} + \htmlClass{lc-pink}{b} \times \htmlClass{lc-pink}{\begin{bmatrix} 3 \\ 1 \end{bmatrix}} = \htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 4 \end{bmatrix}}
A\htmlClass{lc-green}{A}
B\htmlClass{lc-pink}{B}
[74]\htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 4 \end{bmatrix}}
Text solution
Write the vector equation with unknown dialsWe set a\moveA{a} and b\moveB{b} as the dial settings needed to land on the target [7,4]\target{[7, 4]}.
a×[1,2]+b×[3,1]\displaystyle \moveA{a} \times \moveA{[1, 2]} + \moveB{b} \times \moveB{[3, 1]} =[7,4]\displaystyle = \target{[7, 4]}
Split into top and bottom row equationsBecause steps right and steps up don't mix, we read the top row and bottom row straight across as two ordinary equations.
Top row (right):1a+3b=7Bottom row (up):2a+1b=4\displaystyle \begin{aligned} \text{Top row (right):} \quad \moveA{1a} + \moveB{3b} &= \target{7} \\ \text{Bottom row (up):} \quad \moveA{2a} + \moveB{1b} &= \target{4} \end{aligned}
Double the top row to match 2a\moveA{2a} and compare the b\moveB{b}'sDoubling the entire top row makes both equations start with 2a\moveA{2a}, so we can see how much the 5\moveB{5} extra b\moveB{b}'s add to the total.
2a+6b=142a+1b=45b=10b=2\displaystyle \begin{aligned} \moveA{2a} + \moveB{6b} &= \target{14} \\ \moveA{2a} + \moveB{1b} &= \target{4} \\ \hline \moveB{5b} &= \target{10} \\ \moveB{b} &= \moveB{2} \end{aligned}
Plug b=2\moveB{b = 2} into the top row to find a\moveA{a}Two of Move B already give us 6\moveB{6} of the 7\target{7} steps right we need, leaving 1\moveA{1} step right for Move A.
1a+3(2)=71a+6=7a=1\displaystyle \begin{aligned} \moveA{1a} + \moveB{3(2)} &= \target{7} \\ \moveA{1a} + \moveB{6} &= \target{7} \\ \moveA{a} &= \moveA{1} \end{aligned}

So the target [7,4]\target{[7, 4]} is a linear combination of [1,2]\moveA{[1, 2]} and [3,1]\moveB{[3, 1]}, reached by setting the A dial to 1\moveA{1} and the B dial to 2\moveB{2}.

3

Trapped on a Line

Having two moves doesn't guarantee we can reach every point on the board. Let's see whether we can still reach the target [7,4]\target{[7, 4]} if our two vectors are Move A=[1,2]\moveA{\text{Move A} = [1, 2]} and Move B=[2,4]\moveB{\text{Move B} = [2, 4]}.

Trapped on a Line
[12]\htmlClass{lc-green}{\begin{bmatrix} 1 \\ 2 \end{bmatrix}}
[24]\htmlClass{lc-pink}{\begin{bmatrix} 2 \\ 4 \end{bmatrix}}
[74]\htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 4 \end{bmatrix}}
7\htmlClass{lc-mute}{7}
14\htmlClass{lc-mute}{14}
[12]\htmlClass{lc-green}{\begin{bmatrix} 1 \\ 2 \end{bmatrix}}
[24]\htmlClass{lc-pink}{\begin{bmatrix} 2 \\ 4 \end{bmatrix}}
[74]\htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 4 \end{bmatrix}}
[714]\htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 14 \end{bmatrix}}
Text solution
Write the top and bottom row equations for the targetWe set up a×[1,2]+b×[2,4]=[7,4]\moveA{a} \times \moveA{[1, 2]} + \moveB{b} \times \moveB{[2, 4]} = \target{[7, 4]} and read off the top and bottom rows.
Top row (right):1a+2b=7Bottom row (up):2a+4b=4\displaystyle \begin{aligned} \text{Top row (right):} \quad \moveA{1a} + \moveB{2b} &= \target{7} \\ \text{Bottom row (up):} \quad \moveA{2a} + \moveB{4b} &= \target{4} \end{aligned}
Double the top row to match the bottom rowDoubling the top equation makes its left side match the bottom equation, while the right sides disagree.
2a+4b=142a+4b=4(contradiction: 14≠4)\displaystyle \begin{aligned} & \moveA{2a} + \moveB{4b} = \target{14} \\ & \moveA{2a} + \moveB{4b} = \target{4} \\ &\quad (\text{contradiction: } \miss{14 \neq 4}) \end{aligned}

So [7,4]\target{[7, 4]} is not a linear combination of [1,2]\moveA{[1, 2]} and [2,4]\moveB{[2, 4]}: because the bottom number in both moves is double the top number, a top number of 77 forces the bottom number to be 1414 (the point [7,14]\target{[7, 14]}).

Let's see how the grid of reachable points changes as Move B\moveB{\text{Move B}} rotates into line with Move A=[1,2]\moveA{\text{Move A} = [1, 2]}.

Two moves reach across the whole board whenever they point along different lines, and collapse onto a single line the moment one move lines up with the other.
4

Two Vectors in 3D Space

Now let's give our two moves a third entry, which tracks steps out from the board into the room, and check whether two dials a\moveA{a} and b\moveB{b} on Move A=[1,2,3]\moveA{\text{Move A} = [1, 2, 3]} and Move B=[3,1,1]\moveB{\text{Move B} = [3, 1, 1]} can reach the 3D targets [7,4,5]\target{[7, 4, 5]} and [7,4,8]\target{[7, 4, 8]}.

Two Vectors in 3D Space
a×[123]+b×[311]=[745]\htmlClass{lc-green}{a} \times \htmlClass{lc-green}{\begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}} + \htmlClass{lc-pink}{b} \times \htmlClass{lc-pink}{\begin{bmatrix} 3 \\ 1 \\ 1 \end{bmatrix}} = \htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 4 \\ 5 \end{bmatrix}}
right\htmlClass{lc-mute}{\text{right}}
up\htmlClass{lc-mute}{\text{up}}
out\htmlClass{lc-mute}{\text{out}}
A\htmlClass{lc-green}{A}
B\htmlClass{lc-pink}{B}
[745]\htmlClass{lc-blue}{\begin{bmatrix} 7 \\ 4 \\ 5 \end{bmatrix}}
seen edge-on
Text solution
Write the three row equations for right, up, and outSetting a×[1,2,3]+b×[3,1,1]\moveA{a} \times \moveA{[1, 2, 3]} + \moveB{b} \times \moveB{[3, 1, 1]} =[Target]{}= \target{[\text{Target}]} gives three equations for only two unknown dials.
Row 1 (right):1a+3b=7Row 2 (up):2a+1b=4Row 3 (out):3a+1b=target steps out\displaystyle \begin{aligned} & \text{Row 1 (right):} \quad \moveA{1a} + \moveB{3b} = \target{7} \\ & \text{Row 2 (up):} \quad \moveA{2a} + \moveB{1b} = \target{4} \\ & \text{Row 3 (out):} \quad \moveA{3a} + \moveB{1b} \\ &\quad = \target{\text{target steps out}} \end{aligned}
Use Rows 1 and 2 to lock in both dialsJust getting to the spot 7\target{7} steps right and 4\target{4} steps up already fixes the only possible settings for a\moveA{a} and b\moveB{b}.
a=1,b=2\displaystyle \moveA{a = 1}, \quad \moveB{b = 2}
Plug the locked-in dials into Row 3 to find the plane's depthPutting a=1\moveA{a = 1} and b=2\moveB{b = 2} into the third row tells us how many steps out the tilted plane sits at that spot.
Row 3 (out):3(1)+1(2)\displaystyle \text{Row 3 (out):} \quad \moveA{3(1)} + \moveB{1(2)} =3+2\displaystyle = \moveA{3} + \moveB{2} =5 steps out\displaystyle = \target{5} \text{ steps out}

So [7,4,5]\target{[7, 4, 5]} lands right on the tilted plane at 5\target{5} steps out and is reachable, whereas [7,4,8]\target{[7, 4, 8]} needs 8\target{8} steps out (5≠8\miss{5 \neq 8}) and sits 3\miss{3} steps in front of the plane where our two dials cannot reach.

Let's look at all the points in 3D space we can reach as we turn both dials on Move A=[1,2,3]\moveA{\text{Move A} = [1, 2, 3]} and Move B=[3,1,1]\moveB{\text{Move B} = [3, 1, 1]}.

Choosing how far right and how far up to go on the flat board sets both dials for Move A and Move B, fixing your 3D landing point at one exact depth on the tilted plane.

Key concepts

Every linear combination problem comes down to one setup linking your dials, your moves, and where you land:

a×[Move A]+b×[Move B]\displaystyle \moveA{a} \times \moveA{[\text{Move A}]} + \moveB{b} \times \moveB{[\text{Move B}]} =[Target]\displaystyle = \target{[\text{Target}]}

Because steps right, steps up, and steps out never mix, each position in the vectors gives its own separate row equation. When you already know the dial settings, such as 2×[1,2]+1×[3,1]\moveA{2} \times \moveA{[1, 2]} + \moveB{1} \times \moveB{[3, 1]}, you don't need to solve equations at all: just multiply and add the top row (2(1)+1(3)=5\moveA{2(1)} + \moveB{1(3)} = \target{5}) and bottom row (2(2)+1(1)=5\moveA{2(2)} + \moveB{1(1)} = \target{5}) directly to get [5,5]\target{[5, 5]}.

When you are given a 2D target and need to find the dials, such as a×[1,2]+b×[3,1]=[7,4]\moveA{a} \times \moveA{[1, 2]} + \moveB{b} \times \moveB{[3, 1]} = \target{[7, 4]}, write the top row (1a+3b=7\moveA{1a} + \moveB{3b} = \target{7}) and bottom row (2a+1b=4\moveA{2a} + \moveB{1b} = \target{4}), multiply one row so the a\moveA{a} terms match (2a+6b=14\moveA{2a} + \moveB{6b} = \target{14}), and compare how much the extra b\moveB{b}'s add. If one move is a scaled copy of the other, like [1,2]\moveA{[1, 2]} and [2,4]\moveB{[2, 4]} where every bottom entry is double the top entry, both moves are trapped on the same line: you can tell right away that [7,4]\target{[7, 4]} is unreachable because a top entry of 77 forces the bottom entry to be 1414, and in the equations the doubled top row 2a+4b=14\moveA{2a} + \moveB{4b} = \target{14} contradicts the bottom row 2a+4b=4\moveA{2a} + \moveB{4b} = \target{4}. Finally, when you have two moves in 3D space that point along different lines, such as a×[1,2,3]+b×[3,1,1]=[7,4,5]\moveA{a} \times \moveA{[1, 2, 3]} + \moveB{b} \times \moveB{[3, 1, 1]} = \target{[7, 4, 5]}, their combinations only sweep out a tilted plane: solve Rows 1 and 2 first to lock in the two dials (a=1,b=2\moveA{a = 1}, \moveB{b = 2}), and then plug them into Row 3 (3(1)+1(2)=5\moveA{3(1)} + \moveB{1(2)} = \target{5}) to check whether the target sits on the plane ([7,4,5]\target{[7, 4, 5]}) or off it ([7,4,8]\target{[7, 4, 8]}).

5

Practice

1

Using Move A =[2,1]= \moveA{[2, 1]} and Move B =[4,5]= \moveB{[4, 5]}, where do you land if you set the A dial to 3\moveA{3} and the B dial to −1\moveB{-1}? Write the vector equation and find the landing vector.

Write out the top row (steps right) and bottom row (steps up) separately: when the B dial is −1\moveB{-1}, what happens to the signs of Move B's entries before you add?

Set up the vector equation with the given dials:
3×[2,1]+(−1)×[4,5]\displaystyle \moveA{3} \times \moveA{[2, 1]} + \moveB{(-1)} \times \moveB{[4, 5]} =landing vector\displaystyle = \target{\text{landing vector}}
Work out the top row and bottom row (watch the negative sign on −1\moveB{-1}, since adding Move B instead of subtracting it gives 6+4=106 + 4 = 10 and 3+5=83 + 5 = 8, which leads to the wrong vector [10,8][10, 8]):
Top row (right):3(2)+(−1)(4)=6−4=2Bottom row (up):3(1)+(−1)(5)=3−5=−2\displaystyle \begin{aligned} & \text{Top row (right):} \quad \moveA{3(2)} \\ &\quad + \moveB{(-1)(4)} = \moveA{6} - \moveB{4} = 2 \\ & \text{Bottom row (up):} \quad \moveA{3(1)} \\ &\quad + \moveB{(-1)(5)} = \moveA{3} - \moveB{5} = -2 \end{aligned}
3×[2,1]+(−1)×[4,5]\displaystyle \moveA{3} \times \moveA{[2, 1]} + \moveB{(-1)} \times \moveB{[4, 5]} =[2,−2]\displaystyle = [2, -2]
2

Find the dial settings a\moveA{a} and b\moveB{b} to reach the target [7,11]\target{[7, 11]} using Move A =[2,1]= \moveA{[2, 1]} and Move B =[1,3]= \moveB{[1, 3]}.

Write the top row and bottom row as two equations in a\moveA{a} and b\moveB{b}: what can you multiply the bottom row by so its a\moveA{a} term matches the top row's 2a\moveA{2a}?

Split a×[2,1]+b×[1,3]=[7,11]\moveA{a} \times \moveA{[2, 1]} + \moveB{b} \times \moveB{[1, 3]} = \target{[7, 11]} into its top and bottom row equations:
Top row (right):2a+1b=7Bottom row (up):1a+3b=11\displaystyle \begin{aligned} \text{Top row (right):} \quad \moveA{2a} + \moveB{1b} &= \target{7} \\ \text{Bottom row (up):} \quad \moveA{1a} + \moveB{3b} &= \target{11} \end{aligned}
Double the entire second equation so the 2a\moveA{2a} terms match (be sure to double the 11\target{11} on the right as well, since leaving it as 1111 gives 5b=45b = 4, which leads to the wrong settings b=45b = \tfrac{4}{5} and a=3110a = \tfrac{31}{10}):
2a+6b=222a+1b=75b=15b=3\displaystyle \begin{aligned} \moveA{2a} + \moveB{6b} &= \target{22} \\ \moveA{2a} + \moveB{1b} &= \target{7} \\ \hline \moveB{5b} &= \target{15} \\ \moveB{b} &= \moveB{3} \end{aligned}
Plug b=3\moveB{b = 3} back into the top row 2a+1(3)=7\moveA{2a} + \moveB{1(3)} = \target{7} to get 2a=4\moveA{2a} = 4:
a\displaystyle \moveA{a} =2,b\displaystyle = 2, \quad \moveB{b} =3\displaystyle = 3
3

Is the target [6,15]\target{[6, 15]} a linear combination of Move A =[1,3]= \moveA{[1, 3]} and Move B =[2,6]= \moveB{[2, 6]}? Show what happens in the row equations, and state what the bottom number of the target would have to be when the top number is 66.

Look at how the bottom entry compares to the top entry in both [1,3]\moveA{[1, 3]} and [2,6]\moveB{[2, 6]}: what do you multiply the top row equation by to make its left side match the bottom row equation?

Write the top and bottom row equations from a×[1,3]+b×[2,6]=[6,15]\moveA{a} \times \moveA{[1, 3]} + \moveB{b} \times \moveB{[2, 6]} = \target{[6, 15]}:
Top row (right):1a+2b=6Bottom row (up):3a+6b=15\displaystyle \begin{aligned} \text{Top row (right):} \quad \moveA{1a} + \moveB{2b} &= \target{6} \\ \text{Bottom row (up):} \quad \moveA{3a} + \moveB{6b} &= \target{15} \end{aligned}
Triple the top equation to match the left side of the bottom equation:
3a+6b=183a+6b=15(contradiction: 18≠15)\displaystyle \begin{aligned} & \moveA{3a} + \moveB{6b} = \target{18} \\ & \moveA{3a} + \moveB{6b} = \target{15} \\ &\quad (\text{contradiction: } \miss{18 \neq 15}) \end{aligned}
Because the bottom number in both [1,3]\moveA{[1, 3]} and [2,6]\moveB{[2, 6]} is 33 times the top number (be careful not to divide 66 by 33 to get 22), a top number of 66 forces the bottom number to be 3×63 \times 6:
No; the bottom numberwould haveto be 18 (the vector [6,18]).\displaystyle \begin{aligned} & \text{No; the bottom number} \\ &\quad \text{would have} \\ &\quad \text{to be } 18 \text{ (the vector } [6, 18]\text{).} \end{aligned}
4

In 3D space, can you reach the target [1,5,6]\target{[1, 5, 6]} using Move A =[1,1,2]= \moveA{[1, 1, 2]} and Move B =[1,3,5]= \moveB{[1, 3, 5]}? Find the dial settings locked in by the first two rows and check whether they hit the target.

Row 1 and Row 2 both start with 1a\moveA{1a}: how many extra b\moveB{b}'s does Row 2 have, and once that locks in a\moveA{a} and b\moveB{b}, which row checks whether you actually hit [1,5,6]\target{[1, 5, 6]}?

Write the three row equations from a×[1,1,2]+b×[1,3,5]=[1,5,6]\moveA{a} \times \moveA{[1, 1, 2]} + \moveB{b} \times \moveB{[1, 3, 5]} = \target{[1, 5, 6]}:
Row 1 (right):1a+1b=1Row 2 (up):1a+3b=5Row 3 (out):2a+5b=6\displaystyle \begin{aligned} \text{Row 1 (right):} \quad \moveA{1a} + \moveB{1b} &= \target{1} \\ \text{Row 2 (up):} \quad \moveA{1a} + \moveB{3b} &= \target{5} \\ \text{Row 3 (out):} \quad \moveA{2a} + \moveB{5b} &= \target{6} \end{aligned}
Compare Row 1 and Row 2: the 2\moveB{2} extra b\moveB{b}'s in Row 2 add 4\target{4} to the total (2b=4\moveB{2b} = \target{4}), which locks in b=2\moveB{b = 2}. Plugging b=2\moveB{b = 2} into Row 1 gives 1a+2=1\moveA{1a} + \moveB{2} = \target{1}, so a=−1\moveA{a = -1} (watch the sign when subtracting 22, since getting a=1a = 1 gives the wrong dial settings, and stopping before checking Row 3 would make [1,5,6]\target{[1, 5, 6]} look reachable). Now test a=−1\moveA{a = -1} and b=2\moveB{b = 2} in Row 3:
Row 3 check:2(−1)+5(2)\displaystyle \text{Row 3 check:} \quad \moveA{2(-1)} + \moveB{5(2)} =−2+10\displaystyle = \moveA{-2} + \moveB{10} =8≠6\displaystyle = \miss{8 \neq 6}
No, [1,5,6] cannot be reached(thedials a=−1,b=2 land at 8 stepsout).\displaystyle \begin{aligned} & \text{No, } \target{[1, 5, 6]} \text{ cannot be reached} \\ &\quad \text{(the} \text{dials } \moveA{a} = -1, \moveB{b} = 2 \\ &\quad \text{ land at } 8 \text{ steps} \text{out).} \end{aligned}
5

All linear combinations of Move A =[1,2,4]= \moveA{[1, 2, 4]} and Move B =[2,1,3]= \moveB{[2, 1, 3]} sweep out a tilted plane in 3D space. At the spot 7\target{7} steps right and 8\target{8} steps up, how many steps out into the room is this plane (the third entry z\target{z} of [7,8,z]\target{[7, 8, z]}), and what are the dial settings a\moveA{a} and b\moveB{b} that reach it?

Use the first two rows (7\target{7} steps right and 8\target{8} steps up) to lock in the dials a\moveA{a} and b\moveB{b} first: then what does Row 3 tell you about the third entry z\target{z}?

Set up the three row equations from a×[1,2,4]+b×[2,1,3]=[7,8,z]\moveA{a} \times \moveA{[1, 2, 4]} + \moveB{b} \times \moveB{[2, 1, 3]} = \target{[7, 8, z]}:
Row 1 (right):1a+2b=7Row 2 (up):2a+1b=8Row 3 (out):4a+3b=z\displaystyle \begin{aligned} \text{Row 1 (right):} \quad \moveA{1a} + \moveB{2b} &= \target{7} \\ \text{Row 2 (up):} \quad \moveA{2a} + \moveB{1b} &= \target{8} \\ \text{Row 3 (out):} \quad \moveA{4a} + \moveB{3b} &= \target{z} \end{aligned}
Double Row 1 to match the 2a\moveA{2a} in Row 2:
2a+4b=142a+1b=83b=6b=2\displaystyle \begin{aligned} \moveA{2a} + \moveB{4b} &= \target{14} \\ \moveA{2a} + \moveB{1b} &= \target{8} \\ \hline \moveB{3b} &= \target{6} \\ \moveB{b} &= \moveB{2} \end{aligned}
Plugging b=2\moveB{b = 2} into Row 1 gives 1a+2(2)=7\moveA{1a} + \moveB{2(2)} = \target{7}, so a=3\moveA{a = 3}. Put a=3\moveA{a = 3} and b=2\moveB{b = 2} into Row 3 (be careful not to swap a\moveA{a} and b\moveB{b} here, since 4(2)+3(3)4(2) + 3(3) gives the wrong depth 1717):
z\displaystyle \target{z} =4(3)+3(2)\displaystyle = \moveA{4(3)} + \moveB{3(2)} =12+6\displaystyle = \moveA{12} + \moveB{6} =18(a=3, b=2, z=18)\displaystyle = 18 \quad (\moveA{a} = 3, \ \moveB{b} = 2, \ \target{z} = 18)