Learn how to find the slope-intercept equation of a line from two points on that line.
If you haven't read it yet, you might want to start with our introduction to slope-intercept form.

Writing equations from y-intercept and another point

Let's write the equation of the line that passes through the points left parenthesis, 0, comma, 3, right parenthesis and left parenthesis, 2, comma, 7, right parenthesis in slope-intercept form.
Recall that in the general slope-intercept equation y, equals, start color maroonC, m, end color maroonC, x, plus, start color greenE, b, end color greenE, the slope is given by start color maroonC, m, end color maroonC and the y-intercept is given by start color greenE, b, end color greenE.

Finding start color greenE, b, end color greenE

The y-intercept of the line is left parenthesis, 0, comma, start color greenE, 3, end color greenE, right parenthesis, so we know that start color greenE, b, end color greenE, equals, start color greenE, 3, end color greenE.

Finding start color maroonC, m, end color maroonC

Recall that the slope of a line is the ratio of the change in y over the change in x between any two points on the line:
S, l, o, p, e, equals, start fraction, C, h, a, n, g, e, space, i, n, space, y, divided by, C, h, a, n, g, e, space, i, n, space, x, end fraction
Therefore, this is the slope between the points left parenthesis, 0, comma, 3, right parenthesis and left parenthesis, 2, comma, 7, right parenthesis:
m=Change in yChange in x=7320=42=2\begin{aligned}\maroonC{m}&=\dfrac{\text{Change in }y}{\text{Change in }x}\\\\\\ &=\dfrac{7-3}{2-0}\\\\\\ &=\dfrac{4}{2}\\\\\\ &=\maroonC{2}\end{aligned}
In conclusion, the equation of the line is y, equals, start color maroonC, 2, end color maroonC, x, start color greenE, plus, 3, end color greenE.

Check your understanding

1) Write the equation of the line.

left parenthesis, 0, comma, start color greenE, 5, end color greenE, right parenthesis is the y-intercept of the line, so start color greenE, b, end color greenE, equals, start color greenE, 5, end color greenE.
Now we find the slope by using the two points:
m=(9)(5)(4)(0)=44=1\begin{aligned}\maroonC{m}&=\dfrac{(9)-(5)}{(4)-(0)}\\\\\\ &=\dfrac{4}{4}\\\\\\ &=\maroonC{1}\end{aligned}
Therefore, the equation of the line is y, equals, start color maroonC, 1, end color maroonC, x, start color greenE, plus, 5, end color greenE.
2) Write the equation of the line.

left parenthesis, 0, comma, start color greenE, 8, end color greenE, right parenthesis is the y-intercept of the line, so start color greenE, b, end color greenE, equals, start color greenE, 8, end color greenE.
Now we find the slope by using the two points:
m=(2)(8)(3)(0)=63=2\begin{aligned}\maroonC{m}&=\dfrac{(2)-(8)}{(3)-(0)}\\\\\\ &=\dfrac{-6}{3}\\\\\\ &=\maroonC{-2}\end{aligned}
Therefore, the equation of the line is y, equals, start color maroonC, minus, 2, end color maroonC, x, start color greenE, plus, 8, end color greenE.

Writing equations from any two points


Let's write the equation of the line that passes through left parenthesis, 2, comma, 5, right parenthesis and left parenthesis, 4, comma, 9, right parenthesis in slope-intercept form.
Note that we are not given the y-intercept of the line. This makes things a little bit more difficult, but we are not afraid of a challenge!

Finding start color maroonC, m, end color maroonC

m=Change in yChange in x=9542=42=2\begin{aligned}\maroonC{m}&=\dfrac{\text{Change in }y}{\text{Change in }x}\\\\\\\\ &=\dfrac{9-5}{4-2}\\\\\\ &=\dfrac{4}{2}\\\\\\ &=\maroonC{2}\end{aligned}

Finding start color greenE, b, end color greenE

We know that the line is of the form y, equals, start color maroonC, 2, end color maroonC, x, plus, start color greenE, b, end color greenE, but we still need to find start color greenE, b, end color greenE. To do that, we substitute the point left parenthesis, 2, comma, 5, right parenthesis into the equation.
Because any point on a line must satisfy that line’s equation, we get an equation that we can solve to find start color greenE, b, end color greenE.
Substituting left parenthesis, 2, comma, 5, right parenthesis into the equation is the same as substituting x, equals, 2 and y, equals, 5 into the equation.
Remember that every point on the graph of a two-variable equation is a solution of that equation. In other words, if we substitute the point into the equation we get a true statement.
To use a different equation as an example, the point left parenthesis, 3, comma, 1, right parenthesis is on the line y, equals, x, minus, 2. This means that substituting the point into the equation will result in a true statement:
y=x21=32Substitute x=3 and y=11=1\begin{aligned}y&=x-2\\\\ 1&=3-2&\small\gray{\text{Substitute }x=3\text{ and }y=1}\\\\ 1&=1 \end{aligned}
In our solution, we do the same thing, only we don't know the complete equation of the line. Substituting a point that we know is on the line will help us find the missing start color greenE, b, end color greenE.
y=2x+b5=22+bSubstitute x=2 and y=55=4+b1=b\begin{aligned}y&=\maroonC{2}\cdot x+\greenE{b}\\\\ 5&=\maroonC{2}\cdot 2+\greenE{b}&\gray{\text{Substitute }x=2\text{ and }y=5}\\\\ 5&=4+\greenE{b}\\\\ \greenE{1}&=\greenE{b} \end{aligned}
In conclusion, the equation of the line is y, equals, start color maroonC, 2, end color maroonC, x, start color greenE, plus, 1, end color greenE.

Check your understanding

3) Write the equation of the line.

First, we find the slope:
m=(10)(4)(3)(1)=62=3\begin{aligned}\maroonC{m}&=\dfrac{(10)-(4)}{(3)-(1)}\\\\\\ &=\dfrac{6}{2}\\\\\\ &=\maroonC{3}\end{aligned}
So the equation is of the form y, equals, start color maroonC, 3, end color maroonC, x, plus, start color greenE, b, end color greenE.
Now, we substitute the point left parenthesis, 1, comma, 4, right parenthesis into the equation to find start color greenE, b, end color greenE:
y=3x+b4=31+bSubstitute x=1 and y=44=3+b1=b\begin{aligned}y&=\maroonC{3}x+\greenE{b}\\\\ 4&=\maroonC{3}\cdot 1+\greenE{b}&\small\gray{\text{Substitute }x=1\text{ and }y=4}\\\\ 4&=3+\greenE{b}\\\\ \greenE{1}&=\greenE{b} \end{aligned}
Therefore, the equation of the line is y, equals, start color maroonC, 3, end color maroonC, x, start color greenE, plus, 1, end color greenE.
4) Write the equation of the line.

First, we find the slope:
m=(1)(9)(4)(2)=82=4\begin{aligned}\maroonC{m}&=\dfrac{(1)-(9)}{(4)-(2)}\\\\\\ &=\dfrac{-8}{2}\\\\\\ &=\maroonC{-4}\end{aligned}
So the equation is of the form y, equals, start color maroonC, minus, 4, end color maroonC, x, plus, start color greenE, b, end color greenE.
Now, we substitute the point left parenthesis, 2, comma, 9, right parenthesis into the equation to find start color greenE, b, end color greenE:
y=4x+b9=42+bSubstitute x=2 and y=99=8+b17=b\begin{aligned}y&=\maroonC{-4}x+\greenE{b}\\\\ 9&=\maroonC{-4}\cdot 2+\greenE{b}&\small\gray{\text{Substitute }x=2\text{ and }y=9}\\\\\\\\ 9&=-8+\greenE{b}\\\\ \greenE{17}&=\greenE{b} \end{aligned}
Therefore, the equation of the line is y, equals, start color maroonC, minus, 4, end color maroonC, x, start color greenE, plus, 17, end color greenE.

Challenge problem

A line passes through the points left parenthesis, 5, comma, 35, right parenthesis and left parenthesis, 9, comma, 55, right parenthesis.
Write the equation of the line.

First, we find the slope:
m=(55)(35)(9)(5)=204=5\begin{aligned}\maroonC{m}&=\dfrac{(55)-(35)}{(9)-(5)}\\\\\\ &=\dfrac{20}{4}\\\\\\ &=\maroonC{5}\end{aligned}
So the equation is of the form y, equals, start color maroonC, 5, end color maroonC, x, plus, start color greenE, b, end color greenE.
Now, we substitute the point left parenthesis, 5, comma, 35, right parenthesis into the equation to find start color greenE, b, end color greenE:
y=5x+b35=55+bSubstitute x=5 and y=3535=25+b10=b\begin{aligned}y&=\maroonC{5}x+\greenE{b}\\\\ 35&=\maroonC{5}\cdot 5+\greenE{b}&\small\gray{\text{Substitute }x=5\text{ and }y=35}\\\\ 35&=25+\greenE{b}\\\\ \greenE{10}&=\greenE{b} \end{aligned}
Therefore, the equation of the line is y, equals, start color maroonC, 5, end color maroonC, x, start color greenE, plus, 10, end color greenE.