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 unrestricted real pairs need a second equation 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 variable that appears has only the first power: never squared, never multiplied by the other, never under a root, and never in a denominator. The same first-power rule made the one-variable equations of the last chapter linear.

These are linear equations in two variables:

2x+3y=12,x−y=4,y=3x−1.\begin{gathered} 2x + 3y = 12, \\ x - y = 4, \\ y = 3x - 1. \end{gathered}

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).\begin{gathered} xy = 6 \quad (\text{the variables are multiplied}), \\ x^2 + y = 5 \quad (x \text{ is squared}). \end{gathered}

A one-variable linear equation such as 2x=62x = 6 has a single solution, x=3x = 3. With two variables in a single equation, one number cannot be the whole answer. 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.3(2) + 2(3) = 6 + 6 = 12.

So (2,3)(2, 3) is a solution.

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

3(4)+2(1)=12+2=14.3(4) + 2(1) = 12 + 2 = 14.

This is not 1212, so (4,1)(4, 1) is not a solution.

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

3(0)+2(6)=0+12=12.3(0) + 2(6) = 0 + 12 = 12.

So (0,6)(0, 6) is a solution.

Two of the three pairs check out. For (0,6)(0,6), substitute x=0x=0 as usual: 3x3x evaluates to 00. You can then simplify the sum, leaving 2(6)=122(6)=12.

Check your understanding

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

Answer choices

Why there are infinitely many solutions

A linear equation in two variables has infinitely many solutions when both variables may be any real numbers. To generate them, solve for a variable with a nonzero coefficient, then choose values for the other.

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

y=6−2x.y = 6 - 2x.

Now yy is written directly in terms of xx. Choose any number for xx, and this formula gives the matching yy, so the pair (x,y)(x, y) solves the equation. Choose x=1x = 1 and you get y=6−2=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 are infinitely many solutions.

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

Consider 3x+2y=83x + 2y = 8. Subtract 3x3x and divide by 22 to get y=(8−3x)/2y=(8-3x)/2. Choosing x=2x=2 gives y=1y=1, and 3(2)+2(1)=83(2)+2(1)=8 checks. Any real choice of xx gives a matching yy. Different choices of xx give different pairs, so there are infinitely many pairs.

The same steps work for other coefficients, as long as the coefficient of yy is not zero. For ax+by=cax+by=c with b≠0b\neq0, subtracting axax and dividing by bb give

y=c−axb.y=\frac{c-ax}{b}.

Every real choice of xx gives exactly one matching yy, and substitution checks it:

ax+b(c−axb)=ax+c−ax=c.ax+b\left(\frac{c-ax}{b}\right)=ax+c-ax=c.

If b=0b=0, we cannot divide by it. Instead a≠0a\neq0, because the two coefficients are not both zero. Then x=c/ax=c/a while yy may be any real number. For example, 3x=123x=12, read as 3x+0y=123x+0y=12, gives the pairs (4,y)(4,y), all on the vertical line x=4x=4. This case also has infinitely many solutions.

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=6−2xy = 6 - 2x:

xxy=6−2xy = 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 solution, and you could keep adding rows in either direction. Notice the pattern: each time xx goes up by 11, yy drops by 22. We will use this pattern to see why the graph is a straight line.

A context can restrict those choices. If xx and yy count items, they must be nonnegative whole numbers. For example, 2x+3y=62x+3y=6 then permits only (3,0)(3,0) and (0,2)(0,2). By contrast, 2x+4y=32x+4y=3 has no such pair: its left side is always even.

When both coefficients are positive and the total is fixed, each count has an upper bound, so only finitely many count pairs can fit, possibly none. The whole line shows the solutions of the unrestricted equation, and the context tells you which of its points are allowed. For unrestricted real pairs, a second equation is needed to narrow the line to a single point.

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.\begin{gathered} 3(4) + 2y = 18, \\ 12 + 2y = 18, \\ 2y = 6, \\ y = 3. \end{gathered}

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.\begin{gathered} 3x + 2(0) = 18, \\ 3x = 18, \\ x = 6. \end{gathered}

So (6,0)(6, 0) is a solution.

Check your understanding

Which equation is equivalent to y=9−4xy=9-4x and written in standard form ax+by=cax+by=c?

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 fall on one straight line. This happens for every linear equation, and it 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 is one across and two down. Because every step is the same, the points lie on a straight line. (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 same thing. To draw the line you only need two solutions, since two distinct 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=12−2x3.y = \frac{12 - 2x}{3}.

At x=0x = 0:

y=12−03=4,the pair (0,4).\begin{gathered} y = \frac{12 - 0}{3} = 4, \\ \text{the pair } (0, 4). \end{gathered}

At x=3x = 3:

y=12−63=2,the pair (3,2).\begin{gathered} y = \frac{12 - 6}{3} = 2, \\ \text{the pair } (3, 2). \end{gathered}

At x=1x = 1:

y=12−23=103,the pair (1,103).\begin{gathered} y = \frac{12 - 2}{3} = \frac{10}{3}, \\ \text{the pair } \left(1, \tfrac{10}{3}\right). \end{gathered}

The first two pairs land on whole-number grid points. The third does not, but it is still a solution: solutions of a linear equation do not have to be whole numbers. Between any two of the grid points, the line holds many more solutions whose coordinates are not whole numbers, like this one.

Check your understanding

Solve 2x+3y=122x + 3y = 12 for yy, then choose the solution pair when x=−3x = -3.

Answer choices

Check your understanding

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

Answer choices

The graph below starts with x+y=5x+y=5, written as y=−x+5y=-x+5 in its readout. Test the checkpoint by moving the marker through (4,2)(4,2), (2,3)(2,3), and (3,3)(3,3). The marker is on the line exactly when its pair makes the equation true. Try (5,0)(5,0) or (−1,6)(-1,6) too: the line includes every solution, not just (2,3)(2,3).

Then change the rise or run while leaving the marker fixed, and watch the readout: the pair that solved the old equation may not solve the new one.

Does the marked pair solve the current line?

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

With unrestricted real coordinates, a single linear 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 shows what we are looking for. Each equation is a line, so a pair that solves both must lie on both lines at once, which means it sits wherever the two lines cross. The two lines may cross at exactly one point; the coming lessons also cover lines that never cross and equations whose lines lie one on top of the other. Consider the pairs solving x+y=6x + y = 6 and, separately, the pairs solving x−y=2x - y = 2. The single pair (4,2)(4, 2) lies on both lines, because 4+2=64 + 2 = 6 and 4−2=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.

Check your understanding

Why does also requiring x−y=1x-y=1, alongside x+y=7x+y=7, fix one pair of real numbers?

Answer choices

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.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

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

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems 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 wanted to determine the periods of the planets: how long each repeating motion takes. Aryabhata’s verses listed revolution counts over a vast span of time called a yuga. Work on planetary periods also led to equations with two unknowns whose answers had to be integers. A fractional pair might solve an equation without meeting that counting requirement.

Aryabhata described a method for these integer equations in his Aryabhatiya, written in 499. The method is called kuttaka, the pulverizer. It replaces a difficult problem by related problems with smaller and smaller coefficients, then works back to recover the answer. The name refers to this repeated grinding down of the numbers.

The Aryabhatiya is a short text in verse that covers both mathematics and astronomy. Later writers, including Brahmagupta, also described methods for these integer equations.

MacTutor’s biography of Aryabhata describes the astronomy problems, the date of the work, and the pulverizer method. Walter Eugene Clark’s translation of the Aryabhatiya includes these verses and discusses the later tradition.

Your progress

See all your progress →