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
Use the point \(\left(3,6\right)\) and see that you get the same equation.
Find an equation of a line given two points.
- Find the slope using the given points.
- Choose one point.
- Substitute the values into the point-slope form, \(y-{y}_{1}=m\left(x-{x}_{1}\right)\).
- 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