This site is a work in progress. New lessons are added regularly. Contact us

Equations with Two Variables

Learning goals

  • Write a linear equation in two variables as ax+by=cax + by = c
  • Test an ordered pair by substituting in the right order
  • Generate solutions by solving for one variable and choosing values
  • Recognize the graph as the whole solution set, a line
  • Explain why a second equation is needed to fix one pair

What a two-variable equation is

A linear equation in two variables is an equation that can be arranged into the standard form

ax+by=c,ax + by = c,

where aa, bb, and cc are numbers and aa and bb are not both zero. The two variables are usually called xx and yy. Each one appears only to the first power: never squared, never multiplied by the other, never under a root, and never in a denominator. That restriction is what keeps the equation linear, exactly as it did for the one-variable equations of the last chapter.

These are linear equations in two variables:

2x+3y=12,xy=4,y=3x1.2x + 3y = 12, \qquad x - y = 4, \qquad y = 3x - 1.

The last one does not look like the standard form at first, but subtracting 3x3x from both sides turns it into 3x+y=1-3x + y = -1, which fits the pattern. These are not linear:

xy=6(the variables are multiplied),x2+y=5(x is squared).xy = 6 \quad (\text{the variables are multiplied}), \qquad x^2 + y = 5 \quad (x \text{ is squared}).

A one-variable linear equation such as 2x=62x = 6 locks its variable to a single value. With two variables in a single equation, one number can no longer settle both. So instead of asking for the value of xx we look for pairs of values, one for xx and one for yy, that fit together.

When is a pair a solution?

A solution of a two-variable equation is an ordered pair (x,y)(x, y). It counts as a solution when putting the first number in for xx and the second for yy makes the equation true. You already have the tool to test one: substitution, the same check you used for one-variable equations.

Take 2x+3y=122x + 3y = 12 and test the pair (3,2)(3, 2). Substitute x=3x = 3 and y=2y = 2 into the left side:

2(3)+3(2)=6+6=12.2(3) + 3(2) = 6 + 6 = 12.

The left side equals 1212, matching the right, so (3,2)(3, 2) is a solution. Now test (1,1)(1, 1):

2(1)+3(1)=2+3=5,2(1) + 3(1) = 2 + 3 = 5,

which is not 1212, so (1,1)(1, 1) is not a solution.

The word ordered matters as much here as it did when you plotted points. The pair (2,3)(2, 3) is a different claim from (3,2)(3, 2): it puts x=2x = 2 and y=3y = 3, giving 2(2)+3(3)=4+9=132(2) + 3(3) = 4 + 9 = 13, not 1212. So (3,2)(3, 2) solves the equation while (2,3)(2, 3) does not, even though they use the same two numbers. Always feed the first coordinate to xx and the second to yy.

Worked example 1 Test whether pairs solve 3x+2y=123x + 2y = 12

Check each pair by substituting the first number for xx and the second for yy, then compare the left side with 1212.

For (2,3)(2, 3):

3(2)+2(3)=6+6=12.True, so (2,3) is a solution.3(2) + 2(3) = 6 + 6 = 12. \quad \text{True, so } (2, 3) \text{ is a solution.}

For (4,1)(4, 1):

3(4)+2(1)=12+2=14.Not 12, so (4,1) is not a solution.3(4) + 2(1) = 12 + 2 = 14. \quad \text{Not } 12, \text{ so } (4, 1) \text{ is not a solution.}

For (0,6)(0, 6):

3(0)+2(6)=0+12=12.True, so (0,6) is a solution.3(0) + 2(6) = 0 + 12 = 12. \quad \text{True, so } (0, 6) \text{ is a solution.}

Two of the three pairs check out. Notice that (0,6)(0, 6) works even though x=0x = 0: the term 3x3x becomes 00, but it is still there and still counted. A zero coordinate never lets you drop a term.

Check your understanding

Which ordered pair is a solution of 2x+y=102x + y = 10?

Answer choices

Why there are infinitely many solutions

A single two-variable equation does not have one solution or a handful. It has infinitely many, and there is a simple procedure that produces them on demand. Solve the equation for one variable, then feed in any value you like for the other.

Take 2x+y=62x + y = 6. Solving for yy takes one move, subtracting 2x2x from both sides:

y=62x.y = 6 - 2x.

Now yy is written directly in terms of xx. Choose any number for xx, and this formula hands back the matching yy, so the pair (x,y)(x, y) solves the equation. Choose x=1x = 1 and you get y=62=4y = 6 - 2 = 4, the pair (1,4)(1, 4). Because you can pick xx to be any number at all, and every pick produces a solution, there is no end to them.

Here is the argument in full, for any linear equation in two variables.

Why ax+by=cax + by = c has infinitely many solutions#

Start with ax+by=cax + by = c, and suppose b0b \neq 0 (if instead a0a \neq 0, the same reasoning works with the roles of xx and yy swapped). Solve for yy: subtract axax from both sides and then divide by bb, which is allowed precisely because bb is not zero,

y=caxb.y = \frac{c - ax}{b}.

Now pick any number whatsoever for xx. The right-hand side is then a definite arithmetic expression, so it evaluates to exactly one number, and that number is the matching yy. By construction the pair (x,caxb)\left(x, \frac{c - ax}{b}\right) satisfies the original equation, because we obtained yy from it.

There are infinitely many numbers to choose from for xx: the whole numbers 0,1,2,0, 1, 2, \ldots alone are already endless, and each different choice of xx produces a different pair. So the equation has infinitely many solutions. One equation, then, is nowhere near enough to pin down two unknowns. A single equation narrows the possibilities from every pair in the plane down to a single line’s worth of them, but no further. That is exactly why the next lessons bring in a second equation to isolate one pair.

A neat way to keep track of these solutions is a table. Solve for one variable, list a few values of the other, and compute. Using y=62xy = 6 - 2x:

xxy=62xy = 6 - 2xSolution (x,y)(x, y)
1-188(1,8)(-1, 8)
0066(0,6)(0, 6)
1144(1,4)(1, 4)
2222(2,2)(2, 2)
3300(3,0)(3, 0)

Every row is a genuine solution, and you could extend the table forever in either direction. Notice a pattern already: each time xx goes up by 11, yy drops by 22. Hold on to that, because it is what makes the graph a straight line.

Worked example 2 Fill in the missing coordinate for 3x+2y=183x + 2y = 18

When one coordinate of a solution is known, substitute it and solve the one-variable equation that remains for the other coordinate.

Find the solution with x=4x = 4. Put x=4x = 4 into 3x+2y=183x + 2y = 18:

3(4)+2y=18,12+2y=18,2y=6,y=3.3(4) + 2y = 18, \qquad 12 + 2y = 18, \qquad 2y = 6, \qquad y = 3.

So (4,3)(4, 3) is a solution. Find the solution with y=0y = 0. Put y=0y = 0:

3x+2(0)=18,3x=18,x=6.3x + 2(0) = 18, \qquad 3x = 18, \qquad x = 6.

So (6,0)(6, 0) is a solution. Each known coordinate turns the two-variable equation into an ordinary one-variable equation, which you already know how to solve.

Check your understanding

Rewriting 4x+y=94x + y = 9 to give yy in terms of xx, what do you get?

Answer choices

The solutions form a straight line

Solutions are pairs (x,y)(x, y), and pairs are points on the coordinate plane, so a natural question is what the whole collection of solutions looks like once plotted. Take the solutions of 2x+y=62x + y = 6 from the table and plot the four that fit on the grid.

The line of solutions of 2x + y = 6A coordinate grid with the points (0, 6), (1, 4), (2, 2), (3, 0) marked; they lie on one straight line, the graph of 2x + y = 6.xy01352462x + y = 6(0, 6)(1, 4)(2, 2)(3, 0)
The four plotted solutions (0, 6), (1, 4), (2, 2), (3, 0) of 2x + y = 6 all fall on one straight line. Every point on that line is a solution, and every solution is a point on the line.

The points do not scatter. They fall on one straight line, and this happens for every linear equation, which is where the name linear comes from. The reason is the pattern you spotted in the table: each step of 11 to the right in xx drops yy by the same 22. So from any plotted point the next one sits one across and two down, every time. Equal steps across paired with equal steps down trace a straight path and never bend. (That steady rate of change is what the graphing chapter will call the line’s slope; here we need only the fact that the solutions line up.)

The line is the complete picture of the solution set, and this goes both ways. Every solution of the equation is one of the points on the line. Every point on the line, including the ones between the whole-number dots, is a solution. So “the graph of 2x+y=62x + y = 6” and “the set of all pairs that solve 2x+y=62x + y = 6” name the very same thing. To draw the line you only need two solutions, since two points determine a line. But plotting a third is a good check: if it does not land on the same line, one of your pairs is wrong.

Worked example 3 Solutions of 2x+3y=122x + 3y = 12 for chosen values of xx

Solve for yy first, so each value of xx is quick to evaluate. Subtract 2x2x and divide by 33:

y=122x3.y = \frac{12 - 2x}{3}.

At x=0x = 0:

y=1203=4,the pair (0,4).y = \frac{12 - 0}{3} = 4, \qquad \text{the pair } (0, 4).

At x=3x = 3:

y=1263=2,the pair (3,2).y = \frac{12 - 6}{3} = 2, \qquad \text{the pair } (3, 2).

At x=1x = 1:

y=1223=103,the pair (1,103).y = \frac{12 - 2}{3} = \frac{10}{3}, \qquad \text{the pair } \left(1, \tfrac{10}{3}\right).

The first two pairs land on whole-number grid points, but the third does not, and it is every bit as valid a solution. Solutions of a linear equation are not required to be whole numbers. Between any two of the tidy grid points, the line is packed with fractional solutions like this one.

Check your understanding

Which of these points lies on the graph of x+y=5x + y = 5?

Answer choices

The figure below is that checkpoint, left open. The line drawn on it is x+y=5x + y = 5, which is the same rule written as y=x+5y = -x + 5. The hollow marker is a pair you can move anywhere on the grid. It starts at (1,3)(1, 3), the first option, and the sentence under the figure does the substitution out loud. Walk the marker through (4,2)(4, 2), (2,3)(2, 3) and (3,3)(3, 3) and watch which one lands.

What is worth noticing is not that one of the four works. It is that the marker landing on the line and the substitution checking out are the same event, every single time. You can also see them happen together rather than being told they agree. Send the marker somewhere the checkpoint never mentioned, (5,0)(5, 0) or (1,6)(-1, 6), and the rule holds there too. The line is not a summary of the four tidy pairs, it is the complete list of them.

Then change the line itself. Move the rise and the run and the marker stays exactly where you put it, now testing the same pair against a different equation. That is the other half of the same idea: a pair is not a solution on its own, it is a solution of something.

Is the pair a solution of x+y=5x + y = 5?

y = -x + 5. Rise -1 over run 1 is a slope of -1, so from any point on the line, 1 to the right and 1 down lands back on it. And it crosses the vertical axis at 5. The point (1, 3) is not a solution: putting x = 1 into the equation gives y = 4, and the point sits at 3 instead. A coordinate plane with a straight line drawn across it, and a hollow point being tested against the line. Use the controls below the figure to change the rise, the run, where the line crosses the vertical axis, or move the point being tested. -2 2 4 6 8 -2 2 4 6 8
Rise Run Crosses at Point x Point y

y = -x + 5. Rise -1 over run 1 is a slope of -1, so from any point on the line, 1 to the right and 1 down lands back on it. And it crosses the vertical axis at 5. The point (1, 3) is not a solution: putting x = 1 into the equation gives y = 4, and the point sits at 3 instead.

A coordinate plane carrying a straight line and a separate hollow marker. The marker can be moved to any grid point, and the sentence below the figure substitutes its first coordinate into the equation and compares the result with its second.

Looking ahead: two equations, one point

A single two-variable equation leaves a whole line of possibilities open. To single out one specific pair, you need a second equation, a second condition the pair must also satisfy at the same time. Two such equations considered together are called a system of equations, and that is the subject of the rest of this chapter.

The graph makes the goal vivid. Each equation is a line, so a pair that solves both must lie on both lines at once, which means it sits exactly where the two lines cross. Consider the pairs solving x+y=6x + y = 6 and, separately, the pairs solving xy=2x - y = 2. The single pair (4,2)(4, 2) lies on both lines, because 4+2=64 + 2 = 6 and 42=24 - 2 = 2 are both true, so it is the one pair that solves the system.

Two lines crossing at the solution of a systemThe lines x + y = 6 and x - y = 2 drawn on a coordinate grid, intersecting at the point (4, 2).xy0246246x + y = 6x - y = 2(4, 2)
Two equations, two lines. The pairs solving x + y = 6 form one line and the pairs solving x - y = 2 form another. The single crossing point (4, 2) is the one pair that solves both, the solution of the system.

Reading a crossing point off a graph is quick to picture but hard to do exactly, especially when the answer is a fraction. So the coming lessons develop algebra that finds the crossing point without drawing anything: substitution and elimination. Both rest on the idea you built here, that a two-variable equation stands for a line’s worth of solution pairs. Both also rest on the second part of that idea, that where a system’s two lines cross, the shared pair is its answer.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

Ancient Indian astronomers had a counting problem. Two planets circle the sky at different speeds. If they set out together, how many days pass before they line up again?

The question becomes a single equation with two unknowns. One unknown is the number of days. The other is the number of extra full turns the faster planet makes. Every pair of numbers that fits the equation answers the question, and there are endlessly many such pairs. You have just seen why. But the astronomers could not use most of them. The question reached them in whole units, so many days elapsed and so many turns completed, and an answer had to arrive in the same terms.

So they wanted the answers built from whole numbers only. Aryabhata, an astronomer working in India around the year 499499, set out a method for finding them. Later writers named it the kuttaka, the pulverizer. It grinds the numbers down in stages until the answer is small enough to read. It is one of the first general recipes for a problem with more unknowns than given facts.

Notice the shape of what they did. One equation left them a whole line of pairs. They narrowed it by adding a demand of their own, that the answers be whole. This chapter narrows it the other way. It hands you a second equation instead, and the two facts together cut the line down to a single crossing point.