How to write a line equation from two points
Find the slope first, anchor it to either point, then convert forms only if the problem needs a different presentation.
LaTeX article Updated July 13, 2026
Check for a vertical line first
If the x-coordinates are equal, the slope denominator is zero and the line is vertical. Its equation is x equal to that shared coordinate.
Otherwise compute the slope with consistent subtraction order and simplify before substituting.
Either point gives the same line
Once the slope is known, substitute either given point into point-slope form. The two resulting equations look different before simplification but describe the same set of points.
Using the point with smaller or simpler coordinates often makes expansion easier.
Verify with both points
A correct equation must make a true statement for each original point. Testing both catches a wrong slope and a wrong intercept quickly.
If slope-intercept form is requested, isolate y only after the point-slope equation is secure.
Worked example
Common mistakes
- Dividing y-change by x-change with inconsistent order.
- Substituting a point as (y, x).
- Stopping without checking the second point.
Keep these ideas
- Handle vertical lines separately.
- Point-slope form is the natural starting form.
- Both points must satisfy the result.