Writing a Slope-Intercept Equation When Given 2 Points

Writing a Slope-Intercept Equation When Given 2 Points

Author: Sam Callahan

-Learn how to write an equation in slope-intercept (y=mx+b) form given only two points on the line
-Review how to use a slope-intercept equation to graph a line on a coordinate plane

Prerequisite knowledge:
-Graphing a linear equation
-Writing an equation in y=mx+b form given the slope and y-intercept
-What slope is

See More
Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

Begin Free Trial
No credit card required

27 Sophia partners guarantee credit transfer.

245 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 21 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.


Writing a Linear Equation Given 2 Points

Zero and Undefined Slopes

What if we are given the points (2,1) and (7,1) and told to write an equation for that line?

Already, you should think to yourself "hmm...those points both have the same y-cordinate.  They are both "1".  What's up with this?"


If you plug those points into the m = (y2 - y1) /( x2 - x1) equation, you get

m = (1 - 1) / (7 - 5)

m = 0 / 2

m= 0

So our slope is zero.  This makes sense; if the y-cordinate does not change from point to point, then it is never rising, only running.  This means our slope must be zero


Let's solve for b.  I'm going to use (2,1) to plug in for x and y, but you can use either point.  If x=2, y=1, and m=0:






So our final slope intercept equation is:

y=0x + 1

OR, because 0x is really just 0...


What that equation is saying is that y always is one, no matter what the x-coordinate is.  If you plug in "325,251" for x, you will still have "1" as your y value.


Here's a graph of the situation above:



What about the points (2,-2) and (2,3)?  This time, both x-coordinates are the same.

Again, m = (y2 - y1) /( x2 - x1)

m = (3 - 2)/(2 - 2)

m = 1 / 0

...wait a minute...we can't divide by zero!  When we have a slope like this, with zero in the denominator--in other words, when the x-coordinate always stays the same--the slope is undefinedIt never runs, only rises. 

Undefined slopes look like vertical lines on the graph:

For undefined slopes, making a slope-intercept (y=mx+b) equation isn't useful because we don't have a value for "m".

Instead, we can see from our two points or our graph that x is always 2, and therefore the equation for our line is:





So if you see a problem where both y-values are the same, the slope is always zero.


If the x-values are the same, the slope is undefined.


Example Problems

Find the slope-intercept equation for the line containing the following points:


a. (-4, 5) and (-2, 6)


b. (1, 4) and (5, -3)


b. (9, 4) and (9, 6) 





Example Answers

a. y = (1/2)x + 7

b. y = (-7/4)x + (23/4)

c. x = 9