Skip to ContentGo to accessibility pageKeyboard shortcuts menu
OpenStax Logo
Contemporary Mathematics

5.9 Systems of Linear Equations in Two Variables

Contemporary Mathematics5.9 Systems of Linear Equations in Two Variables

Baskets of vegetables are displayed at a farmers' market.
Figure 5.82 Fruits and vegetables at a farmer’s market. (credit: “California Ave. Farmers’ Market” by Jun Seita/Flickr, CC BY 2.0)

Learning Objectives

After completing this section, you should be able to:

  1. Determine and show whether an ordered pair is a solution to a system of equations.
  2. Solve systems of linear equations using graphical methods.
  3. Solve systems of linear equations using substitution.
  4. Solve systems of linear equations using elimination.
  5. Identify systems with no solution or infinitely many solutions.
  6. Solve applications of systems of linear equations.

In this section, we will learn how to solve systems of linear equations in two variables. There are several real-world scenarios that can be represented by systems of linear equalities. Suppose two friends, Andrea and Bart, go shopping at a farmers market to buy some vegetables. Andrea buys 2 tomatoes and 4 cucumbers and spends $2.00. Bart buys 4 tomatoes and 5 cucumbers and spends $2.95. What is the price of each vegetable?

Determining If an Ordered Pair Is a Solution to a System of Equations

When we solved linear equations in Linear Equations in One Variable with Applications and Linear Inequalities in One Variable with Applications, we learned how to solve linear equations with one variable. Now we will work with two or more linear equations grouped together, which is known as a system of linear equations.

In this section, we will focus our work on systems of two linear equations in two unknowns (variables) and applications of systems of linear equations. An example of a system of two linear equations is shown below. We use a brace to show the two equations are grouped together to form a system of equations.

{2x+y=7x2y=6{2x+y=7x2y=6

A linear equation in two variables, such as 2x+y=72x+y=7, has an infinite number of solutions. Its graph is a line. Remember, every point on the line is a solution to the equation and every solution to the equation is a point on the line. To solve a system of two linear equations, we want to find the values of the variables that are solutions to both equations. In other words, we are looking for the ordered pairs (xx, yy) that make both equations true. These are called the solutions of a system of equations.

To determine if an ordered pair is a solution to a system of two equations, we substitute the values of the variables into each equation. If the ordered pair makes both equations true, it is a solution to the system.

Example 5.81

Determining Whether an Ordered Pair Is a Solution to the System

Determine whether the ordered pair is a solution to the system.

{xy=12xy=5{xy=12xy=5
  1. (2,1)(2,1)
  2. (4,3)(4,3)

Your Turn 5.81

Determine whether the ordered pair is a solution to the system.
{ x 3 y = 8 3 x y = 4
1.
( 2 , 2 )
2.
( 2 , 2 )

Example 5.82

Determining Whether an Ordered Pair Is a Solution to the System

Determine whether the ordered pair is a solution to the system

{y=32x+12x3y=7{y=32x+12x3y=7
  1. (4,5)(4,5)
  2. (4,5)(4,5)

Your Turn 5.82

Determine whether the ordered pair is a solution to the system.
{ y = 2 3 x + 1 2 x + 3 y = 5
1.
( 3 , 3 )
2.
( 3 , 3 )

Solving Systems of Linear Equations Using Graphical Methods

We will use three methods to solve a system of linear equations. The first method we will use is graphing. The graph of a linear equation is a line. Each point on the line is a solution to the equation. For a system of two equations, we will graph two lines. Then we can see all the points that are solutions to each equation. And, by finding what points the lines have in common, we will find the solution to the system.

Most linear equations in one variable have one solution; but for some equations called contradictions, there are no solutions, and for other equations called identities, all numbers are solutions. Similarly, when we solve a system of two linear equations represented by a graph of two lines in the same plane, there are three possible cases, as shown in Figure 5.83.

Three coordinate planes. The first coordinate plane shows one line passing through the points, (0, 7) and (3.5, 0) and a second line passing through the points, (0, negative 3) and (6, 0). The two lines intersect at the point (4, negative 1). Text reads, The lines intersect. Intersecting line shave one point in common. There is one solution to this system. The second coordinate plane shows one line passing through the points, (negative 8, 0) and (0, 3) and a second line passing through the points, (0, negative 2) and (5, 0). The lines do not intersect. Text reads, The lines are parallel. Parallel lines have no points in common. There is no solution to this system. The third coordinate plane shows a line passing through the points, (0, negative 3) and (1.5, 0). Text reads, Both equations give the same line. Because we have just one line, there are infinitely many solutions.
Figure 5.83

Each time we demonstrate a new method, we will use it on the same system of linear equations. At the end you will decide which method was the most convenient way to solve this system.

The steps to use to solve a system of linear equations by graphing are shown here.

Step 1: Graph the first equation.

Step 2: Graph the second equation on the same rectangular coordinate system.

Step 3: Determine whether the lines intersect, are parallel, or are the same line.

Step 4: Identify the solution to the system.

If the lines intersect, identify the point of intersection. This is the solution to the system.

If the lines are parallel, the system has no solution.

If the lines are the same, the system has an infinite number of solutions.

Step 5: Check the solution in both equations.

Example 5.83

Solving a System of Linear Equations by Graphing

Solve this system of linear equations by graphing.

{2x+y=7x2y=6{2x+y=7x2y=6

Your Turn 5.83

1.
Solve this system of linear equations by graphing.
{ x 3 y = 3 x + y = 5

Solving Systems of Linear Equations Using Substitution

We will now solve systems of linear equations by the substitution method. We will use the same system we used for graphing.

{2x+y=7x2y=6{2x+y=7x2y=6

We will first solve one of the equations for either xx or yy. We can choose either equation and solve for either variable—but we’ll try to make a choice that will keep the work easy. Then, we substitute that expression into the other equation. The result is an equation with just one variable—and we know how to solve those!

After we find the value of one variable, we will substitute that value into one of the original equations and solve for the other variable. Finally, we check our solution and make sure it makes both equations true. This process is summarized here:

Step 1: Solve one of the equations for either variable.

Step 2: Substitute the expression from Step 1 into the other equation.

Step 3: Solve the resulting equation.

Step 4: Substitute the solution in Step 3 into either of the original equations to find the other variable.

Step 5: Write the solution as an ordered pair.

Step 6: Check that the ordered pair is a solution to both original equations.

Example 5.84

Solving a System of Linear Equations Using Substitution

Solve this system of linear equations by substitution:

{2x+y=7x2y=6{2x+y=7x2y=6

Your Turn 5.84

1.
Solve this system of linear equations by substitution:
{ x 3 y = 3 x + y = 5

Solving Systems of Linear Equations Using Elimination

We have solved systems of linear equations by graphing and by substitution. Graphing works well when the variable coefficients are small, and the solution has integer values. Substitution works well when we can easily solve one equation for one of the variables and not have too many fractions in the resulting expression.

The third method of solving systems of linear equations is called the elimination method. When we solved a system by substitution, we started with two equations and two variables and reduced it to one equation with one variable. This is what we’ll do with the elimination method, too, but we’ll have a different way to get there.

The elimination method is based on the Addition Property of Equality. The Addition Property of Equality says that when you add the same quantity to both sides of an equation, you still have equality. We will extend the Addition Property of Equality to say that when you add equal quantities to both sides of an equation, the results are equal. For any expressions aa, bb, cc, and dd:

if a=ba=b

and c=dc=d

then a+c=b+da+c=b+d.

To solve a system of equations by elimination, we start with both equations in standard form. Then we decide which variable will be easiest to eliminate. How do we decide? We want to have the coefficients of one variable be opposites, so that we can add the equations together and eliminate that variable. Notice how that works when we add these two equations together:

{3x+y=52xy=0_5x=5{3x+y=52xy=0_5x=5

The yy’s add to zero and we have one equation with one variable. Let us try another one:

{x+4y=22x+5y=2{x+4y=22x+5y=2

This time we do not see a variable that can be immediately eliminated if we add the equations. But if we multiply the first equation by 22, we will make the coefficients of xx opposites. We must multiply every term on both sides of the equation by 22.

{2(x+4y)=2(–2)2x+5y=2{2(x+4y)=2(–2)2x+5y=2

Then rewrite the system of equations.

{2x8y=42x+5y=2{2x8y=42x+5y=2

Now we see that the coefficients of the xx terms are opposites, so xx will be eliminated when we add these two equations.

{2x8y=42x+5y=2_3y=2{2x8y=42x+5y=2_3y=2

Once we get an equation with just one variable, we solve it. Then we substitute that value into one of the original equations to solve for the remaining variable. And, as always, we check our answer to make sure it is a solution to both of the original equations. Here’s a summary of using the elimination method:

Step 1: Write both equations in standard form. If any coefficients are fractions, clear them.

Step 2: Make the coefficients of one variable opposites.

Decide which variable you will eliminate.

Multiply one or both equations so that the coefficients of that variable are opposites.

Step 3: Add the equations resulting from Step 2 to eliminate one variable.

Step 4: Solve for the remaining variable.

Step 5: Substitute the solution from Step 4 into one of the original equations. Then solve for the other variable.

Step 6: Write the solution as an ordered pair.

Step 7: Check that the ordered pair is a solution to both original equations.

Example 5.85

Solving a System of Linear Equations Using Elimination

Solve this system of linear equations by elimination:

{2x+y=7x2y=6{2x+y=7x2y=6

Your Turn 5.85

1.
Solve this system of linear equations by elimination:
{ x 3 y = 3 x + y = 5

Identifying Systems with No Solution or Infinitely Many Solutions

In all the systems of linear equations so far, the lines intersected, and the solution was one point. In Example 5.86 and Example 5.87, we will look at a system of equations that has no solution and at a system of equations that has an infinite number of solutions.

Example 5.86

Solving a System of Linear Equations with No Solution

Solve the system by a method of your choice:

{y=12x3x2y=4{y=12x3x2y=4

Your Turn 5.86

1.
Solve the system by a method of your choice:
{ y = 1 3 x + 2 x 3 y = 7

Example 5.87

Solving a System of Linear Equations with Infinite Solutions

Solve the system by a method of your choice:

{y=2x36x+3y=9{y=2x36x+3y=9

Your Turn 5.87

1.
Solve the system by a method of your choice:
{ y = 3 x 5 18 x + 6 y = 30

In the previous example, if you write the second equation in slope-intercept form, you may recognize that the equations have the same slope and same yy-intercept. Since every point on the line makes both equations true, there are infinitely many ordered pairs that make both equations true. There are infinitely many solutions to the system. We say the two lines are coincident. Coincident lines have the same slope and same yy-intercept. A system of equations that has at least one solution is called a consistent system. A system with parallel lines has no solution. We call a system of equations like this an inconsistent system. It has no solution.

We also categorize the equations in a system of equations by calling the equations independent or dependent. If two equations are independent, they each have their own set of solutions. Intersecting lines and parallel lines are independent. If two equations are dependent, all the solutions of one equation are also solutions of the other equation. When we graph two dependent equations, we get coincident lines. Let us sum this up by looking at the graphs of the three types of systems. See Figure 5.86 and the table that follows

Three coordinate planes. The first coordinate plane is labeled, Intersecting. One line passes through the points, (0, 3.5) and (1.75, 0). A second line passes through the points, (0, negative 1.5) and (3, 0). The two lines intersect at the point (2, negative 0.5). The second coordinate plane is labeled, Parallel. One line passes through the points, (negative 0.5, 0) and (0, 1). A second line passes through the points, (0, negative 1.5) and (1, 0). The lines do not intersect. The third coordinate plane is labeled, Coincident. A line passes through the points, (0, negative 1.5) and (0.75, 0). Three coordinate planes. The first coordinate plane is labeled, Intersecting. One line passes through the points, (0, 3.5) and (1.75, 0). A second line passes through the points, (0, negative 1.5) and (3, 0). The two lines intersect at the point (2, negative 0.5). The second coordinate plane is labeled, Parallel. One line passes through the points, (negative 0.5, 0) and (0, 1). A second line passes through the points, (0, negative 1.5) and (1, 0). The lines do not intersect. The third coordinate plane is labeled, Coincident. A line passes through the points, (0, negative 1.5) and (0.75, 0). Three coordinate planes. The first coordinate plane is labeled, Intersecting. One line passes through the points, (0, 3.5) and (1.75, 0). A second line passes through the points, (0, negative 1.5) and (3, 0). The two lines intersect at the point (2, negative 0.5). The second coordinate plane is labeled, Parallel. One line passes through the points, (negative 0.5, 0) and (0, 1). A second line passes through the points, (0, negative 1.5) and (1, 0). The lines do not intersect. The third coordinate plane is labeled, Coincident. A line passes through the points, (0, negative 1.5) and (0.75, 0).
Figure 5.86
Lines Intersecting Parallel Coincident
Number of Solutions 1 point No solution Infinitely many
Consistent/Inconsistent Consistent Inconsistent Consistent
Dependent/Independent Independent Independent Dependent

WORK IT OUT

Using Matrices and Cramer’s Rule to Solve Systems of Linear Equations

An mm by nn matrix is an array with mm rows and nn columns, where each item in the matrix is a number. Matrices are used for many things, but one thing they can be used for is to represent systems of linear equations. For example, the system of linear equations

{2x+y=7x2y=6{2x+y=7x2y=6

can be represented by the following matrix:

[217126][217126]

To use Cramer’s Rule, you need to be able to take the determinant of a matrix. The determinant of a 2 by 2 matrix AA, denoted |A||A|, is

|A|=|a11a12a21a22|=(a11×a22)+(a21×a12)|A|=|a11a12a21a22|=(a11×a22)+(a21×a12)

For example, the determinant of the matrix |2132|=(2×2)(3×1)=43=7.|2132|=(2×2)(3×1)=43=7.

Cramer’s Rule involves taking three determinants:

  1. The determinant of the first two columns, denoted |D||D|;
  2. The determinant of the first column and the third column, denoted |Dy||Dy|;
  3. The determinant of the third column and the first column, denoted |Dx||Dx|.

Going back to the original matrix [217126][217126]

|D|=|2112|=41=5|D|=|2112|=41=5
|Dy|=|2716|=127=5|Dy|=|2716|=127=5
|Dx|=|7162|=146=20|Dx|=|7162|=146=20

Now Cramer’s Rule for the solution of the system will be:

x=|Dx||D|,y=|Dy||D|x=|Dx||D|,y=|Dy||D|

Putting in the values for these determinants, we have x=205=4;y=55=1.x=205=4;y=55=1. The solution to the system is the ordered pair (4,1)(4,1).

Solving Applications of Systems of Linear Equations

Systems of linear equations are very useful for solving applications. Some people find setting up word problems with two variables easier than setting them up with just one variable. To solve an application, we will first translate the words into a system of linear equations. Then we will decide the most convenient method to use, and then solve the system.

Step 1: Read the problem. Make sure all the words and ideas are understood.

Step 2: Identify what we are looking for.

Step 3: Name what we are looking for. Choose variables to represent those quantities.

Step 4: Translate into a system of equations.

Step 5: Solve the system of equations using good algebra techniques.

Step 6: Check the answer in the problem and make sure it makes sense.

Step 7: Answer the question with a complete sentence.

Example 5.88

Applying System to a Real-World Application

Heather has been offered two options for her salary as a trainer at the gym. Option A would pay her $25,000 a year plus $15 for each training session. Option B would pay her $10,000 a year plus $40 for each training session. How many training sessions would make the salary options equal?

Your Turn 5.88

1.
Translate to a system of equations and then solve.
When Jenna spent 10 minutes on the elliptical trainer and then did circuit training for 20 minutes, her fitness app says she burned 278 calories. When she spent 20 minutes on the elliptical trainer and 30 minutes circuit training, she burned 473 calories. How many calories does she burn for each minute on the elliptical trainer? How many calories for each minute of circuit training?

Check Your Understanding

Decide whether it would be more convenient to solve the system of equations by substitution or elimination.
67.
{ 8 x 15 y = 32 6 x + 3 y = 5
68.
{ x = 4 y 3 4 x 2 y = 6
69.
{ y = 7 x 5 3 x 2 y = 16
70.
{ 12 x 5 y = 42 3 x + 7 y = 15
71.
{ y = 4 x + 9 5 x 2 y = 21
72.
{ 9 x 4 y = 24 3 x + 5 y = 14
73.
{ 14 x 15 y = 30 7 x + 2 y = 10
74.
{ x = 9 y 11 2 x 7 y = 27

Section 5.9 Exercises

For the following exercises, determine if the points are solutions to the given system of equations.
1 .
{ 2 x 6 y = 0 3 x 4 y = 5 A:  ( 3 , 1 ) B:  ( 3 , 4 )
2 .
{ 3 x + y = 8 x + 2 y = 9 A:  ( 5 , 7 ) B:  ( 5 , 7 )
3 .
{ x + y = 2 y = 3 4 x A:  ( 8 7 , 6 7 ) B:  ( 1 , 3 4 )
4 .
{ 2 x + 3 y = 6 y = 2 3 x + 2 A:  ( 6 , 2 ) B:  ( 3 , 4 )
For the following exercises, solve the following systems of equations by graphing.
5 .
{ x + y = 2 2 x + y = 4
6 .
{ y = x 2 y = 3 x + 2
7 .
{ y = 2 3 x 2 y = 1 3 x 5
8 .
{ x + 3 y = 3 x + 3 y = 3
9 .
{ 2 x y = 4 2 x + 3 y = 12
10 .
{ x + 2 y = 6 y = 1 2 x 1
11 .
{ 3 x + 5 y = 10 y = 3 5 x + 1
12 .
{ 4 x = 3 y + 7 8 x 6 y = 14
For the following exercises, solve the systems of equations by substitution.
13 .
{ 2 x + y = 4 3 x 2 y = 6
14 .
{ 2 x + y = 2 3 x y = 7
15 .
{ x 2 y = 5 2 x 3 y = 4
16 .
{ x 3 y = 9 2 x + 5 y = 4
17 .
{ 2 x + 2 y = 6 y = 3 x + 1
18 .
{ 3 x + 4 y = 1 y = 2 5 x + 2
19 .
{ x = 2 y 4 x 8 y = 0
20 .
{ y = 7 8 x + 4 7 x + 8 y = 6
For the following exercises, solve the systems of equations by elimination.
21 .
{ 5 x + 2 y = 2 3 x y = 0
22 .
{ 6 x 5 y = 1 2 x + y = 13
23 .
{ 2 x 5 y = 7 3 x y = 17
24 .
{ 5 x 3 y = 1 2 x y = 2
25 .
{ 3 x 5 y = 9 5 x + 2 y = 16
26 .
{ 1 3 x y = 3 x + 5 2 y = 2
27 .
{ 6 x + 3 y = 9 2 x + y = 3
28 .
{ 2 3 x + y = 5 2 x + 3 y = 11
For the following exercises, solve the system of equations by graphing, substitution, or elimination.
29 .
{ 3 x + y = 3 2 x + 3 y = 5
30 .
{ y = x + 2 y = 2 x + 2
31 .
{ y = 3 2 x + 1 y = 1 2 x + 5
32 .
{ x + y = 4 x + 2 y = 2
33 .
{ 2 x + 3 y = 3 x + 3 y = 12
34 .
{ x + 3 y = 6 y = 4 3 x + 4
35 .
{ 4 x 3 y = 8 8 x 6 y = 14
36 .
{ x = 3 y + 4 2 x + 6 y = 8
For the following exercises, translate to a system of equations and solve.
37 .
Jackie has been offered positions by two cable companies. The first company pays a salary of $14,000 plus a commission of $100 for each cable package sold. The second pays a salary of $20,000 plus a commission of $25 for each cable package sold. How many cable packages would need to be sold to make the total pay the same?
38 .
Drew burned 1,800 calories Friday playing 1 hour of basketball and canoeing for 2 hours. Saturday she spent 2 hours playing basketball and 3 hours canoeing and burned 3,200 calories. How many calories did she burn per hour when playing basketball? How many calories did she burn per hour when canoeing?
39 .
Mitchell currently sells stoves for company A at a salary of $12,000 plus a $150 commission for each stove he sells. Company B offers him a position with a salary of $24,000 plus a $50 commission for each stove he sells. How many stoves would Mitchell need to sell for the options to equal?
40 .
The total number of calories in 2 hot dogs and 3 cups of cottage cheese is 960 calories. The total number of calories in 5 hot dogs and 2 cups of cottage cheese is 1,190 calories. How many calories are in a hot dog? How many calories are in a cup of cottage cheese?
41 .
Andrea and Bart go to the local farmers market to purchase some fruit. Andrea buys 4 apples and 5 oranges, which cost $3.10; Bart buys 4 apples and 6 oranges, which cost $3.40. What is the cost of an orange? What is the cost of an apple?
42 .
Jack and Jill go to a local farmers market to purchase some fruit. Jack buys 3 peaches and 2 limes, which cost $1.50; Jill buys 6 peaches and 5 limes, which cost $3.45. What is the cost of a peach? What is the cost of a lime?
Order a print copy

As an Amazon Associate we earn from qualifying purchases.

Citation/Attribution

This book may not be used in the training of large language models or otherwise be ingested into large language models or generative AI offerings without OpenStax's permission.

Want to cite, share, or modify this book? This book uses the Creative Commons Attribution License and you must attribute OpenStax.

Attribution information
  • If you are redistributing all or part of this book in a print format, then you must include on every physical page the following attribution:
    Access for free at https://openstax.org/books/contemporary-mathematics/pages/1-introduction
  • If you are redistributing all or part of this book in a digital format, then you must include on every digital page view the following attribution:
    Access for free at https://openstax.org/books/contemporary-mathematics/pages/1-introduction
Citation information

© Dec 21, 2023 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution License . The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.