Algebra 1 · Grades 8, 9
How to Write the Equation of a Line from Two Points
Quick answer
To find the equation of a line through two points, first compute the slope with the slope formula, then substitute that slope and either point into point-slope form, then simplify. Through (1, 3) and (3, 7) the slope is 2, giving y - 3 = 2(x - 1), which simplifies to y = 2x + 1.
What you'll learn
- Find the equation of a line through two given points
- Combine the slope formula with point-slope form
- Handle the special cases of horizontal and vertical lines
The whole method in one line
Two points determine a line, so they must determine its equation. Getting there is two tools you already have, used in order:
- Compute the slope: .
- Substitute and either point into .
- Simplify to slope-intercept form if you want the intercept.
Why you need the slope first
Point-slope form needs a slope, and you are not given one — you are given two points. So the slope formula comes first, and its answer feeds the second step.
It is worth seeing that this always works. Two distinct points with different -values give exactly one slope, and a slope plus a point gives exactly one line. So the answer exists and is unique — there is never a choice to agonise over, only arithmetic to do carefully.
Worked examples
Common mistakes
Practice problems
-
Find the equation of the line through and .
Hint
Compute the slope first. One of these points is already the -intercept.
Answer
Full solution
.
Since is the -intercept, and directly.
Check at : ✓
-
Find the equation of the line through and .
Answer
Full solution
. Using : , so .
Check at : ✓
-
Find the equation of the line through and .
Answer
Full solution
.
Using : , so .
Check at : ✓
-
Find the equation of the line through and .
Hint
Compute the slope before reaching for point-slope form.
Answer
Full solution
, so the line is horizontal at the shared height: .
-
Find the equation of the line through and .
Answer
Full solution
The -values match, so the denominator is and the slope is undefined. The line is vertical: .
-
Find the equation of the line through and .
Hint
Expect a fractional slope. Keep it as a fraction.
Answer
Full solution
.
is the intercept, so .
Check at : ✓
-
Two students find the line through and . One writes , the other writes . Who is right?
Hint
Simplify both.
Answer
Both.
Full solution
First: , so .
Second: , so .
They used different points, which is allowed, and reached the same line.
-
A plant is measured at cm on day and cm on day . Assuming steady growth, write an equation for its height and predict its height on day .
Hint
Days are , height is . Find the growth rate first.
Answer
; on day it is cm.
Full solution
cm per day.
Using : , so .
On day : cm.
The intercept predicts a height of cm on day , which is a reasonable seedling — but predicting far outside the measured range assumes growth stays steady, and real plants eventually stop.
Frequently asked questions
Which of the two points should I substitute?
Either. Both give equations that simplify to the same line. Pick the one with smaller or positive numbers, since it makes the arithmetic cleaner.
What if the two points give a slope of zero?
Then the line is horizontal and its equation is y = the shared y-value. There is no need for point-slope form; the answer is already in front of you.
What if the x-values are the same?
Then the slope is undefined and the line is vertical. Its equation is x = the shared x-value. A vertical line cannot be written as y = mx + b at all.
Standards alignment
This lesson covers the following Common Core State Standards for Mathematics.
- CCSS.MATH.CONTENT.HSA.CED.A.2Creating EquationsCreate equations in two or more variables to represent relationships between quantities; graph equations on coordinate axes with labels and scales.
- CCSS.MATH.CONTENT.8.EE.B.6Expressions and EquationsUse similar triangles to explain why the slope m is the same between any two distinct points on a non-vertical line in the coordinate plane; derive the equation y = mx for a line through the origin and the equation y = mx + b for a line intercepting the vertical axis at b.