Line Equation from Two Points- Complete Tutorial
Finding the Equation of a Line from Two Points
You have two points. You need a line. There's only one way to do this properly, and I'll show you exactly how it works.
No fluff. No "imagine the possibilities." Just the math.
The Slope-Intercept Formula
The standard form is y = mx + b, where:
- m = slope (rise over run)
- b = y-intercept (where the line crosses the y-axis)
Your job is to find m and b using your two points.
Step 1: Calculate the Slope
The slope formula is:
m = (y₂ - y₁) / (x₂ - x₁)
Take your y-values, subtract them. Take your x-values, subtract them. Divide.
Order matters for the subtraction, but stay consistent. If you subtract point 1 from point 2 in the numerator, do the same in the denominator.
Step 2: Find the Y-Intercept
Once you have m, plug it into y = mx + b along with one of your points. Solve for b.
That's it. One point is enough. Use whichever point makes the math easier.
Example: (2, 3) and (5, 11)
Step 1: Find the slope
m = (11 - 3) / (5 - 2) = 8/3
Step 2: Plug into y = mx + b using point (2, 3)
3 = (8/3)(2) + b
3 = 16/3 + b
b = 3 - 16/3 = 9/3 - 16/3 = -7/3
Answer: y = (8/3)x - 7/3
What If the Slope Is a Fraction?
Leave it as a fraction. Don't convert to decimal. Fractions are exact; decimals round.
If you need to graph it, the slope 8/3 means: go up 8, go right 3. Or go down 8, go left 3. Both work.
What If the Points Have the Same X-Value?
Then you have a vertical line. The equation is simply x = [that x-value].
Example: points (4, 2) and (4, 7) give you the line x = 4.
This line has no slope in the traditional sense. The formula m = (y₂ - y₁) / (x₂ - x₁) breaks because you'd be dividing by zero.
Quick Reference Table
| Scenario | What to Do |
|---|---|
| Two normal points | Find slope, then intercept |
| Same x-value | Vertical line: x = [value] |
| Same y-value | Horizontal line: y = [value] |
| Points are the same | Not a line. You need two distinct points. |
How to Get It Right Every Time
- Label your points clearly — Point 1: (x₁, y₁), Point 2: (x₂, y₂)
- Calculate slope first — Don't skip this. Everything depends on it.
- Use one point to solve for b — Pick the point with smaller or nicer numbers.
- Check your answer — Plug both original points into your final equation. Both should satisfy it.
Checking Your Work
Using the example above: y = (8/3)x - 7/3
Check (2, 3): (8/3)(2) - 7/3 = 16/3 - 7/3 = 9/3 = 3 ✓
Check (5, 11): (8/3)(5) - 7/3 = 40/3 - 7/3 = 33/3 = 11 ✓
Both points work. The equation is correct.
Common Mistakes
- Subtracting in the wrong order — As long as you're consistent, it cancels out. Inconsistency is where errors happen.
- Forgetting to solve for b — Finding m is half the battle. You still need b.
- Rounding too early — Keep fractions exact until the final answer.
The Point-Slope Form Alternative
Sometimes teachers want the answer in point-slope form: y - y₁ = m(x - x₁)
It's the same information, just rearranged. Use whichever format your assignment specifies.
For points (2, 3) and (5, 11) with slope 8/3, the point-slope form using point (2, 3) is:
y - 3 = (8/3)(x - 2)
This is acceptable. It simplifies to y = (8/3)x - 7/3 if you expand and solve.
When You'll Actually Use This
Physics problems involving linear relationships. Data analysis when you need the trend line equation. Any situation where two data points define a linear model.
It's a foundational skill. Once you know it cold, you stop thinking about it and just do it.