Back
How to Find the Equation of a Line from Two Points
> ... Math > Slopes, Intercepts, Equation of a Straight Line > How to Find the Equation of a Line from Two Points

The following video will teach how to find the equation of a line, given any two points on that line.

How to Find the Equation of a Line From Two Points

Video Source (7:13 mins) | Transcript

Steps to find the equation of a line from two points:

  1. Find the slope using the slope formula.
    • \( Slope = m = {\dfrac {rise}{run}} = {\dfrac {y2−y1} {x2−x1}} \)
    • Point 1 or \( P1= (x1,y1) \)
    • Point 2 or \( P2= (x2,y2) \)
  2. Use the slope and one of the points to solve for the y-intercept (b).
    • One of your points can replace the x and y, and the slope you just calculated replaces the m of your equation \( y = mx + b \) . Then \(b\) is the only variable left. Use the tools you know for solving for a variable to solve for b.
  3. Once you know the value for m and the value for b, you can plug these into the slope-intercept form of a line \( (y = mx + b) \) to get the equation for the line.

Additional Resources

Practice Problems

For each of the following problems, find the equation of the line that passes through the following two points:
  1. \(\left ( -5,10 \right )\) and \(\left ( -3,4 \right )\) (
    Solution
    x
    Solution: \({\text{y}}=-3{\text{x}}-5\)
    Details:

    Written Solution:

    Step 1: Find the slope using the formula:

    \(\displaystyle{\text{Slope}}={\text{m}}=\frac{\text{rise}}{\text{run}}=\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}\)

    We have two points,\(\left ( -5,10 \right )\) and \(\left ( -3,4 \right )\). We will choose \(\left ({\color{Red} -5},{\color{Red} 10} \right )\) as point one and \(\left ({\color{Blue} -3},{\color{Blue} 4} \right )\) as point two. (It does not matter which is point one and which is point two as long as we stay consistent throughout our calculations.) Now we can plug the points into our formula for slope:

    \(\displaystyle\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}=\frac{{\color{Blue}4}-{\color{Red}10}}{{\color{Blue}-3}-({\color{Red}-5})}\)

    Now we can simplify:

    \(\dfrac{4-10}{-3-(-5)}=\dfrac{4-10}{-3+5}=\dfrac{-6}{2}=-3\)

    The slope of the line is \({\color{Blue} -3}\), so the m in y=mx+b is \({\color{Blue} -3}\).

    Step 2: Use the slope and one of the points to find the y-intercept b:

    It doesn’t matter which point we use. They will both give us the same value for b since they are on the same line. We choose the point \(\left ( {\color{Green} -3},{\color{Red} 4} \right )\). Now we will plug the slope, \({\color{Blue} -3}\), and the point into y=mx+b to get the equation of the line:

    \({\color{Red} 4}={\color{Blue} -3}\left ( {\color{Green} -3} \right )+\text{b}\)

    Simplify:

    \(4 = 9 + b\)

    Then subtract 9 from both sides:

    \(4 − 9 = 9 + b − 9\)

    \({\color{Red} -5}=\text{b}\)

    Step 3: Plug the slope (m=\({\color{Blue} -3}\)), and the y-intercept (b= \({\color{Red} -5}\)), into y=mx+b:

    \(\text{y}={\color{Blue} -3}{\text{x}}-{\color{Red} 5}\)
    )
  2. \(\left ( -5,-26 \right )\) and \(\left ( -2,-8 \right )\) (
    Solution
    x
    Solution: \({\text{y}}=6{\text{x}}+4\)
    )
  3. \(\left ( -4,-22 \right )\) and \(\left ( -6,-34 \right )\) (
    Solution
    x
    Solution: \({\text{y}}=6{\text{x}}+2\)
    Details:

    Step 1: Find the slope using the formula:

    \(\displaystyle{\text{Slope}}={\text{m}}=\frac{\text{rise}}{\text{run}}=\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}\)

    We have two points, \(\left ( -4,-22 \right )\) and \(\left ( -6,-34 \right )\). We will choose \(\left ( {\color{Blue} -4},{\color{Blue} -22} \right )\) as point one and \(\left ( {\color{Red} -6},{\color{Red} -34} \right )\) as point two. (It does not matter which is point one and which is point two as long as we stay consistent throughout our calculations.) Now we can plug the points into our formula for slope:

    \(\displaystyle\frac{{\text{y}}_2-{\text{y}}_1}{{\text{x}}_2-{\text{x}}_1}=\frac{{\color{Red}-34}-({\color{Blue}-22})}{{\color{Red}-6}-({\color{Blue}-4})}\)

    Now we can simplify:

    \(\dfrac{-34-(-22)}{-6-(-4)}=\dfrac{-34+22}{-6+4}=\dfrac{-12}{-2}=6\)

    So the slope of the line is 6.

    Step 2: Use the slope and one of the points to find b.

    It doesn’t matter which point we use. They will both give us the same value for b since they are on the same line. We choose the point \(\left ({\color{Green} -4}, {\color{Magenta} -22} \right )\). Now we will plug the slope, 6, and the point into y=mx+b to get the equation of the line.

    \({\color{Magenta} -22}={\color{Purple} 6}({\color{Green} -4})+\text{b}\)

    Simplify:

    \(-22=-24+\text{b}\)

    Then add 24 to both sides.

    \(-22{\color{Red} +24}=-24+\text{b}{\color{Red} +24}\)

    \(2 = b\)

    Step 3: Plug the slope \(m = 6\), and the y-intercept \(b = 2\), into \(y=mx+b\).

    \(y= 6x +2\)
    )
  4. \(\left ( 3,1 \right )\) and \(\left ( -6,-2 \right )\) (
    Solution
    x
    Solution: \({\text{y}}=\dfrac{1}{3}{\text{x}}\)
    )
  5. \(\left ( 4,-6 \right )\) and \(\left ( 6,3 \right )\) (
    Solution
    x
    Solution: \({\text{y}}=\dfrac{9}{2}{\text{x}}-24\)
    )
  6. \(\left ( 5,5 \right )\) and \(\left ( 3,2 \right )\) (
    Solution
    x
    Solution: \(\text{y}=\dfrac{3}{2}{\text{x}}{-}{\dfrac{5}{2}}\)
    )

Need More Help?

  1. Study other Math Lessons in the Resource Center.
  2. Visit the Online Tutoring Resources in the Resource Center.
  3. Contact your Instructor.
  4. If you still need help, Schedule a Tutor.