You need two coordinates, (x₁, y₁) and (x₂, y₂). If their x-values differ, the line has the equation y = mx + b with slope m = (y₂ − y₁)/(x₂ − x₁), and you can write it in point-slope form as y − y₁ = m(x − x₁), then rearrange to slope-intercept form. If the x-values are the same, the line is vertical: x equals that shared value, slope is undefined, and y = mx + b cannot describe it.
That last case is where most marks get lost. A single line through (3, 5) and (7, 5) is horizontal with m = 0 and b = 5. A single line through (3, 5) and (3, −2) is vertical with m undefined and no b at all. Both come from the same two-point formula, but only one of them produces a y = mx + b answer.
Define the Two-Point Formula in One Sentence
The two-point formula is the slope formula restated as an equation: m = (y₂ − y₁)/(x₂ − x₁), and then point-slope form y − y₁ = m(x − x₁) does the rest. The subtraction order matters. Subtract the y-values in the same order you subtract the x-values, or you get the wrong sign on m.
Consider (−4, 7) and (2, 1). Using the first point as point one: m = (1 − 7)/(2 − (−4)) = −6/6 = −1. Reverse the order: m = (7 − 1)/(−4 − 2) = 6/−6 = −1. Same answer, because both numerator and denominator flip sign together.
Then y − 1 = −1(x − 2), which simplifies to y = −x + 3. Check (−4, 7): −(−4) + 3 = 7. Check (2, 1): −2 + 3 = 1. Both verify, which is the fastest way to catch an arithmetic slip before it becomes a lost mark.
Number the Steps to Write the Equation in Slope-Intercept Form
A short lead-in first: these four steps produce the slope-intercept equation y = mx + b in roughly 30 to 60 seconds on paper. The failure-handling comes after the list.
1: Label the points. Write (x₁, y₁) next to the first coordinate and (x₂, y₂) next to the second. Consistency here prevents sign errors later. 2: Compute the slope. Apply m = (y₂ − y₁)/(x₂ − x₁). Keep the result as a fraction unless it divides cleanly. 3: Substitute one point into y − y₁ = m(x − x₁). Either point works; pick the one with smaller numbers. 4: Rearrange to y = mx + b. Distribute m, then move y₁ to the right side. State the final slope and y-intercept explicitly.
Failure mode one: denominator zero. If x₂ − x₁ = 0, stop and write x = x₁. Failure mode two: a sign flip from dropping parentheses. Write the subtraction with brackets, as in 1 − 7 and 2 − (−4), before simplifying. Failure mode three: forgetting to distribute m across both terms inside the bracket.
Run it on (5, −3) and (−1, 9). Step two gives m = (9 − (−3))/(−1 − 5) = 12/−6 = −2. Step three with (5, −3): y + 3 = −2(x − 5). Step four: y + 3 = −2x + 10, so y = −2x + 7. Verify with (−1, 9): −2(−1) + 7 = 9. Correct.
Compare Point-Slope, Slope-Intercept, and Standard Form
The lead-in: all three forms describe the same line, but each is easier for a different task. The table below uses the line through (−2, 4) and (3, −1), which has m = −1 and b = 2.
| Form | Equation for this line | Best for | Weakness |
|---|---|---|---|
| Point-slope | y − 4 = −1(x + 2) | Writing the equation fast from two points | Not accepted as a final answer by some rubrics |
| Slope-intercept | y = −x + 2 | Graphing, reading the y-intercept | Requires rearranging first |
| Standard | x + y = 2 | Systems of equations, integer coefficients | Slope is not visible |
The verdict: point-slope is the working tool, slope-intercept is the usual answer format, and standard form is the presentational format for systems. Many algebra courses require slope-intercept as final, so convert even when point-slope is correct.
One region-specific note: secondary school specifications differ on accepted final forms. In the United States, slope-intercept is the default in most Algebra I curricula. In the United Kingdom, GCSE exam boards typically accept any correct equivalent form unless the question specifies otherwise, but check the mark scheme for the awarding body, such as AQA, Edexcel, or OCR.
Handle Four Special Cases Before You Substitute
Four cases account for nearly every two-points problem that breaks the standard procedure. Check them before touching the formula.
Case one: horizontal line. Points (2, 6) and (9, 6). m = 0, and y = 6. Every point on that line shares the y-value, so b = 6.
Case two: vertical line. Points (4, −1) and (4, 8). m = 7/0, undefined. The equation is x = 4. There is no slope-intercept form; anyone who writes y = 4 has quietly swapped the axis.
Case three: a point on an axis. Points (0, 3) and (6, 0). Here b = 3 immediately and m = −1/2, giving y = −x/2 + 3. When one point has an x-value of zero, the y-value is b and no further algebra is needed.
Case four: identical points. Points (2, 3) and (2, 3). No unique line exists through a single repeated location. The slope formula gives 0/0, which is indeterminate, not zero. Flag it as an invalid input rather than computing an answer.
See a Full Worked Example From Coordinates to Graph
Work (7, 11) and (2, −4) from start to finish. This is the sequence to write out on an exam, line by line.
Step one: m = (−4 − 11)/(2 − 7) = −15/−5 = 3. Step two: y − 11 = 3(x − 7). Step three: y − 11 = 3x − 21, so y = 3x − 10. Step four: verify with the second point, 3(2) − 10 = −4. Confirmed.
For graphing, plot the y-intercept (0, −10) first, then step up 3 and right 1 repeatedly using the slope. A line through two points at a 3-to-1 rise-run ratio climbs steeply. On paper the difference between m = 3 and m = 1/3 is visible in a single glance.
Checking both input points catches sign errors immediately. If only one point verifies, the slope is right and the intercept is wrong. If neither verifies, the slope is wrong. That diagnostic split saves time on reworking.
Compute Slope and Intercept With a Quick Arithmetic Method
A computational shortcut: find b directly with b = (x₂y₁ − x₁y₂)/(x₂ − x₁) without solving the full equation. For (7, 11) and (2, −4): b = (2 × 11 − 7 × (−4))/(2 − 7) = (22 + 28)/(−5) = 50/−5 = −10. Matches the earlier answer.
This method is useful when you only need slope and intercept numbers, such as plugging a trend line into a spreadsheet or comparing two lines' steepness. It also doubles as an independent check on the longer method.
Keep precision in decimals consistent. Slope −1/3 is −0.333…, not −0.33. A rounding difference of 0.006 in slope shifts the intercept by roughly 0.06 when x ≈ 10, which is enough to fail an exact-answer rubric.
For real data, the same formula underlies linear regression when there are only two observations. A two-point fit is always exact by construction, which is why adding a third data point is the first test of whether a straight line is a reasonable model.
Fix the Five Errors That Cost the Most Marks
Error 1: reversed subtraction in only one of the two differences. m = (y₂ + y₁)/(x₂ − x₁) is not slope. Always subtract, never add, in the numerator.
Error 2: sign slip with negative coordinates. From (5, −3) to (−1, 9): the numerator is 9 − (−3) = 12, not 9 − 3 = 6. The latter gives m = −1, which is wrong by a factor of two.
Error 3: vertical line forced into slope-intercept. Writing y = anything for x = 4 fails immediately, because that line contains (4, 8) and y = 8 does not.
Error 4: losing the intercept after distributing. y − 4 = −1(x + 2) becomes y − 4 = −x − 2, so y = −x + 2. A common error yields y = −x − 6 by mishandling the constant.
Error 5: not verifying either point. Verification takes ten seconds. It catches errors 1 through 4 reliably.
Apply the Method to Real Situations With Two Data Points
If you have two readings, a straight line gives a usable model. A taxi that charges $3.50 at zero miles and $11.00 at 5 miles has slope (11.00 − 3.50)/(5 − 0) = $1.50 per mile, and b = $3.50 as the base fare. The equation is C = 1.50d + 3.50. That's a computation from figures presented here, not a published tariff.
For the taxi model, predict the charge at 12 miles: 1.50 × 12 + 3.50 = $21.50. The hidden limit is that the model breaks if the tariff changes mid-journey, charges a waiting rate, or applies a flat airport surcharge. Two points fit a line exactly; they do not prove a linear relationship.
Temperature is a classic cautionary example. Celsius to Fahrenheit is exactly linear: F = 1.8C + 32. Using two points, (0, 32) and (100, 212), the slope is 180/100 = 1.8 and the intercept is 32. This works because the scale is defined that way, not because two data points discovered a law.
If the units on the axes are wrong in a graph, the equation is wrong too. Read the axis labels before computing slope. A chart with dollars on one axis and thousands of units on the other can produce an equation whose slope is meaningless outside that plotted scale.
Watch a Two-Point Quiz Using a Three-Question Self-Test
Test yourself without looking back at the steps.
Question 1: line through (1, 2) and (4, 11). Slope is 9/3 = 3; equation y = 3x − 1. Error to watch: forgetting the intercept and writing y = 3x.
Question 2: line through (−3, −8) and (1, 0). Slope is 8/4 = 2; equation y = 2x − 2. Error to watch: dropping the sign on subtracting a negative.
Question 3: line through (6, 5) and (6, −2). This is vertical: x = 6. Error to watch: computing m as 7/0 and then writing y = 7x.
Score two or more correct in under 60 seconds on paper and the method is secure. If Question 3 caught you, re-read the special cases section, because vertical-line handling is the single most common failure point in standardized tests.
FAQ
Is the equation through two points always unique?
No. Two distinct points define exactly one line, but if the two points are identical, no unique line exists. The slope formula returns 0/0, which is indeterminate. A problem that supplies the same coordinate twice is either a typo or a deliberate trick, and the correct response is to note that a line cannot be determined.
Can a two-point line have an undefined y-intercept?
Yes. A vertical line such as x = 4 has no y-intercept value in the form y = mx + b, because the line never crosses the y-axis in exactly one point. It is parallel to the y-axis entirely. Writing b = 0 would place the line through the origin, which is wrong by a factor of the full x-distance.
What is the difference between slope 0 and undefined slope?
Slope 0 means the line runs perfectly horizontal, like y = 5, with no rise over any run. Undefined slope means it runs perfectly vertical, like x = 5, with no run over any rise. The two are perpendicular cases, not variants of each other, and they produce different equation forms.
Does the order of the two points change the final equation?
No, provided both differences use the same order. Reverse both and the slope and intercept come out identical. The only way order changes the answer is a mismatch, where the numerator subtracts in one order and the denominator in the other, which flips the sign of the slope.
How do you write the equation when one point is the origin?
With points (0, 0) and (6, 9), the slope is 9/6 = 1.5 and the intercept is 0, giving y = 1.5x. When one point is the origin, the equation becomes y = mx with no constant term. Using the origin as (x₁, y₁) makes the derivation one line shorter.
What does the slope of a two-point line represent physically?
Slope is a rate: change in y per unit change in x. If x is hours and y is dollars, slope is dollars per hour. If x is years and y is population, slope is people per year. The units carry through, which is why slope often matters more than the intercept in applied work.
Can a two-point equation produce a negative intercept even with positive points?
Yes. Take (1, 10) and (5, 2). Slope is −8/4 = −2, and b = 12, so intercept is positive here. Reverse the scenario with (2, 1) and (6, 9): m = 8/4 = 2, b = 1 − 4 = −3. Both coordinates positive, intercept negative. The intercept depends on slope and position together, not on the sign of the data.
How do you check the equation without graphing?
Substitute both original points into the final equation and verify equality. If both hold, the equation is correct for the line through them. If exactly one fails, the intercept is wrong. If both fail, the slope is wrong. This diagnostic is the fastest self-check available on paper.