Skip to main content
Mathematics LibreTexts

3.4: Finding the Equation of a Line

  • Page ID
    109444
    \( \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
    • Determine the equation of a line given the \(y\) intercept and slope
    • Use a graph to extract the \(y\) intercept and slope of a line to determine its equation
    • Determine the equation of a line given the \(y\) intercept and a point
    • Determine the equation of a line given two points
    Warm Up \(\PageIndex{1}\)
    1. Find the \(y\) intercept of the graph below

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

    1. Find the slope of the line that contains the points (-1, 2) and (3, -6)
    2. Solve for \(y\) to get the equation into slope-intercept form: \(y - 3 = -4(x + 1)\).
    Answer
    1. \(b = -2\)
    2. \(m = -3\)
    3. \(y = -4x-1\)

    In the last few sections, we've talked about how we can use an equation to look at the graphs of a line or points on a line. In this section, we look at different ways to deduce the equation of a line given information such as slope, intercepts, points, or just a graph.

    Find an Equation of the Line Given the Slope and y-Intercept

    First, let's recall a particularly helpful form for the equation of a line -- the slope-intercept form -- and discuss a strategy we can use to deduce an equation of this form.

    Definition: SLOPE-INTERCEPT FORM OF A LINE

    If the line \(L\) intercepts the y-axis at the point (0, b) and has slope m, then the equation of the line is

    \[y=m x+b. \label{slopeintercept eq}\]

    This form of the equation of a line is called the slope-intercept form. The function defined by the equation \[f(x)=m x+b\] is called a linear function.

    It is important to note two key facts about the slope-intercept form y = mx + b.

    • The coefficient of x (the m in y = mx + b) is the slope of the line.
    • The constant term (the b in y = mx+b) is the y-coordinate of the y-intercept (0, b).

    So in order to create an equation for a line using this form, all we would need to deduce is those two pieces of information, slope and intercept.

    Procedure for Using the Slope-Intercept Form of a Line

    When given the slope of a line and the y-intercept of the line, use the slope-intercept form as follows:

    1. Substitute the given slope for m in the formula \(y = mx + b\).
    2. Substitute the y-coordinate of the y-intercept for b in the formula \(y = mx + b\).

    For example, if the line has slope −2 and the y-intercept (the point where the line crosses the y-axis) is (0, 3), then substitute m = −2 and b = 3 into Equation \ref{slopeintercept eq} to obtain

    \[y = −2x + 3.\nonumber\]

    As we did in the last chapter, we can easily determine the slope and intercept of a line if the equation is written in slope-intercept form, \(y=mx+b\). Now we will do the reverse—we will start with the slope and y-intercept and use them to find the equation of the line.

    Example \(\PageIndex{1}\)

    Find the equation of a line with slope \(−9\) and y-intercept \((0,−4)\).

    Answer

    Since we are given the slope and y-intercept of the line, we can substitute the needed values into the slope-intercept form, \(y=mx+b\).

    Name the slope. .
    Name the y-intercept. .
    Substitute the values into \(y=mx+b\). .
      .
      .
    Exercise \(\PageIndex{2}\)

    Find the equation of a line with slope \(25\) and y-intercept \((0,4)\).

    Answer

    \(y=\frac{2}{5}x+4\)

    Exercise \(\PageIndex{3}\)

    Find the equation of a line with slope \(−1\) and y-intercept \((0,−3)\).

    Answer

    \(y=−x−3\)

    Sometimes, the slope and intercept need to be determined from the graph.

    Example \(\PageIndex{4}\)

    Given the graph of the line in Figure \(\PageIndex{4}\)(a), determine the equation of the line.

    Solution

    First, locate the y-intercept of the line, which we’ve labeled P(0, −1) in Figure \(\PageIndex{4}\)(b). In the formula y = mx + b, recall that b represents the y-coordinate of the y-intercept. Thus, b = −1.

    WeChatd4ba64fbdac6e09e3537d091d096f6c2.png
    Figure \(\PageIndex{3}\). The line has y-intercept at (0, 3) and slope −2/3.

    Secondly, we need to determine the slope of the line. In Figure \(\PageIndex{4}\)(b), start at the point P, move 2 units to the right, then 3 units upward to the point Q(2, 2). This makes the slope \[m=\frac{\Delta y}{\Delta x}=\frac{3}{2}\]

    Substitute m = 3/2 and b = −1 into the slope-intercept form y = mx + b to obtain

    \[y=\frac{3}{2} x-1\]

    which is the desired equation of the line.

    WeChat8155144cac11d9d1debdbd880df23f80.png
    Figure \(\PageIndex{4}\). Determining the equation of a line from its graph.
    Exercise \(\PageIndex{5}\)

    Find the equation of the line shown in the graph.

    This figure has a graph of a straight line on the x y-coordinate plane. The x and y-axes run from negative 8 to 8. The line goes through the points (negative 3, negative 6), (0, negative 4), (3, negative 2), and (6, 0).

    Answer

    We need to find the slope and y-intercept of the line from the graph so we can substitute the needed values into the slope-intercept form, \(y=mx+b\).

    To find the slope, we choose two points on the graph.

    The y-intercept is \((0,−4)\) and the graph passes through \((3,−2)\).

    Find the slope, by counting the rise and run. .
      .
    Find the y-intercept. .
    Substitute the values into y=mx+b.y=mx+b. .
      .
    Exercise \(\PageIndex{6}\)

    Find the equation of the line shown in the graph.

    This figure has a graph of a straight line on the x y-coordinate plane. The x and y-axes run from negative 8 to 8. The line goes through the points (negative 5, negative 2), (0, 1), and (5, 4).

    Answer

    \(y=\frac{3}{5}x+1\)

    Exercise \(\PageIndex{7}\)

    Find the equation of the line shown in the graph.

    This figure has a graph of a straight line on the x y-coordinate plane. The x and y-axes run from negative 8 to 8. The line goes through the points (0, negative 5), (3, negative 1), and (6, 3).

    Answer

    \(y=\frac{4}{3}x−5\)

     

    Find an Equation of the Line Given the Slope and a Point

    Finding an equation of a line using the slope-intercept form of the equation works well when you are given the slope and y-intercept or when you read them off a graph. But what happens when you have another point instead of the y-intercept?

    We are going to use the slope formula to derive another form of an equation of the line.

    Suppose we have a line that has slope m and that contains some specific point \((x_0,y_0)\) and some other point, which we will just call \((x,y)\). We can write the slope of this line and then change it to a different form.

    \( \begin{array} {llll} {} &{m} &= &{\frac{y-y_0}{x-x_0}} \\ {\text{Multiply both sides of the equation by }x−x_1.} &{m(x-x_1)} &= &{\left( \frac{y−y_1}{x−x_1} \right)(x−x_1)} \\ {\text{Simplify.}} &{m(x-x_1)} &= &{y-y_1} \\ {\text{Rewrite the equation with theyterms on the left.}} &{y-y_1} &= &{m(x-x_1)} \\ \end{array} \)

    This format is called the point-slope form of an equation of a line.

    Definition: POINT-SLOPE FORM OF A LINE

    If line L passes through the point \(\left(x_{1}, y_{1}\right)\) and has slope m, then the equation of the line is \[y-y_{1}=m\left(x-x_{1}\right)\] This form of the equation of a line is called the point-slope form.

    To use the point-slope form of a line, follow these steps.

    Procedure for Using the Point-Slope Form of a Line

    When given the slope of a line and a point on the line, use the point-slope form as follows:

    1. Substitute the given slope for m in the formula \(y-y_{1}=m\left(x-x_{1}\right)\).
    2. Substitute the coordinates of the given point for x0 and y0 in the formula \(y-y_{1}=m\left(x-x_{1}\right)\).

    For example, if the line has slope −2 and passes through the point (3, 4), then substitute \(m=-2, x_{1}=3,\) and \(y_{1}=4\) in the formula \(y-y_{1}=m\left(x-x_{1}\right)\) to obtain \[y-4=-2(x-3)\nonumber\].

    It is common to rewrite this equation in slope-intercept form, because it's such a popular format. To do this, we just get \(y\) by itself on the left and then simplify everything on the left:

    \[ y-4=-2(x-3)\nonumber\]

    \[y=-2(x-3)+4\nonumber\]

    \[y=-2x+6+4\nonumber\]

    \[y=-2x+10\nonumber.\]

    We can use the point-slope form of an equation to find an equation of a line when we know the slope and at least one point, even if it's not the \(y\) intercept. Then, we will rewrite the equation in slope-intercept form. Most applications of linear equations use the the slope-intercept form.

    How to Find an Equation of a Line Given a Point and the Slope

    Example \(\PageIndex{8}\)

    Find an equation of a line with slope \(m=−\frac{1}{3}\) that contains the point \((6,−4)\). Write the equation in slope-intercept form.

    Answer

    Step 1 is to identify the slope. The slope is given. m equals negative 1 divided by 3.
    Step 2 is to identify the point. The point is given. x 1 is 6 and y 1 is negative 4.
    Step 3 is to substitute the values into the point-slope form y minus y 1 equals m times the quantity x minus x 1 in parentheses. y minus negative 4 equals negative 1 divided by 3 times the quantity x minus 6 in parentheses. This simplifies to y plus 4 equals negative 1 divided by 3 times x plus 2.
    Step 4 is to write the equation in slope-intercept form. y equals negative 1 divided by 3 times x minus 2.

    Exercise \(\PageIndex{9}\)

    Find the equation of a line with slope \(m=−\frac{2}{5}\) and containing the point \((10,−5)\).

    Answer

    \(y=−\frac{2}{5}x−1\)

    Exercise \(\PageIndex{10}\)

    Find the equation of a line with slope \(m=−\frac{3}{4}\), and containing the point \((4,−7)\).

    Answer

    \(y=−\frac{3}{4}x−4\)

    Let's summarize the steps more succinctly for easy reference:

    Procedure for Using the Point-Slope Form of a Line to Find an Equation of a Line Using a Slope and a Point
    1. Identify the slope.
    2. Identify the point.
    3. Substitute the values into the point-slope form, \(y−y_1=m(x−x_1)\).
    4. Write the equation in slope-intercept form.
    Exercise \(\PageIndex{11}\)

    Find an equation of a horizontal line that contains the point \((−2,−6)\). Write the equation in slope-intercept form.

    Answer

    Every horizontal line has slope 0. We can substitute the slope and points into the point-slope form, \(y−y_1=m(x−x1)\).

    Identify the slope. .
    Identify the point. .
    Substitute the values into y−y1=m(x−x1).y−y1=m(x−x1). .
      .
    Simplify. .
      .
    Write in slope-intercept form. It is in y-form, but could be written \(y=0x−6\).

    Did we end up with the form of a horizontal line, \(y=a\)?

    Exercise \(\PageIndex{12}\)

    Find the equation of a horizontal line containing the point \((−3,8)\).

    Answer

    \(y=8\)

    Exercise \(\PageIndex{13}\)

    Find the equation of a horizontal line containing the point \((−1,4)\).

    Answer

    \(y=4\)

     

    Find an Equation of the Line Given Two Points

    In the next example we’ll see how to find an equation of a line when just two points are given.

    So far, we have two options for finding an equation of a line: slope-intercept or point-slope. When we start with two points, it makes more sense to use the point-slope form.

    But then we need the slope. Can we find the slope with just two points? Yes. Then, once we have the slope, we can use it and one of the given points to find the equation.

    How to Find the Equation of a Line Given Two Points

    Example \(\PageIndex{14}\)

    Find an equation of a line that contains the points \((−3,−1)\) and \((2,−2)\) Write the equation in slope-intercept form.

    Answer
    Step 1 is to find the slope using the given points. Find the slope of the line through (negative 3, negative 1) and (2, and negative 2). m equals the quotient of y 2 minus y 1 in parentheses and x 2 minus x 1 in parentheses. m equals the quotient of negative 2 minus negative 1 in parentheses and 2 minus negative 3 in parentheses. m equals negative 1 divided by 5.Step 2 is to identify the point. Choose either point. x 1 is 2 and y 1 is negative 2.Step 3 is to substitute the values into the point-slope form y minus y 1 equals m times the quantity x minus x 1 in parentheses. y minus negative 2 equals negative 1 divided by 5 times the quantity x minus 2 in parentheses. This simplifies to y plus 2 equals negative 1 divided by 5 times x plus 2 divided by 5.Step 4 is to write the equation in slope-intercept form. y equals negative 1 divided by 5 times x minus 8 divided by 5.
    Exercise \(\PageIndex{15}\)

    Find the equation of a line containing the points \((−2,−4)\) and \((1,−3)\).

    Answer

    \(y=\frac{1}{3}x−\frac{10{3}\)

     
    Exercise \(\PageIndex{16}\)

    Find the equation of a line containing the points \((−4,−3)\) and \((1,−5)\).

    Answer

    \(y=−\frac{2}{5}x−\frac{23}{5}\)

     
     

    The steps are summarized here.

    TO FIND AN EQUATION OF A LINE GIVEN TWO POINTS.
    1. Find the slope using the given points. \(m=\frac{y_2−y_1}{x_2−x_1}\)
    2. Choose one point.
    3. Substitute the values into the point-slope form: \(y−y_1=m(x−x_1)\).
    4. Write the equation in slope-intercept form.
    Exercise \(\PageIndex{17}\)

    Find an equation of a line that contains the points \((−3,5)\) and \((−3,4)\). Write the equation in slope-intercept form.

    Answer

    Again, the first step will be to find the slope.

    Find the slope of the line through\((−3,5)\)and\((−3,4)\).

    \[m=\frac{y_2−y_1}{x_2−x_1} \nonumber\]

    \[m=\frac{4−5}{−3−(−3)} \nonumber\]

    \[m=\frac{−1}{0} \nonumber\]

    The slope is undefined.

    This tells us it is a vertical line. Both of our points have an x-coordinate of \(−2\). So our equation of the line is \(x=−2\). Since there is no y, we cannot write it in slope-intercept form.

    You may want to sketch a graph using the two given points. Does your graph agree with our conclusion that this is a vertical line?

    Exercise \(\PageIndex{18}\)

    Find the equation of a line containing the points \((5,1)\) and \((5,−4)\).

    Answer

    \(x=5\)

    Exercise \(\PageIndex{19}\)

    Find the equation of a line containing the points \((−4,4)\) and \((−4,3)\).

    Answer

    \(x=−4\)

    We have seen that we can use either the slope-intercept form or the point-slope form to find an equation of a line. Which form we use will depend on the information we are given.

    To Write an Equation of a Line
    If given: Use: Form:
    Slope and y-intercept slope-intercept \(y=mx+b\)
    A graph slope-intercept \(y=mx+b\)
    Slope and a point point-slope \(y−y_1=m(x−x_1)\)
    Two points point-slope \(y−y_1=m(x−x_1)\)

    Key Concepts

    • There are two useful forms for an equation -- the slope-intercept form and the point-slope form
      • The point-slope form is often the easiest to use to create the equation initially
      • The slope-intercept form is the most popular final form
    • The slope-intercept form of a line is \(y = mx + b\), and only requires the slope \(m\) and the \(y\) intercept \(b\) to create it
      • When given the slope of a line and the y-intercept of the line, use the slope-intercept form as follows:
        • Substitute the given slope for m in the formula \(y = mx + b\).
        • Substitute the y-coordinate of the y-intercept for b in the formula \(y = mx + b\).
    • When we know a point \((x_1, y_1)\) that is on the line, the point-slope form of a line is \(y - y_1 = m(x - x_1)\); but it is commonly rewritten to be in slope-intercept form
      • When given the slope of a line and a point on the line that may not be the \(y\) intercept, use the point-slope form as follows:
        • Identify the slope.
        • Identify the point.
        • Substitute the values into the point-slope form, \(y−y_1=m(x−x_1)\).
        • Write the equation in slope-intercept form.
    • When given two points, \((x_1, y_1)\) and \((x_2, y_2)\), the point-slope form is the easiest to use; we just need to do extra work to get the slope first
      • Use the point-slope form as follows:
        • Find the slope using the given points. \(m=\frac{y_2−y_1}{x_2−x_1}\)
        • Choose one point.
        • Substitute the values into the point-slope form: \(y−y_1=m(x−x_1)\).
        • Write the equation in slope-intercept form.

    This page titled 3.4: Finding the Equation of a Line is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Stanislav A. Trunov and Elizabeth J. Hale.

    • Was this article helpful?