Skip to main content
K12 LibreTexts

4.7.3: Write an Equation Given Two Points

  • Page ID
    4332
  • \( \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}}\)

    Write an Equation Given Two Points

    Suppose two travelers were lost in a forest. From the same spot, one person traveled 5 miles east and 10 miles south, while the other person traveled 2 miles west and 8 miles north. If a coordinate plane were transposed on top of the forest, with the line going from west to east as the x-axis and the line going from north to south as the y-axis, could you write the equation of the line that passes through the points representing the travelers' new locations?

    Writing an Equation Given Two Points

    In many cases, especially real-world situations, you are given neither the slope nor the y−intercept. You might have only two points to use to determine the equation of the line.

    To find an equation for a line between two points, you need two things:

    1. The y-intercept of the graph
    2. The slope of the line

    Previously, you learned how to determine the slope between two points. Let’s repeat the formula here:

    The slope between any two points (x1,y1) and (x2,y2) is: slope=(y2−y1)/(x2−x1).

    The procedure for determining a line given two points is the same five-step process as writing an equation given the slope and a point.

    Let's write the equation of the following lines:

    1. The line containing the points (3, 2) and (–2, 4).

    You need the slope of the line. Find the line's slope by using the formula. Choose one ordered pair to represent (x1,y1) and the other ordered pair to represent (x2,y2).

    slope=(y2−y1)/(x2−x1)=(4−2)/(-2−3)=-2/5

    Now use the five-step process to find the equation for this line.

    Step 1: Begin by writing the formula for slope-intercept form.

    y=mx+b

    Step 2: Substitute the given slope for m.

    y=-2/5x+b

    Step 3: Use one of the ordered pairs you are given, (-2, 4), and substitute these values for the variables x and y in the equation.

    4=(-2/5)(-2)+b

    Step 4: Solve for b (the y-intercept of the graph).

    4=(4/5)+b

    4−(4/5)=(4/5)−(4/5)+b

    16/5=b

    Step 5: Rewrite y=mx+b, substituting the slope for m and the y-intercept for b.

    y=-2/5x+(16/5)

    1. The line containing the points (-4, 1) and (-2, 3).

    Find the slope of the line.

    m=(y2−y1)/(x2−x1)=(3−1)/(-2−(-4))=2/2=1

    Step 1: Start with the slope–intercept form of the line, y=mx+b.

    Step 2: Substitute the value of the slope for m.

    y=(1)x+b

    Step 3: Substitute the coordinates (–2, 3) into the equation for the variables x and y.

    3=-2+b

    Step 4: Solve for b.

    3=-2+b

    5=b

    Step 5: Rewrite the equation, substituting the slope for m and the y−intercept for b.

    y=(1)x+5

    1. The line containing the points (3,6) and (-2, 6).

    Find the slope of the line:

    m=(y2−y1)/(x2−x1)=(6−6)/(-2−(3))=0/-5=0

    Step 1: Start with the slope–intercept form of the line y=mx+b.

    Step 2: Substitute the value of the slope in for m.

    y=(0)x+b

    y=b

    Notice that this is an equation where y equals some number. This means it is a horizontal line. This makes sense since the slope is zero and a horizontal line has a slope of zero.

    Step 3 and 4: Substitute the coordinates (3, 6) into the equation for the variables x and y.

    6=(0)3+b

    6=b

    b=6

    Step 5: Rewrite the equation, substituting the slope for m and the y−intercept for b.

    y=(0)x+6

    y=6

    We can see when this will happen in the future, without having to do all the work. Because the two y values were the same, this must be a horizontal line.

    Examples

    Example 4.7.3.1

    Earlier, you were told about two travelers who were lost in a forest. From the same spot, one person traveled 5 miles east and 10 miles south, while the other person traveled 2 miles west and 8 miles north. If a coordinate plane were transposed on top of the forest, with the line going from west to east as the x-axis and the line going from north to south as the y-axis, what is the equation of the line that passes through the points representing the travelers' new locations?

    Solution

    If a coordinate plane was placed on top of the forest, west would represent the negative x direction and east would represent the positive x direction while south would represent the negative y direction and north would represent the positive y direction. 5 miles east and 10 miles south places one traveler at the point (5, -10). 2 miles west and 8 miles north places the other traveler at the point (-2, 8).

    First, find the slope between the two points on the line:

    m=(y2−y1)/(x2−x1)=(-10−8)/(5−(-2))=-18/7

    Step 1: Start with the slope–intercept form of the line, y=mx+b.

    Step 2: Substitute the value of the slope for m.

    y=(-18/7)x+b

    Step 3: Substitute the coordinates (-2, 8) into the equation for the variables x and y.

    8=((-18/7)⋅(-2))+b

    Step 4: Solve for b.

    y=mx+b

    (8)=((-18/7)⋅(-2))+b

    8=(36/7)+b

    20/7=b

    Step 5: Rewrite the equation, substituting the slope for m and the y−intercept for b.

    y=(-18/7)x+(20/7)

    Example 4.7.3.2

    Write the equation of the line containing the points (2, -3) and (2, 10).

    Solution

    In this case, notice that the two x values are the same. What does this mean? Remember, that for a vertical line, the x value stays the same no matter what the y value is.

    Since we are trying to write an equation of a line, and in both cases x=2, we can conclude that our equation is x=2.

    Note that if we were to calculate the slope of the line given the two points, we would get the following:

    m=y2−y1x2−x1=-3−(-2)2−(2)=-10=undefined

    Since our slope is undefined, it must be a vertical line. We would come to the same conclusion that this is a vertical line where x=2.

    Review

    1. What is the first step in finding the equation of a line given two points?

    In 2–7, find the equation of the line in slope–intercept form.

    1. The line containing the points (2, 6) and (5, 0).
    2. The line containing the points (5, –2) and (8, 4).
    3. The line containing the points (3, 5) and (–3, 0).
    4. The line containing the points (10, 15) and (12, 20).
    5. Figure 4.7.3.1
    6. Figure 4.7.3.2

    Mixed Review

    1. Translate into an algebraic sentence: One-third of a number is seven less than that number.
    2. The perimeter of a square is 67 cm. What is the length of its side?
    3. A hockey team played 17 games. They won two more than they lost. They lost 3 more than they tied. How many games did they win, lose, and tie?
    4. Simplify ((30−4+4÷2)÷(21÷3))/2
    5. What is the opposite of 16.76?
    6. Graph the following on a number line: {6,11/3,-5.65,21/7}
    7. Simplify: [(-4+4.5)+(18−|-13|)+(-3.3)]

    Review (Answers)

    To see the Review answers, open this PDF file and look for section 5.2.

    Vocabulary

    Term Definition
    slope-intercept form y=(slope)x+(y−intercept) or y=(m)x+b, where m=slope and b=y−intercept.
    undefined slope An undefined slope cannot be computed. Vertical lines have undefined slopes.

    Additional Resources

    PLIX: Play, Learn, Interact, eXplore: Graphs of Linear Functions: Line Designs

    Video:

    Activity: Write an Equation Given Two Points Discussion Questions

    Study Aid: Determining the Equation of a Line Study Guide

    Practice: Write an Equation Given Two Points


    This page titled 4.7.3: Write an Equation Given Two Points is shared under a CC BY-NC license and was authored, remixed, and/or curated by CK-12 Foundation via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.