Skip to main content
Mathematics LibreTexts

1.2: Graphing Linear Equations

  • Page ID
    40105
  • \( \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

    In this section, you will learn to:

    • Graph a line when you know its equation.
    • Graph a line by finding its intercepts.
    • Graph and find equations of vertical and horizontal lines.
    • Find the slope of a line.
    • Graph the line if a point and the slope are given.

    Prerequisite Skills

    Before you get started, take this prerequisite quiz.

    1. On a piece of graph paper, plot and label these points: A(1, 4), B(-3, 2), C(2, -5), D(0, -3), E(4, 0).

    Click here to check your answer

    clipboard_e2d7f3de73d5a2c14d84d4ca2a561ca65.png

    If you missed any part of this problem, review here. (Note that this will open a different textbook in a new window.)

     

    2. Write the coordinates of each of the points shown in this graph.

    clipboard_ec2887bb088cc8b2266b62f2e45ea82ca.png

    Click here to check your answer

    A(0, 5)

    B(2, 4)

    C(-3, -1)

    D(-4, 0)

    E(3, -4)

    If you missed any part of this problem, review here. (Note that this will open a different textbook in a new window.)

     

    3. Simplify each expression without the use of a calculator.

    a. \(-4-(-7)\)

    b. \(-4+(-7)\)

    c. \(-4-7\)

    d. \(-4+7\)

    Click here to check your answer

    a. \(3\)

    b. \(-11\)

    c. \(-11\)

    d. \(3\)

    If you missed any part of this problem, review here. (Note that this will open a different textbook in a new window.)

    Graphing a Line from its Equation

    Equations whose graphs are straight lines are called linear equations. The following are some examples of linear equations:

    \(2 x-3 y=6, \quad 3 x=4 y-7, \quad y=2 x-5, \quad 2 y=3, \quad \text { and } \quad x-2=0\)

    A line is completely determined by two points. Therefore, to graph a linear equation we need to find the coordinates of two points. This can be accomplished by choosing an arbitrary value for x or y and then solving for the other variable.

    Example \(\PageIndex{1}\)

    Graph the line: \(y = 3x + 2\)

    Solution

    We need to find the coordinates of at least two points. We arbitrarily choose x = - 1, x = 0, and x = 1.

    • If x = -1, then y = 3(-1) + 2 or -1. Therefore, (-1, -1) is a point on this line.
    • If x = 0, then y = 3(0) + 2 or y = 2. Hence the point (0, 2).
    • If x = 1, then y = 5, and we get the point (1, 5).

    Below, the results are summarized, and the line is graphed.

    x -1 0 1
    y -1 2 5

    Example1.1.1.png

    Example \(\PageIndex{2}\)

    Graph the line: \(2x + y = 4\)

    Solution

    Again, we need to find coordinates of at least two points.

    We arbitrarily choose x = -1, x = 0, and y = 2.

    • If x = -1, then 2(-1) + y = 4 which results in y = 6. Therefore, (-1, 6) is a point on this line.
    • If x = 0, then 2(0) + y = 4, which results in y = 4. Hence the point (0, 4).
    • If y = 2, then 2x + 2 = 4, which yields x = 1, and gives the point (1, 2).

    The table below shows the points, and the line is graphed.

    x -1 0 1
    y 6 4 2

    Example1.1.2.png

    Intercepts

    The points at which a line crosses the coordinate axes are called the intercepts.
    When graphing a line by plotting two points, using the intercepts is often preferred because they are easy to find.

    • To find the value of the x-intercept, we let y = 0
    • To find the value of the y-intercept, we let x = 0.

    Example \(\PageIndex{3}\)

    Find the intercepts of the line: \(2x - 3y = 6\), and graph.

    Solution

    To find the x-intercept, let y = 0 in the equation, and solve for x.

    \[\begin{align*} 2x - 3(0) &= 6 \\[4pt] 2x - 0 &= 6 \\[4pt] 2x &= 6 \\[4pt] x &= 3 \end{align*}\]

    Therefore, the x-intercept is the point (3,0).

    To find the y-intercept, let x = 0 in the equation, and solve for y.

    \[\begin{align*} 2(0) - 3y &= 6 \\[4pt] 0 - 3y &= 6 \\[4pt] -3y &= 6 \\[4pt] y &= -2 \end{align*}\]

    Therefore, the y-intercept is the point (0, -2).

    To graph the line, plot the points for the x-intercept (3,0) and the y-intercept (0, -2), and use them to draw the line.

    Example1.1.3.png

     

    Horizontal and Vertical Lines

    When an equation of a line has only one variable, the resulting graph is a horizontal or a vertical line.

    • The graph of the line \(x = a\), where \(a\) is a constant, is a vertical line that passes through the point \((a, 0)\). Every point on this line has the x-coordinate equal to a, regardless of the y-coordinate.
    • The graph of the line \(y = b\), where \(b\) is a constant, is a horizontal line that passes through the point \((0, b)\). Every point on this line has the y-coordinate equal to b, regardless of the x-coordinate.

    Example \(\PageIndex{4}\)

    Graph the lines: x = -2 , and y = 3.

    Solution

    The graph of the line x = -2 is a vertical line that has the x-coordinate -2 no matter what the y-coordinate is. The graph is a vertical line passing through point (-2, 0).

    The graph of the line y = 3, is a horizontal line that has the y-coordinate 3 regardless of what the x-coordinate is. Therefore, the graph is a horizontal line that passes through point (0, 3).

    Example1.1.5.png

    Note: Most students feel that the coordinates of points must always be integers. This is not true, and in real life situations, not always possible. Do not be intimidated if your points include numbers that are fractions or decimals.

     

    Graphing Using Slope

    A graph of a line can also be determined if one point and the "steepness" of the line is known. The number that refers to the steepness or inclination of a line is called the slope of the line.

    From previous math courses, many of you remember slope as the "rise over run," or "the vertical change over the horizontal change" and have often seen it expressed as:

    \[\frac{\text {rise}}{\text {run}}, \frac{\text {vertical change}}{\text {horizontal change}}, \frac{\Delta y}{\Delta x} \text { etc. } \nonumber\]

    We give a precise definition.

    Definition: Slope

    If (\(x_1\), \(y_1\)) and (\(x_2\), \(y_2\)) are two different points on a line, the slope of the line is

    \[\text{slope}=m=\frac{y_2-y_1}{x_2-x_1} \label{slope}\]

    Example \(\PageIndex{5}\)

    Find the slope of the line passing through points (−2, 3) and (4, −1), and graph the line.

    Solution

    Let (\(x_1\), \(y_1\)) = (−2, 3) and (\(x_2\), \(y_2\)) = (4, −1), then the slope (via Equation \ref{slope}) is

    \(m = \frac{-1-3}{4-(-2)} = \frac{-4}{6} = -\frac{2}{3}\) Example1.2.1.png

    To give the reader a better understanding, both the vertical change, -4, and the horizontal change, 6, are shown in the above figure.

    When two points are given, it does not matter which point is denoted as (\(x_1\), \(y_1\)) and which (\(x_2\), \(y_2\)). The value for the slope will be the same.

    In Example \(\PageIndex{1}\), if we instead choose (\(x_1\), \(y_1\)) = (4, −1) and (\(x_2\), \(y_2\)) = (−2, 3), then we will get the same value for the slope as we obtained earlier.

    The steps involved are as follows.

    \[m = \frac{3-(-1)}{-2-4} = \frac{4}{-6} = -\frac{2}{3} \nonumber \]

     

    Example \(\PageIndex{6}\)

    Find the slope of the line that passes through the points (−1, −4) and (3, −4) and graph the line.

    Solution

    Let (\(x_1\), \(y_1\)) = (−1, −4) and (\(x_2\), \(y_2\)) = (3, −4), then the slope is

    \[ m = \frac{-4-(-4)}{3-(-1)} = \frac{0}{4} = 0 \nonumber \]

    Note: The slope of any horizontal line is 0

    Example \(\PageIndex{7}\)

    Find the slope of the line that passes through the points (2, 3) and (2, −1), and graph the line.

    Solution

    Let (\(x_1\), \(y_1\)) = (2, 3) and (\(x_2\), \(y_2\)) = (2, −1) then the slope is

    \[m = \frac{-1-3}{2-2}=\frac{4}{0}=\text{undefined.} \nonumber\]


    Example1.2.2.png

    Note: The slope of any vertical line is undefined.

     The student should observe that

    • if a line rises when going from left to right, then it has a positive slope; as the value of \(x\) increases, the value of \(y\) also increases.
    • if a line falls going from left to right, it has a negative slope; as the value of \(x\) increases, the value of \(y\) decreases.
    • if a line is horizontal, is has a slope of zero; as the value of \(x\) increases, the value of \(y\) doesn't change.
    • if a line is vertical, it does not have a slope; the value of \(x\) never changes.

    Example \(\PageIndex{8}\)

    Graph the line that passes through the point (1, 2) and has slope \(-\frac{3}{4}\) .

    Solution

    Slope equals \(\frac{\text{rise}}{\text{run}}\). The fact that the slope is \(\frac{-3}{4}\), means that for every rise of -3 units (fall of 3 units) there is a run of 4. So if from the given point (1, 2) we go down 3 units and go right 4 units, we reach the point (5, -1). The graph is obtained by connecting these two points.

    Example1.2.4a.png

    Alternatively, since \(\frac{3}{-4}\) represents the same number, the line can be drawn by starting at the point (1,2) and choosing a rise of 3 units followed by a run of -4 units. So from the point (1, 2), we go up 3 units, and to the left 4, thus reaching the point (-3, 5) which is also on the same line. See figure below.

    Example1.2.4b.png

    Example \(\PageIndex{9}\)

    Find the slope of the line \(2x + 3y = 6\) by finding two points on the line.

    Solution

    In order to find the slope of this line, we will choose any two points on this line.

    Again, the selection of \(x\) and \(y\) intercepts seems to be a good choice. The \(x\)-intercept is (3, 0), and the \(y\)-intercept is (0, 2). Therefore, the slope is

    \[m = \frac{2-0}{0-3} =-\frac{2}{3}.\nonumber\]

    The graph below shows the line and the \(x\)-intercepts and \(y\)-intercepts:

    Example1.2.5.png

    Example \(\PageIndex{10}\)

    Find the slope and the \(y\)-intercept of the line \(y = 3x + 2\).

    Solution

    We again find two points on the line, e.g., (0, 2) and (1, 5). Therefore, the slope is

    \[m =\frac{5-2}{1-0} = \frac{3}{1} = 3. \nonumber\]

    Look at the slopes and the \(y\)-intercepts of the following lines.

    The line slope \(y\)-intercept
    \(y=3x+2\) 3 2
    \(y=-2x+5\) -2 5
    \(y=\frac{3}{2}x-4\) \(\frac{3}{2}\) -4

    It is no coincidence that when an equation of the line is solved for \(y\), the coefficient of the \(x\) term represents the slope, and the constant term represents the \(y\)-intercept.

    In other words, for the line \(y = mx + b\), \(m\) is the slope, and \(b\) is the \(y\)-intercept.

    Example \(\PageIndex{11}\)

    Determine the slope and \(y\)-intercept of the line \(2x + 3y = 6\).

    Solution

    We solve for \(y\):

    \begin{align*}
    &2 x+3 y=6 \nonumber \\
    &3 y=-2 x+6 \nonumber \\
    &y=(-2 / 3) x+2 \nonumber
    \end{align*}

    The slope = the coefficient of the \(x\) term = − 2/3.

    The \(y\)-intercept = the constant term = 2.


    This page titled 1.2: Graphing Linear Equations is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Rupinder Sekhon and Roberta Bloom via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.