math.wiki
Algebra › Systems of equations › Solving systems by substitution
Open on the map
Math 8 · 8.EE.C.8B · A.REI.C.6

Solving systems by substitution

Two equations share two unknowns, and one of them already says what y equals. How do you turn that into numbers?

Where you are 7 in Systems of equations

When you reach for it

A system of two equations in x and y asks for a pair of numbers that makes both equations true at the same time. Graphing shows that pair as the point where the two lines cross, but it reads the point off a picture, and a picture cannot tell \displaystyle \frac{13}{5} from 2.6 or from 2.55. When you want the pair exactly, you need algebra.

The trouble is that one equation in two unknowns has infinitely many solutions: x + y = 7 is true for (0, 7), (3, 4), (10, -3) and every other pair on its line. What you already know how to solve is an equation in one unknown, such as 4x - 5 = 7 or one with the variable on both sides. Substitution is the move that turns two equations in two unknowns into one equation in one unknown.

Reach for it when one equation already gives one variable on its own:

y = 3x - 5, \qquad x = 5 - 2y, \qquad l = w + 3

The last of these is what a word problem means when it says “the length is 3 more than the width”. Reach for it also when some variable has coefficient 1 or -1, as x does in x - 3y = 4, because one step of rearranging then leaves it alone. When every coefficient is something like 3 or 5, substitution still works, but elimination is usually less work.

The lesson runs over two days. Part 1 is the move itself, when a variable is already alone. Part 2 is rearranging first, answers that are fractions, and what it means when the variable disappears.

The procedure

Part 1: one variable already alone

Take the system

\begin{cases} y = 2x - 3 \\ 3x + 2y = 22 \end{cases}

The brace means both equations are meant at once. The first equation already says what y is.

Why the replacement is allowed. Suppose a pair (x, y) is a solution. Then both equations are true for that pair. The first says that y and 2x - 3 are the same number. A number can always be replaced by another name for the same number without changing whether a statement is true, so in the second equation we may write 2x - 3 where y stood:

3x + 2(2x - 3) = 22

This equation has only x in it. The second equation still says what it said, but in terms of one unknown instead of two.

Solving it. The distributive property gives 2(2x - 3) = 4x - 6, and then the like terms combine.

\begin{aligned} 3x + 4x - 6 &= 22 \\ 7x - 6 &= 22 \\ 7x &= 28 \\ x &= 4 \end{aligned}

Finding the other value. Any solution must have x = 4, and the first equation then fixes y = 2(4) - 3 = 5. The other equation would give the same value, since 3(4) + 2y = 22 means y = 5, but the equation that already gives y alone is the least work. The solution is (4, 5).

Checking in both original equations. The argument shows that if the system has a solution, it must be (4, 5). An arithmetic slip anywhere would make that candidate wrong without warning, so put the pair into the equations as they were first given:

\begin{aligned} y = 2x - 3&: \quad 2(4) - 3 = 5 \\ 3x + 2y = 22&: \quad 3(4) + 2(5) = 12 + 10 = 22 \end{aligned}

Both hold, so (4, 5) is the solution. Check in the original equations, not in a line you wrote along the way: if a slip happened before that line, the check would pass anyway.

Brackets around what you substitute. The expression takes the place of y as a whole. In 2y, the 2 multiplies all of y, so after the replacement it has to multiply all of 2x - 3. Brackets say exactly that. Without them, 2 \cdot 2x - 3 multiplies only the 2x and is a different number. The brackets matter most after a minus sign, where -3(4 - 2x) is -12 + 6x: the minus sign reaches both terms.

Part 2: rearranging first

Most systems do not arrive with a variable alone. Take

\begin{cases} x - 3y = 4 \\ 2x + 5y = 30 \end{cases}

The first job is to solve one equation for one variable. There are four choices, x or y from either equation, and all four lead to the same answer, but they are not equal work. A variable whose coefficient is 1 or -1 comes out alone after adding or subtracting only, with no division, so no fractions appear. Here x in the first equation has coefficient 1. Adding 3y to both sides gives x = 3y + 4.

Now substitute into the other equation, the one the expression did not come from:

\begin{aligned} 2(3y + 4) + 5y &= 30 \\ 6y + 8 + 5y &= 30 \\ 11y + 8 &= 30 \\ 11y &= 22 \\ y &= 2 \end{aligned}

Then x = 3(2) + 4 = 10. Check in the originals: 10 - 3(2) = 4, and 2(10) + 5(2) = 30. The solution is (10, 2).

Solving the second equation for y instead gives \displaystyle y = 6 - \frac{2}{5}x. That reaches the same (10, 2), but carries a fraction through every line after it. The choice of variable changes the arithmetic, never the answer.

Answers that are fractions. The one-variable equation can end in something like 5y = -2, so \displaystyle y = -\frac{2}{5}: a perfectly good answer, meaning the lines cross between the grid marks. Keep it exact, because the other value is found from it.

When the variable vanishes. Take

\begin{cases} y = 5x - 2 \\ 10x - 2y = 3 \end{cases}

and substitute as before:

\begin{aligned} 10x - 2(5x - 2) &= 3 \\ 10x - 10x + 4 &= 3 \\ 4 &= 3 \end{aligned}

The x terms canceled, and what is left is a false statement. Read it with the logic of Part 1: if a pair (x, y) solved both equations, then 4 = 3 would be true. It is not, so no pair solves both. The system has no solution. On a graph, the second equation is \displaystyle y = 5x - \frac{3}{2}, which has the same slope 5 as the first and a different intercept, so the lines are parallel and never meet.

Keep the first equation and change the second to 10x - 2y = 4:

\begin{aligned} 10x - 2(5x - 2) &= 4 \\ 10x - 10x + 4 &= 4 \\ 4 &= 4 \end{aligned}

This time the statement left over is true, and it is true whatever x is. So every x works, as long as y is 5x - 2. The system has infinitely many solutions: every pair (x, 5x - 2), such as (0, -2), (1, 3) and (-1, -7). The second equation is the first one in disguise: dividing 10x - 2y = 4 by -2 gives -5x + y = -2, which is y = 5x - 2. Both equations describe the same line. Not every pair whatsoever is a solution: (0, 0) is not, because 0 \neq 5(0) - 2.

These are the same three outcomes as for a single equation in one unknown, in no solution, one solution, or every number, now seen as two lines.

\text{one solution}
\text{no solution}
\text{infinitely many}
Figure 1The three ways a substitution can end. A value for the letter means the lines cross once; a false statement means they are parallel; a true statement means they are one line.
The one-variable equation ends asSolutions of the systemThe two lines
a value, such as x = 4exactly onecross once
a false statement, such as 4 = 3noneparallel
a true statement, such as 4 = 4infinitely many, all on one linethe same line

Worked examples

Examples 1 to 4 go with Part 1. Examples 5 to 7 go with Part 2.

Example 1

A variable already alone

Solve the system.

\begin{cases} y = 3x - 5 \\ x + y = 7 \end{cases}
Solution

The first equation gives y alone, so replace y in the second equation by (3x - 5). At the solution the two are the same number, so the second equation stays true.

\begin{aligned} x + (3x - 5) &= 7 \\ 4x - 5 &= 7 \\ 4x &= 12 \\ x &= 3 \end{aligned}

The x terms combined to 4x, then adding 5 and dividing by 4 kept both sides equal. Now the first equation gives y = 3(3) - 5 = 4.

Check in both original equations: 4 = 3(3) - 5 is true, and 3 + 4 = 7 is true. The solution is (3, 4).

Example 2

Brackets after a minus sign

Solve the system.

\begin{cases} y = 4 - 2x \\ 5x - 3y = 10 \end{cases}
Solution

Replace y in the second equation by the whole of 4 - 2x, in brackets:

5x - 3(4 - 2x) = 10

The -3 multiplies both terms inside: -3 \cdot 4 = -12, and -3 \cdot (-2x) = +6x, because a negative times a negative is positive.

\begin{aligned} 5x - 12 + 6x &= 10 \\ 11x - 12 &= 10 \\ 11x &= 22 \\ x &= 2 \end{aligned}

Then y = 4 - 2(2) = 0. A value of 0 is an answer like any other; the point lies on the x-axis.

Check: 0 = 4 - 2(2) is true, and 5(2) - 3(0) = 10 is true. The solution is (2, 0).

Example 3

Both equations give y

Solve the system.

\begin{cases} y = 4x + 3 \\ y = x - 6 \end{cases}
Solution

Both equations say what y is. Replace y in the second equation by 4x + 3, the expression from the first:

4x + 3 = x - 6

Substitution here is the same as setting the two expressions equal, since at the solution both are the same number y. This is an equation with the variable on both sides. Subtract x from both sides, then subtract 3:

\begin{aligned} 3x + 3 &= -6 \\ 3x &= -9 \\ x &= -3 \end{aligned}

Either equation now gives y. The second is simpler: y = -3 - 6 = -9. The first agrees: 4(-3) + 3 = -12 + 3 = -9. That agreement is the check, since it says the pair makes both equations true. The solution is (-3, -9).

Example 4

A rectangle

A rectangle’s length is 3 cm more than its width, and its perimeter is 38 cm. Find its length and width.

Solution

Let w be the width and l the length, both in centimeters. The two facts give two equations.

\begin{cases} l = w + 3 \\ 2l + 2w = 38 \end{cases}

The first is the sentence “the length is 3 more than the width” written in symbols. The second says the four sides, two lengths and two widths, add to 38. The first equation has l alone, so replace l in the second by (w + 3):

\begin{aligned} 2(w + 3) + 2w &= 38 \\ 2w + 6 + 2w &= 38 \\ 4w + 6 &= 38 \\ 4w &= 32 \\ w &= 8 \end{aligned}

Then l = 8 + 3 = 11.

Check against the words, not just the equations, since the equations could have been written wrongly: 11 is 3 more than 8, and 11 + 8 + 11 + 8 = 38. The rectangle is 11 cm long and 8 cm wide.

Example 5

Choosing which variable to free

At a café, Fenella pays 20.50 dollars for 3 sandwiches and 2 drinks. Cyrus pays 13.50 dollars for 1 sandwich and 4 drinks. Every sandwich costs the same, and so does every drink. Find the price of each.

Solution

Let s be the price of a sandwich and d the price of a drink, in dollars. Each order gives an equation:

\begin{cases} 3s + 2d = 20.50 \\ s + 4d = 13.50 \end{cases}

No variable is alone yet. Look for a coefficient of 1: the s in Cyrus’s equation. Subtracting 4d from both sides frees it with no division, s = 13.50 - 4d. Freeing any other variable would mean dividing by 2, 3 or 4.

Substitute into Fenella’s equation, the other one:

\begin{aligned} 3(13.50 - 4d) + 2d &= 20.50 \\ 40.50 - 12d + 2d &= 20.50 \\ 40.50 - 10d &= 20.50 \\ -10d &= -20 \\ d &= 2 \end{aligned}

Then s = 13.50 - 4(2) = 5.50.

Check both orders: 3(5.50) + 2(2) = 16.50 + 4 = 20.50, and 5.50 + 4(2) = 13.50. A sandwich costs 5.50 dollars and a drink costs 2 dollars.

Example 6

An answer that is a fraction

Solve the system.

\begin{cases} 2x + 3y = 4 \\ x - y = 3 \end{cases}
Solution

The x in the second equation has coefficient 1, so add y to both sides: x = y + 3. Substitute into the first equation:

\begin{aligned} 2(y + 3) + 3y &= 4 \\ 5y + 6 &= 4 \\ 5y &= -2 \\ y &= -\frac{2}{5} \end{aligned}

Keep the fraction exact. Then

x = -\frac{2}{5} + 3 = -\frac{2}{5} + \frac{15}{5} = \frac{13}{5}

Check in the originals: \displaystyle 2\left(\frac{13}{5}\right) + 3\left(-\frac{2}{5}\right) = \frac{26}{5} - \frac{6}{5} = \frac{20}{5} = 4, and \displaystyle \frac{13}{5} - \left(-\frac{2}{5}\right) = \frac{15}{5} = 3. The solution is \displaystyle \left(\frac{13}{5}, -\frac{2}{5}\right).

The y in the second equation has coefficient -1, so freeing it, y = x - 3, is just as easy. Then 2x + 3(x - 3) = 4, so 5x = 13 and \displaystyle x = \frac{13}{5}: the same pair.

1
4
5
1
-1
-2
x
y
2x + 3y = 4
x - y = 3
\left(\tfrac{13}{5},\ -\tfrac{2}{5}\right)
Figure 2The lines in Example 6 cross at \displaystyle \left(\frac{13}{5}, -\frac{2}{5}\right), between the grid marks. The picture shows roughly where; substitution gives the exact pair.

A graph puts the crossing near (2.6, -0.4), and no reading of a drawing could be sure of the second decimal place. Substitution never had to look.

Example 7

When the variable vanishes

Solve each system, or explain why it has no solution or infinitely many.

(a) x + 2y = 7 and 3x + 6y = 12 \qquad (b) 4x - y = 3 and 8x - 2y = 6

Solution

(a) The x in x + 2y = 7 has coefficient 1: x = 7 - 2y. Substitute into the other equation.

\begin{aligned} 3(7 - 2y) + 6y &= 12 \\ 21 - 6y + 6y &= 12 \\ 21 &= 12 \end{aligned}

The y terms canceled and left a false statement. If some pair solved both equations, 21 = 12 would be true, so no pair does: the system has no solution. Dividing the second equation by 3 gives x + 2y = 4. The same expression x + 2y cannot equal 7 and 4 at once, and the two lines are parallel.

(b) The y in 4x - y = 3 has coefficient -1: y = 4x - 3. Substitute.

\begin{aligned} 8x - 2(4x - 3) &= 6 \\ 8x - 8x + 6 &= 6 \\ 6 &= 6 \end{aligned}

The x terms canceled and left a true statement, true for every x. So every x works, with y = 4x - 3: the system has infinitely many solutions, all the pairs (x, 4x - 3), such as (0, -3), (1, 1) and (2, 5). The second equation is the first multiplied by 2, so both describe the same line. Checking one of them, (2, 5): 4(2) - 5 = 3 and 8(2) - 2(5) = 6.

Boundaries

Substitute into the other equation. The expression has to go into the equation it did not come from. Putting y = 3x - 5 back into y = 3x - 5 gives 3x - 5 = 3x - 5, a true statement that only repeats the first equation. That is not the “infinitely many” case; it is no information at all.

A true statement means the pairs on one line, not every pair. When the variable vanishes and leaves something true, the solutions are the pairs on the one line both equations describe, such as all (x, 5x - 2). A pair off that line, such as (0, 0), is still not a solution.

A variable can be freed only if it is in the equation. Solving for x means dividing by its coefficient, so the coefficient must not be 0. In a system such as y = 5 and 2x + y = 11 the first equation has no x, but it already gives y alone, so substitution is immediate: 2x + 5 = 11, x = 3.

The algebra answers the equations, not the story. In a word problem the solution of the system still has to make sense: a length that came out negative, or a number of people that came out as a fraction, would mean the situation has no answer, or that an equation was written wrongly. That is why Example 4 checked against the words.

Lines only, for the table. For two lines the three outcomes in the table are the only ones. When one equation is a curve, as in systems with a curve, substitution still works but can give two answers.

Where this goes next

Substitution is one of two standard algebraic methods. The other, elimination, adds or subtracts whole equations so that a variable cancels. It is quicker when no coefficient is 1 or -1. Knowing both lets you pick the one with less arithmetic. Word problems with two quantities and two totals become systems too; see systems in word problems. The whole family is mapped under Systems of equations.

Exercises

Part 1: one variable already alone

Solve each system.

  1. y = 2x and x + y = 15
  2. y = x - 1 and 2x + y = 11
  3. x = 3y + 2 and x + 2y = 17
  4. y = 6 - x and 4x - y = 9
  5. y = 2x - 7 and 3x - 2y = 11
  6. x = 5 - 2y and 3x + 4y = 7
  7. y = 3x + 5 and y = -2x - 10
  8. a = 2b + 1 and 3a - 5b = 7

Part 1: checking and a problem

  1. Decide whether each pair is the solution of its system. (a) (2, 5) for y = 3x - 1 and x + y = 8. (b) (4, -1) for x = 2y + 6 and 3x + 5y = 7.
  2. Emrys is 4 years older than Dervla, and their ages add up to 30 years. How old is each?

Part 2: rearrange first

Solve each system. Free a variable whose coefficient is 1 or -1.

  1. x + y = 9 and 3x - y = 7
  2. x - 2y = 3 and 4x + 3y = 23
  3. 5x + y = 1 and 2x + 3y = -10

Part 2: fractions and a café

  1. x + 2y = 3 and 3x - 4y = 14
  2. x + 3y = 2 and 2x - y = 1
  3. At the same café, Aloysius pays 17 dollars for 2 sandwiches and 3 drinks, and Benedetta pays 10 dollars for 1 sandwich and 2 drinks. Find the price of a sandwich and of a drink.

Part 2: when the variable vanishes

Solve each system, or say that it has no solution or infinitely many and describe the solutions.

  1. y = 2x - 5 and 4x - 2y = 7
  2. x + y = 5 and 3x + 3y = 15
  3. x - 3y = 2 and -2x + 6y = 4

Reasoning

  1. Explain why substituting y = x + 4 into 2x - y = 1 gives 2x - (x + 4) = 1 and not 2x - x + 4 = 1. Then finish solving the system.
  2. Dervla solves 2x + 3y = 12 and 4x - y = 3 by freeing x from the first equation. Carry her method through, then explain why freeing y from the second equation is less work. Do the two ways agree?
  3. A substitution ends in 0 = 0. Cyrus says this means x = 0. Explain what it does mean, and why a false statement such as 0 = 3 means something different again.
Answers
  1. (5, 10). x + 2x = 15, so x = 5 and y = 10.
  2. (4, 3). 2x + (x - 1) = 11, so 3x = 12, x = 4 and y = 3.
  3. (11, 3). (3y + 2) + 2y = 17, so 5y = 15, y = 3 and x = 11.
  4. (3, 3). 4x - (6 - x) = 9, so 5x - 6 = 9, x = 3 and y = 3.
  5. (3, -1). 3x - 2(2x - 7) = 11 gives -x + 14 = 11, so x = 3 and y = 2(3) - 7 = -1.
  6. (-3, 4). 3(5 - 2y) + 4y = 7 gives 15 - 2y = 7, so y = 4 and x = 5 - 8 = -3.
  7. (-3, -4). 3x + 5 = -2x - 10, so 5x = -15, x = -3 and y = -4.
  8. a = 9, b = 4. 3(2b + 1) - 5b = 7 gives b + 3 = 7, so b = 4 and a = 9.
  9. (a) No. It satisfies y = 3x - 1, since 3(2) - 1 = 5, but 2 + 5 = 7, not 8. (b) Yes: 2(-1) + 6 = 4 and 3(4) + 5(-1) = 12 - 5 = 7.
  10. Dervla is 13 and Emrys is 17. With e = d + 4 and e + d = 30: 2d + 4 = 30, so d = 13 and e = 17.
  11. (4, 5). Free y = 9 - x. Then 3x - (9 - x) = 7, so 4x = 16, x = 4, y = 5.
  12. (5, 1). Free x = 2y + 3. Then 4(2y + 3) + 3y = 23, so 11y = 11, y = 1, x = 5.
  13. (1, -4). Free y = 1 - 5x. Then 2x + 3(1 - 5x) = -10, so -13x = -13, x = 1, y = -4.
  14. \displaystyle \left(4, -\frac{1}{2}\right). Free x = 3 - 2y. Then 3(3 - 2y) - 4y = 14, so -10y = 5, \displaystyle y = -\frac{1}{2} and x = 3 + 1 = 4.
  15. \displaystyle \left(\frac{5}{7}, \frac{3}{7}\right). Free y = 2x - 1. Then x + 3(2x - 1) = 2, so 7x = 5, \displaystyle x = \frac{5}{7} and \displaystyle y = \frac{10}{7} - \frac{7}{7} = \frac{3}{7}.
  16. A sandwich costs 4 dollars and a drink 3 dollars. With 2s + 3d = 17 and s + 2d = 10, free s = 10 - 2d: 2(10 - 2d) + 3d = 17, so 20 - d = 17, d = 3 and s = 4.
  17. No solution. 4x - 2(2x - 5) = 7 gives 10 = 7, which is false. The lines have the same slope 2 and are parallel.
  18. Infinitely many: every pair (x, 5 - x). Freeing y = 5 - x gives 3x + 3(5 - x) = 15, that is 15 = 15, true for every x. The second equation is the first multiplied by 3.
  19. No solution. Freeing x = 3y + 2 gives -2(3y + 2) + 6y = 4, that is -4 = 4, false.
  20. (5, 9). The -y subtracts all of y, and y is all of x + 4, so both terms are subtracted: 2x - (x + 4) = x - 4. Without the brackets the 4 would be added. Then x - 4 = 1, x = 5 and y = 9; check 10 - 9 = 1.
  21. Both ways give \displaystyle \left(\frac{3}{2}, 3\right). Her way: \displaystyle x = 6 - \frac{3}{2}y, so \displaystyle 4\left(6 - \frac{3}{2}y\right) - y = 3, 24 - 7y = 3, y = 3 and \displaystyle x = \frac{3}{2}. Freeing y = 4x - 3 needs no division because its coefficient is -1: 2x + 3(4x - 3) = 12 gives 14x = 21, \displaystyle x = \frac{3}{2}, y = 3. The choice changes the arithmetic, never the answer.
  22. The variable canceled, so 0 = 0 is true whatever x is. Every x works, with the y the freed equation gives: infinitely many solutions on one line, of which x = 0 is only one. A false statement such as 0 = 3 means a solution would make something false true, so there is no solution: the lines are parallel.
kg1128 · updated 2026-10-09 · CC-BY-SA-4.0