Skip to ContentGo to accessibility pageKeyboard shortcuts menu
OpenStax Logo
Elementary Algebra 2e

4.2 Graph Linear Equations in Two Variables

Elementary Algebra 2e4.2 Graph Linear Equations in Two Variables

Learning Objectives

By the end of this section, you will be able to:

  • Recognize the relationship between the solutions of an equation and its graph
  • Graph a linear equation by plotting points
  • Graph vertical and horizontal lines

Be Prepared 4.4

Before you get started, take this readiness quiz.

Evaluate 3x+23x+2 when x=−1x=−1.
If you missed this problem, review Example 1.57.

Be Prepared 4.5

Solve 3x+2y=123x+2y=12 for yy in general.
If you missed this problem, review Example 2.63.

Recognize the Relationship Between the Solutions of an Equation and its Graph

In the previous section, we found several solutions to the equation 3x+2y=63x+2y=6. They are listed in Table 4.10. So, the ordered pairs (0,3)(0,3), (2,0)(2,0), and (1,32)(1,32) are some solutions to the equation 3x+2y=63x+2y=6. We can plot these solutions in the rectangular coordinate system as shown in Figure 4.5.

3x+2y=63x+2y=6
xx yy (x,y)(x,y)
0 3 (0,3)(0,3)
2 0 (2,0)(2,0)
1 3232 (1,32)(1,32)
Table 4.10
The figure shows four points on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. Dots mark off the four points at (0, 3), (1, three halves), (2, 0), and (4, negative 3). The four points appear to line up along a straight line.
Figure 4.5

Notice how the points line up perfectly? We connect the points with a line to get the graph of the equation 3x+2y=63x+2y=6. See Figure 4.6. Notice the arrows on the ends of each side of the line. These arrows indicate the line continues.

The figure shows a straight line drawn through four points on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. Dots mark off the four points at (0, 3), (1, three halves), (2, 0), and (4, negative 3). A straight line with a negative slope goes through all four points. The line has arrows on both ends pointing to the edge of the figure. The line is labeled with the equation 3x plus 2y equals 6.
Figure 4.6

Every point on the line is a solution of the equation. Also, every solution of this equation is a point on this line. Points not on the line are not solutions.

Notice that the point whose coordinates are (−2,6)(−2,6) is on the line shown in Figure 4.7. If you substitute x=−2x=−2 and y=6y=6 into the equation, you find that it is a solution to the equation.

The figure shows a straight line and two points and on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. Dots mark off the two points and are labeled by the coordinates “(negative 2, 6)” and “(4, 1)”. The straight line goes through the point (negative 2, 6) but does not go through the point (4, 1).
Figure 4.7
The figure shows a series of equations to check if the ordered pair (negative 2, 6) is a solution to the equation 3x plus 2y equals 6. The first line states “Test (negative 2, 6)”. The negative 2 is colored blue and the 6 is colored red. The second line states the two- variable equation 3x plus 2y equals 6. The third line shows the ordered pair substituted into the two- variable equation resulting in 3(negative 2) plus 2(6) equals 6 where the negative 2 is colored blue to show it is the first component in the ordered pair and the 6 is red to show it is the second component in the ordered pair. The fourth line is the simplified equation negative 6 plus 12 equals 6. The fifth line is the further simplified equation 6equals6. A check mark is written next to the last equation to indicate it is a true statement and show that (negative 2, 6) is a solution to the equation 3x plus 2y equals 6.

So the point (−2,6)(−2,6) is a solution to the equation 3x+2y=63x+2y=6. (The phrase “the point whose coordinates are (−2,6)(−2,6)” is often shortened to “the point (−2,6)(−2,6).”)

The figure shows a series of equations to check if the ordered pair (4, 1) is a solution to the equation 3x plus 2y equals 6. The first line states “What about (4, 1)?”. The 4 is colored blue and the 1 is colored red. The second line states the two- variable equation 3x plus 2y equals 6. The third line shows the ordered pair substituted into the two- variable equation resulting in 3(4) plus 2(1) equals 6 where the 4 is colored blue to show it is the first component in the ordered pair and the 1 is red to show it is the second component in the ordered pair. The fourth line is the simplified equation 12 plus 2 equals 6. A question mark is placed above the equals sign to indicate that it is not known if the equation is true or false. The fifth line is the further simplified statement 14 not equal to 6. A “not equals” sign is written between the two numbers and looks like an equals sign with a forward slash through it.

So (4,1)(4,1) is not a solution to the equation 3x+2y=63x+2y=6. Therefore, the point (4,1)(4,1) is not on the line. See Figure 4.6. This is an example of the saying, “A picture is worth a thousand words.” The line shows you all the solutions to the equation. Every point on the line is a solution of the equation. And, every solution of this equation is on this line. This line is called the graph of the equation 3x+2y=63x+2y=6.

Graph of a Linear Equation

The graph of a linear equation Ax+By=CAx+By=C is a line.

  • Every point on the line is a solution of the equation.
  • Every solution of this equation is a point on this line.

Example 4.10

The graph of y=2x3y=2x3 is shown.

The figure shows a straight line on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line has a positive slope and goes through the y-axis at the (0, negative 3). The line is labeled with the equation y equals 2x negative 3.

For each ordered pair, decide:

Is the ordered pair a solution to the equation?
Is the point on the line?

A (0,−3)(0,−3) B (3,3)(3,3) C (2,−3)(2,−3) D (−1,−5)(−1,−5)

Try It 4.19

Use the graph of y=3x1y=3x1 to decide whether each ordered pair is:

  • a solution to the equation.
  • on the line.

(0,−1)(0,−1) (2,5)(2,5)

The figure shows a straight line on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line goes through the point (negative 2, negative 7) and for every 3 units it goes up, it goes one unit to the right. The line is labeled with the equation y equals 3x minus 1.

Try It 4.20

Use graph of y=3x1y=3x1 to decide whether each ordered pair is:

  • a solution to the equation
  • on the line

(3,−1)(3,−1) (−1,−4)(−1,−4)

The figure shows a straight line on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line goes through the point (negative 2, negative 7) and for every 3 units it goes up, it goes one unit to the right. The line is labeled with the equation y equals 3x minus 1.

Graph a Linear Equation by Plotting Points

There are several methods that can be used to graph a linear equation. The method we used to graph 3x+2y=63x+2y=6 is called plotting points, or the Point–Plotting Method.

Example 4.11

How To Graph an Equation By Plotting Points

Graph the equation y=2x+1y=2x+1 by plotting points.

Try It 4.21

Graph the equation by plotting points: y=2x3y=2x3.

Try It 4.22

Graph the equation by plotting points: y=−2x+4y=−2x+4.

The steps to take when graphing a linear equation by plotting points are summarized below.

How To

Graph a linear equation by plotting points.

  1. Step 1. Find three points whose coordinates are solutions to the equation. Organize them in a table.
  2. Step 2. Plot the points in a rectangular coordinate system. Check that the points line up. If they do not, carefully check your work.
  3. Step 3. Draw the line through the three points. Extend the line to fill the grid and put arrows on both ends of the line.

It is true that it only takes two points to determine a line, but it is a good habit to use three points. If you only plot two points and one of them is incorrect, you can still draw a line but it will not represent the solutions to the equation. It will be the wrong line.

If you use three points, and one is incorrect, the points will not line up. This tells you something is wrong and you need to check your work. Look at the difference between part (a) and part (b) in Figure 4.8.

Figure a shows three points with a straight line going through them. Figure b shows three points that do not lie on the same line.
Figure 4.8

Let’s do another example. This time, we’ll show the last two steps all on one grid.

Example 4.12

Graph the equation y=−3xy=−3x.

Try It 4.23

Graph the equation by plotting points: y=−4xy=−4x.

Try It 4.24

Graph the equation by plotting points: y=xy=x.

When an equation includes a fraction as the coefficient of xx, we can still substitute any numbers for xx. But the math is easier if we make ‘good’ choices for the values of xx. This way we will avoid fraction answers, which are hard to graph precisely.

Example 4.13

Graph the equation y=12x+3y=12x+3.

Try It 4.25

Graph the equation y=13x1y=13x1.

Try It 4.26

Graph the equation y=14x+2y=14x+2.

So far, all the equations we graphed had yy given in terms of xx. Now we’ll graph an equation with xx and yy on the same side. Let’s see what happens in the equation 2x+y=32x+y=3. If y=0y=0 what is the value of xx?

The figure shows a set of equations used to determine an ordered pair from the equation 2x plus y equals 3. The first equation is y equals 0 (where the 0 is red). The second equation is the two- variable equation 2x plus y equals 3. The third equation is the onenegative variable equation 2x plus 0 equals 3 (where the 0 is red). The fourth equation is 2x equals 3. The fifth equation is x equals three halves. The last line is the ordered pair (three halves, 0).

This point has a fraction for the x- coordinate and, while we could graph this point, it is hard to be precise graphing fractions. Remember in the example y=12x+3y=12x+3, we carefully chose values for xx so as not to graph fractions at all. If we solve the equation 2x+y=32x+y=3 for yy, it will be easier to find three solutions to the equation.

2x+y=3y=−2x+32x+y=3y=−2x+3

The solutions for x=0x=0, x=1x=1, and x=−1x=−1 are shown in the Table 4.13. The graph is shown in Figure 4.9.

2x+y=32x+y=3
xx yy (x,y)(x,y)
0 3 (0,3)(0,3)
1 1 (1,1)(1,1)
−1−1 5 (−1,5)(−1,5)
Table 4.13
The figure shows a straight line drawn through three points on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. Dots mark off the three points which are labeled by their ordered pairs (negative 1, 5), (0, 3), and (1, 1). A straight line goes through all three points. The line has arrows on both ends pointing to the outside of the figure. The line is labeled with the equation 2x plus y equals 3.
Figure 4.9

Can you locate the point (32,0)(32,0), which we found by letting y=0y=0, on the line?

Example 4.14

Graph the equation 3x+y=−13x+y=−1.

Try It 4.27

Graph the equation 2x+y=22x+y=2.

Try It 4.28

Graph the equation 4x+y=−34x+y=−3.

If you can choose any three points to graph a line, how will you know if your graph matches the one shown in the answers in the book? If the points where the graphs cross the x- and y-axis are the same, the graphs match!

The equation in Example 4.14 was written in standard form, with both xx and yy on the same side. We solved that equation for yy in just one step. But for other equations in standard form it is not that easy to solve for yy, so we will leave them in standard form. We can still find a first point to plot by letting x=0x=0 and solving for yy. We can plot a second point by letting y=0y=0 and then solving for xx. Then we will plot a third point by using some other value for xx or yy.

Example 4.15

Graph the equation 2x3y=62x3y=6.

Try It 4.29

Graph the equation 4x+2y=84x+2y=8.

Try It 4.30

Graph the equation 2x4y=82x4y=8.

Graph Vertical and Horizontal Lines

Can we graph an equation with only one variable? Just xx and no yy, or just yy without an xx? How will we make a table of values to get the points to plot?

Let’s consider the equation x=−3x=−3. This equation has only one variable, xx. The equation says that xx is always equal to −3−3, so its value does not depend on yy. No matter what yy is, the value of xx is always −3−3.

So to make a table of values, write −3−3 in for all the xx values. Then choose any values for yy. Since xx does not depend on yy, you can choose any numbers you like. But to fit the points on our coordinate graph, we’ll use 1, 2, and 3 for the y-coordinates. See Table 4.18.

x=−3x=−3
xx yy (x,y)(x,y)
−3−3 1 (−3,1)(−3,1)
−3−3 2 (−3,2)(−3,2)
−3−3 3 (−3,3)(−3,3)
Table 4.18

Plot the points from Table 4.18 and connect them with a straight line. Notice in Figure 4.12 that we have graphed a vertical line.

The figure shows a vertical straight line drawn through three points on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. Dots mark off the three points which are labeled by their ordered pairs (negative 3, 1), (negative 3, 2), and (negative 3, 3). A vertical straight line goes through all three points. The line has arrows on both ends pointing to the outside of the figure. The line is labeled with the equation x equals negative 3.
Figure 4.12

Vertical Line

A vertical line is the graph of an equation of the form x=ax=a.

The line passes through the x-axis at (a,0)(a,0).

 

Example 4.16

Graph the equation x=2x=2.

Try It 4.31

Graph the equation x=5x=5.

Try It 4.32

Graph the equation x=−2x=−2.

What if the equation has yy but no xx? Let’s graph the equation y=4y=4. This time the y- value is a constant, so in this equation, yy does not depend on xx. Fill in 4 for all the yy’s in Table 4.20 and then choose any values for xx. We’ll use 0, 2, and 4 for the x-coordinates.

y=4y=4
xx yy (x,y)(x,y)
0 4 (0,4)(0,4)
2 4 (2,4)(2,4)
4 4 (4,4)(4,4)
Table 4.20

The graph is a horizontal line passing through the y-axis at 4. See Figure 4.14.

The figure shows a straight horizontal line drawn through three points on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. Dots mark off the three points which are labeled by their ordered pairs (0, 4), (2, 4), and (4, 4). A straight horizontal line goes through all three points. The line has arrows on both ends pointing to the outside of the figure. The line is labeled with the equation y equals 4.
Figure 4.14

Horizontal Line

A horizontal line is the graph of an equation of the form y=by=b.

The line passes through the y-axis at (0,b)(0,b).

 

Example 4.17

Graph the equation y=−1.y=−1.

Try It 4.33

Graph the equation y=−4y=−4.

Try It 4.34

Graph the equation y=3y=3.

The equations for vertical and horizontal lines look very similar to equations like y=4x.y=4x. What is the difference between the equations y=4xy=4x and y=4y=4?

The equation y=4xy=4x has both xx and yy. The value of yy depends on the value of xx. The y-coordinate changes according to the value of xx. The equation y=4y=4 has only one variable. The value of yy is constant. The y-coordinate is always 4. It does not depend on the value of xx. See Table 4.22.

y=4xy=4x y=4y=4
xx yy (x,y)(x,y) xx yy (x,y)(x,y)
0 0 (0,0)(0,0) 0 4 (0,4)(0,4)
1 4 (1,4)(1,4) 1 4 (1,4)(1,4)
2 8 (2,8)(2,8) 2 4 (2,4)(2,4)
Table 4.22
The figure shows a two straight lines drawn on the same x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. One line is a straight horizontal line labeled with the equation y equals 4. The other line is a slanted line labeled with the equation y equals 4x.
Figure 4.16

Notice, in Figure 4.16, the equation y=4xy=4x gives a slanted line, while y=4y=4 gives a horizontal line.

Example 4.18

Graph y=−3xy=−3x and y=−3y=−3 in the same rectangular coordinate system.

Try It 4.35

Graph y=−4xy=−4x and y=−4y=−4 in the same rectangular coordinate system.

Try It 4.36

Graph y=3y=3 and y=3xy=3x in the same rectangular coordinate system.

Section 4.2 Exercises

Practice Makes Perfect

Recognize the Relationship Between the Solutions of an Equation and its Graph

In the following exercises, for each ordered pair, decide:

Is the ordered pair a solution to the equation?  Is the point on the line?

55.

y = x + 2 y = x + 2

  1. (0,2)(0,2)
  2. (1,2)(1,2)
  3. (−1,1)(−1,1)
  4. (−3,−1)(−3,−1)
The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line goes through the points (negative 6, negative 4), (negative 5, negative 3), (negative 4, negative 2), (negative 3, negative 1), (negative 2, 0), (negative 1, 1), (0, 2), (1, 3), (2, 4), (3, 5), (4, 6), and (5, 7).
56.

y = x 4 y = x 4

  1. (0,−4)(0,−4)
  2. (3,−1)(3,−1)
  3. (2,2)(2,2)
  4. (1,−5)(1,−5)
The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line goes through the points (negative 3, negative 7), (negative 2, negative 6), (negative 1, negative 5), (0, negative 4), (1, negative 3), (2, negative 2), (3, negative 1), (4, 0), (5, 1), (6, 2), and (7, 3).
57.

y = 1 2 x 3 y = 1 2 x 3

  1. (0,−3)(0,−3)
  2. (2,−2)(2,−2)
  3. (−2,−4)(−2,−4)
  4. (4,1)(4,1)
The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line goes through the points (negative 6, negative 6), (negative 4, negative 5), (negative 2, negative 4), (0, negative 3), (2, negative 2), (4, negative 1), and (6, 0).
58.

y = 1 3 x + 2 y = 1 3 x + 2

  1. (0,2)(0,2)
  2. (3,3)(3,3)
  3. (−3,2)(−3,2)
  4. (−6,0)(−6,0)
The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 7 to 7. The y-axis of the plane runs from negative 7 to 7. The straight line goes through the points (negative 6, 0), (negative 3, 1), (0, 2), (3, 3), and (6, 4).

Graph a Linear Equation by Plotting Points

In the following exercises, graph by plotting points.

59.

y = 3 x 1 y = 3 x 1

60.

y = 2 x + 3 y = 2 x + 3

61.

y = −2 x + 2 y = −2 x + 2

62.

y = −3 x + 1 y = −3 x + 1

63.

y = x + 2 y = x + 2

64.

y = x 3 y = x 3

65.

y = x 3 y = x 3

66.

y = x 2 y = x 2

67.

y = 2 x y = 2 x

68.

y = 3 x y = 3 x

69.

y = −4 x y = −4 x

70.

y = −2 x y = −2 x

71.

y = 1 2 x + 2 y = 1 2 x + 2

72.

y = 1 3 x 1 y = 1 3 x 1

73.

y = 4 3 x 5 y = 4 3 x 5

74.

y = 3 2 x 3 y = 3 2 x 3

75.

y = 2 5 x + 1 y = 2 5 x + 1

76.

y = 4 5 x 1 y = 4 5 x 1

77.

y = 3 2 x + 2 y = 3 2 x + 2

78.

y = 5 3 x + 4 y = 5 3 x + 4

79.

x + y = 6 x + y = 6

80.

x + y = 4 x + y = 4

81.

x + y = −3 x + y = −3

82.

x + y = −2 x + y = −2

83.

x y = 2 x y = 2

84.

x y = 1 x y = 1

85.

x y = −1 x y = −1

86.

x y = −3 x y = −3

87.

3 x + y = 7 3 x + y = 7

88.

5 x + y = 6 5 x + y = 6

89.

2 x + y = −3 2 x + y = −3

90.

4 x + y = −5 4 x + y = −5

91.

1 3 x + y = 2 1 3 x + y = 2

92.

1 2 x + y = 3 1 2 x + y = 3

93.

2 5 x y = 4 2 5 x y = 4

94.

3 4 x y = 6 3 4 x y = 6

95.

2 x + 3 y = 12 2 x + 3 y = 12

96.

4 x + 2 y = 12 4 x + 2 y = 12

97.

3 x 4 y = 12 3 x 4 y = 12

98.

2 x 5 y = 10 2 x 5 y = 10

99.

x 6 y = 3 x 6 y = 3

100.

x 4 y = 2 x 4 y = 2

101.

5 x + 2 y = 4 5 x + 2 y = 4

102.

3 x + 5 y = 5 3 x + 5 y = 5

Graph Vertical and Horizontal Lines

In the following exercises, graph each equation.

103.

x = 4 x = 4

104.

x = 3 x = 3

105.

x = −2 x = −2

106.

x = −5 x = −5

107.

y = 3 y = 3

108.

y = 1 y = 1

109.

y = −5 y = −5

110.

y = −2 y = −2

111.

x = 7 3 x = 7 3

112.

x = 5 4 x = 5 4

113.

y = 15 4 y = 15 4

114.

y = 5 3 y = 5 3

In the following exercises, graph each pair of equations in the same rectangular coordinate system.

115.

y=2xy=2x and y=2y=2

116.

y=5xy=5x and y=5y=5

117.

y=12xy=12x and y=12y=12

118.

y=13xy=13x and y=13y=13

Mixed Practice

In the following exercises, graph each equation.

119.

y = 4 x y = 4 x

120.

y = 2 x y = 2 x

121.

y = 1 2 x + 3 y = 1 2 x + 3

122.

y = 1 4 x 2 y = 1 4 x 2

123.

y = x y = x

124.

y = x y = x

125.

x y = 3 x y = 3

126.

x + y = −5 x + y = −5

127.

4 x + y = 2 4 x + y = 2

128.

2 x + y = 6 2 x + y = 6

129.

y = −1 y = −1

130.

y = 5 y = 5

131.

2 x + 6 y = 12 2 x + 6 y = 12

132.

5 x + 2 y = 10 5 x + 2 y = 10

133.

x = 3 x = 3

134.

x = −4 x = −4

Everyday Math

135.

Motor home cost. The Robinsons rented a motor home for one week to go on vacation. It cost them $594 plus $0.32 per mile to rent the motor home, so the linear equation y=594+0.32xy=594+0.32x gives the cost, yy, for driving xx miles. Calculate the rental cost for driving 400, 800, and 1200 miles, and then graph the line.

136.

Weekly earnings. At the art gallery where he works, Salvador gets paid $200 per week plus 15% of the sales he makes, so the equation y=200+0.15xy=200+0.15x gives the amount, yy, he earns for selling xx dollars of artwork. Calculate the amount Salvador earns for selling $900, $1600, and $2000, and then graph the line.

Writing Exercises

137.

Explain how you would choose three x- values to make a table to graph the line y=15x2y=15x2.

138.

What is the difference between the equations of a vertical and a horizontal line?

Self Check

After completing the exercises, use this checklist to evaluate your mastery of the objectives of this section.

This table has 4 rows and 4 columns. The first row is a header row and it labels each column. The first column header is “I can…”, the second is “Confidently”, the third is “With some help”, and the fourth is “No, I don’t get it”. Under the first column are the phrases “…recognize the relation between the solutions of an equation and its graph.”, “…graph a linear equation by plotting points.”, and “…graph vertical and horizontal lines.”. The other columns are left blank so that the learner may indicate their mastery level for each topic.

After reviewing this checklist, what will you do to become confident for all goals?

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/elementary-algebra-2e/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/elementary-algebra-2e/pages/1-introduction
Citation information

© Jan 23, 2024 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.