Skip to main content
Mathematics LibreTexts

4.2: Graph Linear Equations in Two Variables

  • Page ID
    15144
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    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.
    Note

    Before you get started, take this readiness quiz.

    1. Evaluate \(3x+2\) when \(x=−1\).
      If you missed this problem, review Exercise 1.5.34.
    2. Solve \(3x+2y=12\) for y in general.
      If you missed this problem, review Exercise 2.6.16.

    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=6\). They are listed in Table \(\PageIndex{1}\). So, the ordered pairs (0,3), (2,0), and \((1,\frac{3}{2})\) are some solutions to the equation \(3x+2y=6\). We can plot these solutions in the rectangular coordinate system as shown in Figure \(\PageIndex{1}\).

    Table \(\PageIndex{1}\)
    3x+2y=6
    x y (x,y)
    0 3 (0,3)
    2 0 (2,0)
    1 \(\frac{3}{2}\) \((1, \frac{3}{2})\)
    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 \(\PageIndex{1}\)

    Notice how the points line up perfectly? We connect the points with a line to get the graph of the equation 3x+2y=6. See Figure \(\PageIndex{2}\). 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 \(\PageIndex{2}\)

    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) is on the line shown in Figure \(\PageIndex{3}\). If you substitute x=−2 and y=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 \(\PageIndex{3}\)

    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) is a solution to the equation \(3x+2y=6\). (The phrase “the point whose coordinates are (−2,6)” is often shortened to “the point (−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.
    Figure \(\PageIndex{3}\). 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=6\).
    GRAPH OF A LINEAR EQUATION
    The graph of a linear equation Ax+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 \(\PageIndex{1}\)

    The graph of y=2x−3 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:

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

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

    Solution

    Substitute the x- and y- values into the equation to check if the ordered pair is a solution to the equation.

    1.
    The figure shows a series of equations to check if the ordered pairs (0, negative 3), (3, 3), (2, negative 3), and (negative 1, negative 5) are a solutions to the equation y equals 2x negative 3. The first line states the ordered pairs with the labels A: (0, negative 3), B: (3, 3), C: (2, negative 3), and D: (negative 1, negative 5). The first components are colored blue and the second components are colored red. The second line states the two- variable equation y equals 2x minus 3. The third line shows the four ordered pairs substituted into the two- variable equation resulting in four equations. The first equation is negative 3 equals 2(0) minus 3 where the 0 is colored clue and the negative 3 on the left side of the equation is colored red. The second equation is 3 equals 2(3) minus 3 where the 3 in parentheses is colored clue and the 3 on the left side of the equation is colored red. The third equation is negative 3 equals 2(2) minus 3 where the 2 in parentheses is colored clue and the negative 3 on the left side of the equation is colored red. The fourth equation is negative 5 equals 2(negative 1) minus 3 where the negative 1 is colored clue and the negative 5 is colored red. Question marks are placed above all the equal signs to indicate that it is not known if the equations are true or false. The fourth line shows the simplified versions of the four equations. The first is negative 3 equals negative 3 with a check mark indicating (0, negative 3) is a solution. The second is 3 equals 3 with a check mark indicating (3, 3) is a solution. The third is negative 3 not equals 1 indicating (2, negative 3) is not a solution. The fourth is negative 5 equals negative 5 with a check mark indicating (negative 1, negative 5) is a solution.

    2. Plot the points A (0,−3), B (3,3), C (2,−3), and D (−1,−5).

    The figure shows a straight line and four 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 1, negative 5), (0, negative 3), (2, negative 3), and (3, 3). The straight line, labeled with the equation y equals 2x negative 3 goes through the three points (negative 1, negative 5), (0, negative 3), and (3, 3) but does not go through the point (2, negative 3).

    The points that are solutions to y=2x−3 are on the line, but the point that is not a solution is not on the line.

    The points (0,−3), (3,3), and (−1,−5) are on the line y=2x−3, and the point (2,−3) is not on the line.

    Try It \(\PageIndex{2}\)

    Use the graph of y=3x−1 to decide whether each ordered pair is:

    • a solution to the equation.
    • on the line.
    1. (0,−1) 
    2. (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.

    Answer
    1. yes, yes 
    2. yes, yes
    Try It \(\PageIndex{3}\)

    Use graph of y=3x−1 to decide whether each ordered pair is:

    • a solution to the equation
    • on the line
    1. (3,−1) 
    2. (−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.

    Answer
    1. no, no 
    2. yes, yes

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

    Example \(\PageIndex{4}\): How To Graph an Equation By Plotting Points

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

    Solution

    The figure shows the three step procedure for graphing a line from the equation using the example equation y equals 2x minus 1. The first step is to “Find three points whose coordinates are solutions to the equation. Organize the solutions in a table”. The remark is made that “You can choose any values for x or y. In this case, since y is isolated on the left side of the equation, it is easier to choose values for x”. The work for the first step of the example is shown through a series of equations aligned vertically. From the top down, the equations are y equals 2x plus 1, x equals 0 (where the 0 is blue), y equals 2x plus 1, y equals 2(0) plus 1 (where the 0 is blue), y equals 0 plus 1, y equals 1, x equals 1 (where the 1 is blue), y equals 2x plus 1, y equals 2(1) plus 1 (where the 1 is blue), y equals 2 plus 1, y equals 3, x equals negative 2 (where the negative 2 is blue), y equals 2x plus 1, y equals 2(negative 2) plus 1 (where the negative 2 is blue), y equals negative 4 plus 1, y equals negative 3. The work is then organized in a table. The table has 5 rows and 3 columns. The first row is a title row with the equation y equals 2x plus 1. The second row is a header row and it labels each column. The first column header is “x”, the second is “y” and the third is “(x, y)”. Under the first column are the numbers 0, 1, and negative 2. Under the second column are the numbers 1, 3, and negative 3. Under the third column are the ordered pairs (0, 1), (1, 3), and (negative 2, negative 3).The second step is to “Plot the points in a rectangular coordinate system. Check that the points line up. If they do not, carefully check your work!” For the example the points are (0, 1), (1, 3), and (negative 2, negative 3). A graph shows the 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 at (0, 1), (1, 3), and (negative 2, negative 3). The question “Do the points line up?” is stated and followed with the answer “Yes, the points line up.”The third step of the procedure is “Draw the line through the three points. Extend the line to fill the grid and put arrows on both ends of the line.” A graph 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 at (0, 1), (1, 3), and (negative 2, negative 3). A straight line goes through all three points. The line has arrows on both ends pointing to the edge of the figure. The line is labeled with the equation y equals 2x plus 1. The statement “This line is the graph of y equals 2x plus 1” is included next to the graph.

    Try It \(\PageIndex{5}\)

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

    Answer

    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 points (negative 2, negative 7), (negative 1, negative 5), (0, negative 3), (1, negative 1), (2, 1), (3, 3), (4, 5), and (5, 7). There are arrows at the ends of the line pointing to the outside of the figure.

    Try It \(\PageIndex{6}\)

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

    Answer

    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 points (negative 1, 6), (0, 4), (1, 2), (2, 0), (3, negative 2), (4, negative 4), and (5, negative 6). There are arrows at the ends of the line pointing to the outside of the figure.

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

    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 in a rectangular coordinate system. Check that the points line up. If they do not, carefully check your work.
    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 \(\PageIndex{4}\).

    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 \(\PageIndex{4}\)

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

    Example \(\PageIndex{7}\)

    Graph the equation y=−3x.

    Solution

    Find three points that are solutions to the equation. Here, again, it’s easier to choose values for x. Do you see why?

    The figure shows three sets of equations used to determine ordered pairs from the equation y equals negative 3x. The first set has the equations: x equals 0 (where the 0 is blue), y equals negative 3x, y equals negative 3(0) (where the 0 is blue), y equals 0. The second set has the equations: x equals 1 (where the 1 is blue), y equals negative 3x, y equals negative 3(1) (where the 1 is blue), y equals negative 3. The third set has the equations: x equals negative 2 (where the negative 2 is blue), y equals negative 3x, y equals negative 3(negative 2) (where the negative 2 is blue), y equals 6.

    We list the points in Table \(\PageIndex{2}\).

    Table \(\PageIndex{2}\)
    y=−3x
    x y (x,y)
    0 0 (0,0)
    1 −3 (1,−3)
    −2 6 (−2,6)

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

    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 2, 6), (0, 0), and (1, negative 3). 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 y equals negative 3x.

    Try It \(\PageIndex{8}\)

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

    Answer

    The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 2, 8), (0, 0), and (2, negative 8). The line has arrows on both ends pointing to the outside of the figure.

    Try It \(\PageIndex{9}\)

    Graph the equation by plotting points: y=x.

    Answer

    The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 8, negative 8), (negative 6, negative 6), (negative 4, negative 4), (negative 2, negative 2), (0, 0), (2, 2), (4, 4), (6, 6), and (8, 8). The line has arrows on both ends pointing to the outside of the figure.

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

    Example \(\PageIndex{10}\)

    Graph the equation \(y = \frac{1}{2}x + 3\).

    Solution

    Find three points that are solutions to the equation. Since this equation has the fraction \(\frac{1}{2}\) as a coefficient of x, we will choose values of x carefully. We will use zero as one choice and multiples of 2 for the other choices. Why are multiples of 2 a good choice for values of x?

    The figure shows three sets of equations used to determine ordered pairs from the equation y equals (one half)x plus 3. The first set has the equations: x equals 0 (where the 0 is blue), y equals (one half)x plus 3, y equals (one half)(0) plus 3 (where the 0 is blue), y equals 0 plus 3, y equals 3. The second set has the equations: x equals 2 (where the 2 is blue), y equals (one half)x plus 3, y equals (one half)(2) plus 3 (where the 2 is blue), y equals 1 plus 3, y equals 4. The third set has the equations: x equals 4 (where the 4 is blue), y equals (one half)x plus 3, y equals (one half)(4) plus 3 (where the 4 is blue), y equals 2 plus 3, y equals 5.

    The points are shown in Table \(\PageIndex{3}\).

    Table \(\PageIndex{3}\)
    y=12x+3
    x y (x,y)
    0 3 (0,3)
    2 4 (2,4)
    4 5 (4,5)

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

    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 (0, 3), (2, 4), and (4, 5). 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 y equals (one half)x plus 3.

    Try It \(\PageIndex{11}\)

    Graph the equation \(y = \frac{1}{3}x - 1\).

    Answer

    The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 9, negative 4), (negative 6, negative 3), (negative 3, negative 2), (0, negative 1), (3, 0), (6, 1), and (9, 2). The line has arrows on both ends pointing to the outside of the figure.

    Try It \(\PageIndex{12}\)

    Graph the equation \(y = \frac{1}{5}x + 2\).

    Answer

    The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 12, negative 1), (negative 8, 0), (negative 4, 1), (0, 2), (4, 3), (8, 4), and (12, 5). The line has arrows on both ends pointing to the outside of the figure.

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

    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+3, we carefully chose values for x so as not to graph fractions at all. If we solve the equation 2x+y=3 for y, it will be easier to find three solutions to the equation.

    \[\begin{aligned} 2 x+y &=3 \\ y &=-2 x+3 \end{aligned}\]

    The solutions for x=0, x=1, and x=−1 are shown in the Table \(\PageIndex{4}\). The graph is shown in Figure \(\PageIndex{5}\).

    Table \(\PageIndex{4}\)
    2x+y=3
    x y (x,y)
    0 3 (0,3)
    1 1 (1,1)
    −1 5 (−1,5)
    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 \(\PageIndex{5}\)

    Can you locate the point \((\frac{3}{2}, 0)\) which we found by letting y=0, on the line?

    Example \(\PageIndex{13}\)

    Graph the equation 3x+y=−1.

    Solution

    \(\begin{array}{lrll} { \text { Find three points that are solutions to the equation. } } & {3 x+y} &{=} &{-1} \\ {\text { First solve the equation for } y.} &{y} &{=} &{-3 x-1} \end{array}\)

    We’ll let x be 0, 1, and −1 to find 3 points. The ordered pairs are shown in Table \(\PageIndex{5}\). Plot the points, check that they line up, and draw the line. See Figure \(\PageIndex{6}\).

    Table \(\PageIndex{5}\)
    3x+y=−1
    x y (x,y)
    0 −1 (0,−1)
    1 −4 (1,−4)
    −1 2 (−1,2)
    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, 2), (0, negative 1), and (1, negative 4). 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 3x plus y equals negative 1.
    Figure \(\PageIndex{6}\)
    Try It \(\PageIndex{14}\)

    Graph the equation 2x+y=2.

    Answer

    The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 4, 10), (negative 2, 6), (0, 2), (2, negative 2), (4, negative 6), and (6, negative 10). The line has arrows on both ends pointing to the outside of the figure.

    Try It \(\PageIndex{15}\)

    Graph the equation 4x+y=−3.

    Answer

    The figure shows a straight line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 3, 9), (negative 2, 5), (negative 1, 1), (0, negative 3), (1, negative 7), and (2, negative 10). The line has arrows on both ends pointing to the outside of the figure.

    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 \(\PageIndex{13}\) was written in standard form, with both x and y on the same side. We solved that equation for y in just one step. But for other equations in standard form it is not that easy to solve for y, so we will leave them in standard form. We can still find a first point to plot by letting x=0 and solving for y. We can plot a second point by letting y=0 and then solving for x. Then we will plot a third point by using some other value for x or y.

    Example \(\PageIndex{16}\)

    Graph the equation \(2x−3y=6\).

    Solution

    \(\begin{array}{lrll} \text { Find three points that are solutions to the } & 2 x-3 y &= &6 \\ \text { equation. } & 2 x-3 y&=&6 \\ \text { First let } x=0 . & 2(0)-3 y&=&6 \\ \text { Solve for } y . &-3 y&=&6 \\ & y&=&-2 \\\\ \text { Now let } y=0 . & 2 x-3(0)&=&6 \\ \text { Solve for } x . & 2 x&=&6 \\ & x&=& 3 \\ \\ \text{ We need a third point. Remember, we can}&2(6)-3 y &=&6 \\ \text{ choose any value for x or y. We’ll let x = 6.}&12-3 y &=&6 \\ \text{ Solve for y. }&-3 y &=&-6 \\ &y &=&2\end{array}\)

    We list the ordered pairs in Table \(\PageIndex{6}\). Plot the points, check that they line up, and draw the line. See Figure \(\PageIndex{7}\).

    Table \(\PageIndex{6}\)
    2x−3y=6
    x yT (x,y)
    0 −2 (0,−2)
    3 0 (3,0)
    6 2 (6,2)
    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 (0, negative 2), (3, 0), and (6, 2). 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 minus 3y equals 6.
    Figure \(\PageIndex{7}\)
    Try It \(\PageIndex{17}\)

    Graph the equation \(4x+2y=8\).

    Answer

    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 1, 6), (0, 4), (1, 2), (2, 0), (3, negative 2), and (4, negative 4). The line has arrows on both ends pointing to the outside of the figure.

    Try It \(\PageIndex{18}\)

    Graph the equation \(2x−4y=8\).

    Answer

    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 5), (negative 4, negative 4), (negative 2, negative 3), (0, negative 2), (2, negative 1), (4, 0), and (6, 1). The line has arrows on both ends pointing to the outside of the figure.

    Graph Vertical and Horizontal Lines

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

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

    So to make a table of values, write −3 in for all the x values. Then choose any values for y. Since x does not depend on y, 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 \(\PageIndex{7}\)

    Table \(\PageIndex{7}\)
    x=−3
    x y (x,y)
    −3 1 (−3,1)
    −3 2 (−3,2)
    −3 3 (−3,3)

    Plot the points from Table \(\PageIndex{7}\) and connect them with a straight line. Notice in Figure \(\PageIndex{8}\) 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 \(\PageIndex{8}\)
    VERTICAL LINE

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

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

    Example \(\PageIndex{19}\)

    Graph the equation x=2.

    Solution

    The equation has only one variable, x, and x is always equal to 2. We create Table \(\PageIndex{8}\) where x is always 2 and then put in any values for y. The graph is a vertical line passing through the x-axis at 2. See Figure \(\PageIndex{9}\).

    Table \(\PageIndex{8}\)
    x=2
    x y (x,y)
    2 1 (2,1)
    2 2 (2,2)
    2 3 (2,3)
    The figure shows a straight vertical 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 (2, 1), (2, 2), and (2, 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 2.
    Figure \(\PageIndex{9}\)
    Try It \(\PageIndex{20}\)

    Graph the equation x=5.

    Answer

    The figure shows a straight vertical line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (5, 1), (5, 2), (5, 3), and all other points with first coordinate 5. The line has arrows on both ends pointing to the outside of the figure.

    Try It \(\PageIndex{21}\)

    Graph the equation x=−2.

    Answer

    The figure shows a straight vertical line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 2, 1), (negative 2, 2), (negative 2, 3), and all other points with first coordinate negative 2. The line has arrows on both ends pointing to the outside of the figure.

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

    Table \(\PageIndex{9}\)
    y=4
    x y (x,y)
    0 4 (0,4)
    2 4 (2,4)
    4 4 (4,4)

    The graph is a horizontal line passing through the y-axis at 4. See Figure \(\PageIndex{10}\).

    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 \(\PageIndex{10}\)
    HORIZONTAL LINE
    A horizontal line is the graph of an equation of the form y=b.

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

    Example \(\PageIndex{22}\)

    Graph the equation y=−1.

    Solution

    The equation y=−1 has only one variable, y. The value of y is constant. All the ordered pairs in Table \(\PageIndex{10} \) have the same y-coordinate. The graph is a horizontal line passing through the y-axis at −1, as shown in Figure \(\PageIndex{11}\).

    Table \(\PageIndex{10}\)
    y=−1
    x y (x,y)
      −1 (0,−1)
      −1 (3,−1)
    −3 −1 (−3,−1)

    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 (negative 3, negative 1), (0, negative 1), and (3, negative 1). 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 negative 1.

    Figure \(\PageIndex{11}\)

    Try It \(\PageIndex{23}\)

    Graph the equation y=−4.

    Answer

    The figure shows a straight horizontal line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 4, negative 4), (0, negative 4), (4, negative 4), and all other points with second coordinate negative 4. The line has arrows on both ends pointing to the outside of the figure.

    Try It \(\PageIndex{24}\)

    Graph the equation y=3.

    Answer

    The figure shows a straight horizontal line drawn on the x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. The straight line goes through the points (negative 4, 3), (0, 3), (4, 3), and all other points with second coordinate 3. The line has arrows on both ends pointing to the outside of the figure.

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

    The equation y=4x has both x and y. The value of y depends on the value of x. The y-coordinate changes according to the value of x. The equation y=4 has only one variable. The value of y is constant. The y-coordinate is always 4. It does not depend on the value of x. See Table \(\PageIndex{11}\).

    Table \(\PageIndex{11}\)
    y=4x   y=4
    x y (x,y) x y (x,y)
    0 0 (0,0) 0 4 (0,4)
    1 4 (1,4) 1 4 (1,4)
    2 8 (2,8) 2 4 (2,4)
    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 \(\PageIndex{12}\)

    Notice, in Figure \(\PageIndex{12}\), the equation y=4x gives a slanted line, while y=4 gives a horizontal line.

    Example \(\PageIndex{25}\)

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

    Solution

    Notice that the first equation has the variable x, while the second does not. See Table \(\PageIndex{12}\). The two graphs are shown in Figure \(\PageIndex{13}\).

    Table \(\PageIndex{12}\)
    y=−3x   y=−3
    x y (x,y) x y (x,y)
        (0,0)   −3 (0,−3)
      −3 (1,−3)   −3 (1,−3)
      −6 (2,−6)   −3 (2,−3)

    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 negative 3. The other line is a slanted line labeled with the equation y equals negative 3x.

    Figure \(\PageIndex{13}\)

    Try It \(\PageIndex{26}\)

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

    Answer

    The figure shows a two straight lines drawn on the same x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. One line is a straight horizontal line going through the points (negative 4, negative 4), (0, negative 4), (4, negative 4), and all other points with second coordinate negative 4. The other line is a slanted line going through the points (negative 2, 8), (negative 1, 4), (0, 0), (1, negative 4), and (2, negative 8).

    Try It \(\PageIndex{27}\)

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

    Answer

    The figure shows a two straight lines drawn on the same x y-coordinate plane. The x-axis of the plane runs from negative 12 to 12. The y-axis of the plane runs from negative 12 to 12. One line is a straight horizontal line going through the points (negative 4, 3) (0, 3), (4, 3), and all other points with second coordinate 3. The other line is a slanted line going through the points (negative 2, negative 6), (negative 1, negative 3), (0, 0), (1, 3), and (2, 6).

    Key Concepts

    • 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 in a rectangular coordinate system. Check that the points line up. If they do not, carefully check your work!
      3. Draw the line through the three points. Extend the line to fill the grid and put arrows on both ends of the line.

    Glossary

    graph of a linear equation
    The graph of a linear equation Ax+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.
    horizontal line
    A horizontal line is the graph of an equation of the form y=b. The line passes through the y-axis at (0,b).
    vertical line
    A vertical line is the graph of an equation of the form x=a. The line passes through the x-axis at (a,0).

    This page titled 4.2: Graph Linear Equations in Two Variables is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by OpenStax via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.