How to Write Linear Equation Given Two Points (2025 Guide)

By culbreath Editorial · 2026-10-11 · 4 min read

To write a linear equation given two points, first find the slope using m = (y₂ − y₁)/(x₂ − x₁), then substitute that slope and either point into y − y₁ = m(x − x₁). Simplify to slope-intercept form if you want y = mx + b. That’s the whole method. Here it is in detail, with one worked example and the mistakes that cost students points.

The Core Method: Slope First, Then a Point

A straight line is completely determined by two distinct points, so you never need extra information. The work splits into two clean steps.

Step 1: Find the slope

Label your points (x₁, y₁) and (x₂, y₂). It doesn’t matter which you call “first,” as long as you stay consistent inside the subtraction. The slope formula is:

m = (y₂ − y₁) / (x₂ − x₁)

The slope tells you the rise over the run — how much y changes for each unit x moves. A positive m means the line climbs left to right; a negative m means it falls.

One warning: if x₂ − x₁ equals zero, the line is vertical and the slope is undefined. You’d write that line as x = (the shared x-value), not in y = mx + b form.

Step 2: Substitute into point-slope form

Point-slope form exists exactly for this situation:

y − y₁ = m(x − x₁)

Insert your slope and either original point. Both points produce the same line, so pick the one with smaller numbers to reduce arithmetic errors. Distributing and solving for y gives slope-intercept form, y = mx + b, which most teachers consider the finished answer unless told otherwise.

Khan Academy walks through this same two-step sequence with practice sets, which is useful if the algebra feels shaky.

A Worked Example, Start to Finish

Suppose the line passes through (2, 3) and (6, 11).

Find the slope. Using (2, 3) as point one:

m = (11 − 3) / (6 − 2) = 8 / 4 = 2

Use point-slope form with (2, 3):

y − 3 = 2(x − 2)

Simplify. Distribute the 2:

y − 3 = 2x − 4

Add 3 to both sides:

y = 2x − 1

Check it. Substitute x = 6: y = 2(6) − 1 = 11. That matches the second point, so the answer is correct. Always run this quick check — it catches sign errors in seconds.

If you used (6, 11) instead, you’d get y − 11 = 2(x − 6), which simplifies to the same y = 2x − 1. The point you choose truly doesn’t matter.

When the numbers are ugly

Points like (3, 7) and (5, 2) give m = (2 − 7)/(5 − 3) = −5/2. Keep it as a fraction rather than converting to a decimal. Fractions are not a mistake; rounding is.

Special Cases and Common Mistakes

Most lost points come from a handful of predictable slips.

  • Subtracting in the wrong order. Writing (y₁ − y₂)/(x₂ − x₁) flips the sign. Whichever point you subtract first in the numerator, subtract first in the denominator.
  • Dropping the negative sign. If m = −3, then y − y₁ = −3(x − x₁). Forgetting that minus flips the whole line.
  • Sign errors when substituting a negative point. For (x₁, y₁) = (−1, 4), point-slope becomes y − 4 = m(x − (−1)), which is y − 4 = m(x + 1). The minus times minus becomes plus.
  • Mixing up horizontal and vertical lines. A horizontal line through points sharing a y-value has slope 0 and is written y = (that value). A vertical line has undefined slope and is written x = (the shared value).

Purplemath’s step-by-step lessons cover these special cases in more depth, including why the vertical case breaks the slope formula.

A quick comparison of the two forms

Form Equation Use it when
Point-slope y − y₁ = m(x − x₁) You have a slope and one point (including right after Step 1)
Slope-intercept y = mx + b You want the final simplified answer or need to read off the y-intercept

Both describe the same line; converting between them is just algebra.

Key Takeaways

  • Use m = (y₂ − y₁)/(x₂ − x₁) for the slope, keeping the point order consistent.
  • Substitute the slope and either point into y − y₁ = m(x − x₁), then simplify to y = mx + b.
  • Either point works — choosing the one with smaller numbers just reduces arithmetic mistakes.
  • Keep fractions instead of decimals when the slope doesn’t divide evenly.
  • A zero slope means a horizontal line (y = constant); an undefined slope means a vertical line (x = constant).
  • Always verify by plugging the other original point into your final equation.

Frequently Asked Questions

How do you write a linear equation given two points?
First find the slope using m = (y2 - y1)/(x2 - x1) with the two points. Then substitute the slope and one point into y = mx + b (or point-slope form y - y1 = m(x - x1)) and solve for b to get the final equation.
What is the formula for the slope between two points?
The slope formula is m = (y2 - y1)/(x2 - x1), where (x1, y1) and (x2, y2) are the two given points. Just subtract the y-values and divide by the difference of the x-values.
Can you find a linear equation from two points without a graph?
Yes, you do not need a graph at all. Use the slope formula to calculate m, then plug m and either point into y = mx + b and solve for b.
What if the two points have the same x-coordinate?
If both x-coordinates are the same, the line is vertical and the slope is undefined. The equation is simply x = that x-value, for example x = 3.
What if the two points have the same y-coordinate?
If both y-coordinates are the same, the slope is 0 and the line is horizontal. The equation is y = that y-value, for example y = -2.
linear equationsalgebraslope-interceptpoint-slopemath tutorial

References

← Back to home