Skip to content
Graphing Linear Equations

Graphing Linear Equations

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

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

Recognize the relation between the solutions of an equation and its graph

In Use the Rectangular Coordinate System, we found a few solutions to the equation 3x+2y=63x + 2y = 6. They are listed in the table below. So the ordered pairs (0,3)(0, 3), (2,0)(2, 0), (1,32)\left(1, \tfrac{3}{2}\right), and (4,3)(4, -3) are some solutions to the equation 3x+2y=63x + 2y = 6. We can plot these solutions in the rectangular coordinate system, as shown below.

xxyy(x,y)(x, y)
0033(0,3)(0, 3)
2200(2,0)(2, 0)
1132\tfrac{3}{2}(1,32)\left(1, \tfrac{3}{2}\right)
443-3(4,3)(4, -3)

Notice how the points line up perfectly? We connect the points with a straight line to get the graph of the equation 3x+2y=63x + 2y = 6.

xy(−2, 6)(0, 3)(1, 1.5)(2, 0)

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 (2,6)(-2, 6) is on the line. If you substitute x=2x = -2 and y=6y = 6 into the equation, you find that it is a solution to the equation:

3x+2y=63(2)+2(6)=?66+12=?66=6  \begin{aligned} 3x + 2y &= 6 \\ 3(-2) + 2(6) &\stackrel{?}{=} 6 \\ -6 + 12 &\stackrel{?}{=} 6 \\ 6 &= 6 \ \checkmark \end{aligned}

So (2,6)(-2, 6) is a solution to the equation. What about (4,1)(4, 1)?

3x+2y=634+21=?612+2=?6146 \begin{aligned} 3x + 2y &= 6 \\ 3 \cdot 4 + 2 \cdot 1 &\stackrel{?}{=} 6 \\ 12 + 2 &\stackrel{?}{=} 6 \\ 14 &\neq 6 \end{aligned}

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.

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 straight line.

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

Example. The graph of y=2x3y = 2x - 3 is shown below. For each ordered pair, decide (a) is the ordered pair a solution to the equation? (b) is the point on the line? (0,3)(0, -3), (3,3)(3, 3), (2,3)(2, -3), (1,5)(-1, -5).

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

Substitute the xx- and yy-values into the equation to check if each ordered pair is a solution.

(0,3):y=2x33=?2(0)33=3 (3,3):y=2x33=?2(3)33=3 (2,3):y=2x33=?2(2)331(1,5):y=2x35=?2(1)35=5  \begin{aligned} (0, -3)&: & y &= 2x - 3 & -3 &\stackrel{?}{=} 2(0) - 3 & -3 &= -3\ \checkmark \\ (3, 3)&: & y &= 2x - 3 & 3 &\stackrel{?}{=} 2(3) - 3 & 3 &= 3\ \checkmark \\ (2, -3)&: & y &= 2x - 3 & -3 &\stackrel{?}{=} 2(2) - 3 & -3 &\neq 1 \\ (-1, -5)&: & y &= 2x - 3 & -5 &\stackrel{?}{=} 2(-1) - 3 & -5 &= -5\ \checkmark \end{aligned}

So (0,3)(0, -3), (3,3)(3, 3), and (1,5)(-1, -5) are solutions to y=2x3y = 2x - 3, but (2,3)(2, -3) is not a solution. Plotting the points confirms it: (0,3)(0, -3), (3,3)(3, 3), and (1,5)(-1, -5) are on the line, and (2,3)(2, -3) is not on the line.

The graph ofy=3x1y = 3x - 1passes through(0,1)(0, -1),(2,5)(2, 5), and(1,2)(1, 2). Is the ordered pair(2,2)(2, 2)a solution to the equation? Enter theyy-value thaty=3x1y = 3x - 1actually gives whenx=2x = 2.

Using the same equationy=3x1y = 3x - 1, what is theyy-value whenx=1x = -1? (Check whether the point(1,4)(-1, -4)is a solution.)

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 above is called plotting points, or the Point-Plotting Method.

Let’s graph the equation y=2x+1y = 2x + 1 by plotting points. We start by finding three points that are solutions to the equation. We can choose any value for xx or yy, and then solve for the other variable. Since yy is isolated on the left side of the equation, it is easier to choose values for xx. We will use 00, 11, and 2-2 for xx in this example. We substitute each value of xx into the equation and solve for yy.

x=2:y=2(2)+1=3(2,3)x=0:y=2(0)+1=1(0,1)x=1:y=2(1)+1=3(1,3) \begin{aligned} x = -2&: & y &= 2(-2) + 1 = -3 & (-2, -3) \\ x = 0&: & y &= 2(0) + 1 = 1 & (0, 1) \\ x = 1&: & y &= 2(1) + 1 = 3 & (1, 3) \end{aligned}

We can organize the solutions in a table.

xxyy(x,y)(x, y)
0011(0,1)(0, 1)
1133(1,3)(1, 3)
2-23-3(2,3)(-2, -3)

Now we plot the points on a rectangular coordinate system. Check that the points line up — if they did not, it would mean we made a mistake and should double-check our work. Draw the line through the three points, extending it to fill the grid with arrows on both ends. The line is the graph of y=2x+1y = 2x + 1.

xy(−2, −3)(0, 1)(1, 3)

Graph a linear equation by plotting points.

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

It only takes two points to determine a line, but it is a good habit to use three points. If you plot only two points and one of them is incorrect, you can still draw a line, but 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.

Example. Graph the equation y=3xy = -3x.

Find three points that are solutions to the equation. It’s easier to choose values for xx and solve for yy.

x=0:y=3(0)=0(0,0)x=1:y=3(1)=3(1,3)x=2:y=3(2)=6(2,6) \begin{aligned} x = 0&: & y = -3(0) = 0 & \quad (0, 0) \\ x = 1&: & y = -3(1) = -3 & \quad (1, -3) \\ x = -2&: & y = -3(-2) = 6 & \quad (-2, 6) \end{aligned}
xxyy(x,y)(x, y)
0000(0,0)(0, 0)
113-3(1,3)(1, -3)
2-266(2,6)(-2, 6)

Plot the points, check that they line up, and draw the line.

xy(−2, 6)(0, 0)(1, −3)

Graph the liney=4xy = -4xby placing three points on it.

Graph the liney=xy = xby placing three points on it.

When an equation includes a fraction as the coefficient of xx, we can substitute any numbers for xx. But the math is easier if we make “good” choices for the values of xx — multiples of the denominator — so we avoid fraction answers, which are hard to graph precisely.

Example. Graph the equation y=12x+3y = \tfrac{1}{2}x + 3.

Since this equation has the fraction 12\tfrac{1}{2} as a coefficient of xx, we choose values of xx carefully. We use zero as one choice and multiples of 22 for the other choices.

x=0:y=12(0)+3=3(0,3)x=2:y=12(2)+3=4(2,4)x=4:y=12(4)+3=5(4,5) \begin{aligned} x = 0&: & y = \tfrac{1}{2}(0) + 3 = 3 & \quad (0, 3) \\ x = 2&: & y = \tfrac{1}{2}(2) + 3 = 4 & \quad (2, 4) \\ x = 4&: & y = \tfrac{1}{2}(4) + 3 = 5 & \quad (4, 5) \end{aligned}
xxyy(x,y)(x, y)
0033(0,3)(0, 3)
2244(2,4)(2, 4)
4455(4,5)(4, 5)

Plot the points, check that they line up, and draw the line.

The graph of y=13x1y = \tfrac{1}{3}x - 1 is shown below. Use it to answer the question that follows.

xy(0, −1)(3, 0)

Reading the graph ofy=13x1y = \tfrac{1}{3}x - 1above, what is theyy-value where the line crosses theyy-axis (that is, whenx=0x = 0)?

Graphy=14x+2y = \tfrac{1}{4}x + 2by placing three points on it.

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.

Example. Graph the equation x+y=5x + y = 5.

Find three points that are solutions to the equation. Remember, you can start with any value of xx or yy.

x=0:0+y=5, y=5(0,5)x=1:1+y=5, y=4(1,4)x=4:4+y=5, y=1(4,1) \begin{aligned} x = 0&: & 0 + y = 5, \ y = 5 & \quad (0, 5) \\ x = 1&: & 1 + y = 5, \ y = 4 & \quad (1, 4) \\ x = 4&: & 4 + y = 5, \ y = 1 & \quad (4, 1) \end{aligned}
xxyy(x,y)(x, y)
0055(0,5)(0, 5)
1144(1,4)(1, 4)
4411(4,1)(4, 1)

Then plot the points, check that they line up, and draw the line.

Graphx+y=2x + y = -2by placing three points on it.

Graphxy=6x - y = 6by placing three points on it.

In the previous example, the three points we found were easy to graph. But this is not always the case. Let’s see what happens with the equation 2x+y=32x + y = 3. If yy is 00, what is the value of xx?

2x+y=32x+0=32x=3x=32 \begin{aligned} 2x + y &= 3 \\ 2x + 0 &= 3 \\ 2x &= 3 \\ x &= \tfrac{3}{2} \end{aligned}

The solution is the point (32,0)\left(\tfrac{3}{2}, 0\right). This point has a fraction for the xx-coordinate. While we could graph this point, it is hard to be precise graphing fractions. Remember, in the earlier example 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 = 3 \qquad\Longrightarrow\qquad y = -2x + 3

Now we can choose values for xx that will give coordinates that are integers. The solutions for x=0x = 0, x=1x = 1, and x=1x = -1 are shown below.

xxyy(x,y)(x, y)
0033(0,3)(0, 3)
1111(1,1)(1, 1)
1-155(1,5)(-1, 5)

Example. Graph the equation 3x+y=13x + y = -1.

Find three points that are solutions to the equation. First, solve the equation for yy:

3x+y=1y=3x13x + y = -1 \qquad\Longrightarrow\qquad y = -3x - 1

We let xx be 00, 11, and 1-1 to find three points. The ordered pairs are shown in the table. Plot the points, check that they line up, and draw the line.

xxyy(x,y)(x, y)
001-1(0,1)(0, -1)
114-4(1,4)(1, -4)
1-122(1,2)(-1, 2)

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 of a book? If the points where the graphs cross the xx- and yy-axes are the same, the graphs match.

Solving2x+y=22x + y = 2foryygivesy=2x+2y = -2x + 2. Which graph shows this equation?

Graph4x+y=34x + y = -3by placing three points on it.

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 would we make a table of values to get the points to plot?

Let’s consider the equation x=3x = -3. This 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.

To make a table of solutions, we write 3-3 for all the xx-values. Then we choose any values for yy. Since xx does not depend on yy, we can choose any numbers we like — to fit the size of our coordinate graph, we’ll use 11, 22, and 33 for the yy-coordinates.

xxyy(x,y)(x, y)
3-311(3,1)(-3, 1)
3-322(3,2)(-3, 2)
3-333(3,3)(-3, 3)

Then we plot the points and connect them with a straight line. The graph is a vertical line.

xy(−3, 1)(−3, 2)(−3, 3)x = −3
Vertical line. A vertical line is the graph of an equation that can be written in the form x=ax = a. The line passes through the xx-axis at (a,0)(a, 0).

Example. Graph the equation x=2x = 2. What type of line does it form?

The equation has only one variable, xx, and xx is always equal to 22. We make a table where xx is always 22 and we put in any values for yy.

xxyy(x,y)(x, y)
2211(2,1)(2, 1)
2222(2,2)(2, 2)
2233(2,3)(2, 3)

Plot the points and connect them. The graph is a vertical line passing through the xx-axis at 22.

Graph the equationx=5x = 5by placing three points on the line.

Graphx=2x = -2by placing three points on the line.

What if the equation has yy but no xx? Let’s graph the equation y=4y = 4. This time the yy-value is a constant, so in this equation yy does not depend on xx.

To make a table of solutions, we write 44 for all the yy-values and then choose any values for xx. We’ll use 00, 22, and 44 for the xx-values.

xxyy(x,y)(x, y)
0044(0,4)(0, 4)
2244(2,4)(2, 4)
4444(4,4)(4, 4)

Plot the points and connect them. This graph is a horizontal line passing through the yy-axis at 44.

xy(0, 4)(2, 4)(4, 4)y = 4
Horizontal line. A horizontal line is the graph of an equation that can be written in the form y=by = b. The line passes through the yy-axis at (0,b)(0, b).

Example. Graph the equation y=1y = -1.

The equation has only one variable, yy. The value of yy is constant. All the ordered pairs in the table have the same yy-coordinate, 1-1. We choose 00, 33, and 3-3 as values for xx.

xxyy(x,y)(x, y)
3-31-1(3,1)(-3, -1)
001-1(0,1)(0, -1)
331-1(3,1)(3, -1)

The graph is a horizontal line passing through the yy-axis at 1-1.

Graph the liney=4y = -4by placing three points on it.

Graphy=3y = 3by placing three points on it.

The equations for vertical and horizontal lines look very similar to equations like y=4xy = 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 yy-coordinate changes according to the value of xx.

The equation y=4y = 4 has only one variable. The value of yy is constant. The yy-coordinate is always 44. It does not depend on the value of xx.

xxyy(x,y)(x, y)
0000(0,0)(0, 0)
1144(1,4)(1, 4)
2288(2,8)(2, 8)
xxyy(x,y)(x, y)
0044(0,4)(0, 4)
1144(1,4)(1, 4)
2244(2,4)(2, 4)

Notice that the equation y=4xy = 4x gives a slanted line, whereas y=4y = 4 gives a horizontal line.

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

Find three solutions for each equation. Notice that the first equation has the variable xx, while the second does not.

xxy=3xy = -3x(x,y)(x, y)
0000(0,0)(0, 0)
113-3(1,3)(1, -3)
226-6(2,6)(2, -6)
xxy=3y = -3(x,y)(x, y)
003-3(0,3)(0, -3)
113-3(1,3)(1, -3)
223-3(2,3)(2, -3)

The graph shows both equations: the slanted line y=3xy = -3x and the horizontal line y=3y = -3.

Graphy=4xy = -4xandy=4y = -4in the same coordinate system. Place two points on each line.

Graphy=3y = 3andy=3xy = 3xin the same coordinate system. Place two points on each line.

Key terms

graph of a linear equation — the straight line consisting of all the points that are solutions of the equation Ax+By=CAx + By = C; every point on the line is a solution, and every solution is a point on the line. plotting points (Point-Plotting Method) — a method of graphing a linear equation by finding three solutions, organizing them in a table, plotting them, and drawing the line through them. vertical line — the graph of an equation of the form x=ax = a; it passes through the xx-axis at (a,0)(a, 0). horizontal line — the graph of an equation of the form y=by = b; it passes through the yy-axis at (0,b)(0, b).

Practice

Recognize the relation between the solutions of an equation and its graph

The graph of y=x+2y = x + 2 is shown below. For each ordered pair, decide whether it is a solution to the equation and whether the point is on the line.

xy−8−6−4−22468−8−6−4−22468

Fory=x+2y = x + 2, is the ordered pair(0,2)(0, 2)a solution to the equation, and is the point on the line?

Fory=x+2y = x + 2, is the ordered pair(1,2)(1, 2)a solution to the equation, and is the point on the line?

Fory=x+2y = x + 2, is the ordered pair(1,1)(-1, 1)a solution to the equation, and is the point on the line?

Fory=x+2y = x + 2, is the ordered pair(3,1)(-3, 1)a solution to the equation, and is the point on the line?

The graph of y=12x3y = \tfrac{1}{2}x - 3 is shown below. Again decide, for each ordered pair, whether it is a solution and whether the point is on the line.

xy−8−6−4−22468−8−6−4−22468

Fory=12x3y = \tfrac{1}{2}x - 3, is the ordered pair(0,3)(0, -3)a solution to the equation, and is the point on the line?

Fory=12x3y = \tfrac{1}{2}x - 3, is the ordered pair(2,2)(2, -2)a solution to the equation, and is the point on the line?

Fory=12x3y = \tfrac{1}{2}x - 3, is the ordered pair(2,4)(-2, -4)a solution to the equation, and is the point on the line?

Fory=12x3y = \tfrac{1}{2}x - 3, is the ordered pair(4,1)(4, 1)a solution to the equation, and is the point on the line?

Graph a linear equation by plotting points

Graphy=3x1y = 3x - 1by placing three points on the line.

Graphy=12x+2y = \tfrac{1}{2}x + 2by placing three points on the line.

Graphxy=2x - y = 2by placing three points on the line.

Graphx+y=6x + y = 6by placing three points on the line.

Graph vertical and horizontal lines

Graphx=4x = 4by placing three points on the line.

Graphy=5y = -5by placing three points on the line.

Graphy=2xy = 2xandy=2y = 2in the same rectangular coordinate system. Place two points on each line.


This section is adapted from Prealgebra 2e, Section 11.2: Graphing Linear Equations by Lynn Marecek, MaryAnne Anthony-Smith, and Andrea Honeycutt Mathis, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recreated the coordinate-grid line graphs as accessible inline graphics; omitted the Be Prepared quiz and Media links; adapted selected end-of-section exercises into the interactive Practice block, restating the multipart “is the ordered pair a solution / is the point on the line” items as one graded question per ordered pair; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback, adapting the “graph the following” Try Its into a mix of graph-production exercises, “which graph” recognition questions, and gradable questions about specific coordinate values.