Finding an Equation of the Line Given Two Points

Finding an Equation of the Line Given Two Points

When real-world data is collected, a linear model can be created from two data points. In the next example we’ll see how to find an equation of a line when just two points are given.

We have two options so far for finding an equation of a line: slope–intercept or point–slope. Since we will know two points, it will make 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.

Example: Find an Equation of a Line Given Two Points

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

Solution

This figure is a table that has three columns and four rows. The first column is a header column, and it contains the names and numbers of each step. The second column contains further written instructions. The third column contains math. In the first row of the table, the first cell on the left reads: “Step 1. Find the slope using the given points.” The text in the second cell reads: “To use the point-slope form, we first find the slope.” The third cell contains the slope of a line formula: m equals y superscript 2 minus y superscript 1 divided by x superscript 2 minus x superscript 1. Below this is m equals 6 minus 4 divided by 3 minus 5. Below this is m equals 2 divided by negative 2. Below this is m equals negative 1.In the second row, the first cell reads: “Step 2. Choose one point.” The second cell reads: “Choose either point.” The third cell contains the ordered pair (5, 4) with a superscript x subscript 1 over 5 and a superscript y subscript 1 over 4.In the third row, the first cell reads: “Step 3. Substitute the values into the point-slope form, y minus y subscript 1 equals m times x minus x subscript 1 in parentheses.” The top line of the second cell is left blank. The third cell contains the point-slope form, y minus y subscript 1 equals m times x minus x subscript 1 in parentheses. Below this is the point-slope form with 5 substituted for x subscript 1, 4 substituted for y subscript 1, and negative 1 substituted for m: y minus 4 equals negative 1 times x minus 5 in parentheses. Below this is y minus 4 equals negative x plus 5.In the fourth row, the first cell reads: “Step 4. Write the equation in slope-intercept form.” The second cell is blank. The third cell contains y equals negative x plus 9.

Use the point \(\left(3,6\right)\) and see that you get the same equation.

Find an equation of a line given two points.

  1. Find the slope using the given points.
  2. Choose one point.
  3. Substitute the values into the point-slope form, \(y-{y}_{1}=m\left(x-{x}_{1}\right)\).
  4. Write the equation in slope–intercept form.

Example

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

Solution

Since we have two points, we will find an equation of the line using the point–slope form. The first step will be to find the slope.

Find the slope of the line through (−3, −1) and (2, −2). .
.
.
.
Choose either point. .
Substitute the values into \(y-{y}_{1}=m\left(x-{x}_{1}\right).\) .
.
.
Write in slope–intercept form. .

Example

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

Solution

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

\(\begin{array}{cccc}\begin{array}{c}\text{Find the slope of the line through}\phantom{\rule{0.2em}{0ex}}\left(-2,4\right)\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}\left(-2,-3\right).\hfill \\ \end{array}\hfill & & & \phantom{\rule{4em}{0ex}}\begin{array}{ccc}\hfill m& =\hfill & \frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}\hfill \\ \hfill m& =\hfill & \frac{-3-4}{-2-\left(-2\right)}\hfill \\ \hfill m& =\hfill & \frac{-7}{0}\hfill \end{array}\hfill \\ & & & \phantom{\rule{4em}{0ex}}\text{The slope is undefined.}\hfill \end{array}\)

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 the graph agree with our conclusion that this is a vertical line?

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. This is summarized in the table below.

To Write an Equation of a Line
If given: Use: Form:
Slope and y-intercept slope–intercept \(y=mx+b\)
Slope and a point point–slope \(y-{y}_{1}=m\left(x-{x}_{1}\right)\)
Two points point–slope \(y-{y}_{1}=m\left(x-{x}_{1}\right)\)

This lesson is part of:

Graphs and Equations

View Full Tutorial

Track Your Learning Progress

Sign in to unlock unlimited practice exams, tutorial practice quizzes, personalized weak area practice, AI study assistance with Lexi, and detailed performance analytics.