To find the equation of a line from two points, first compute the slope as the change in y divided by the change in x, then substitute that slope and either point into y − y₁ = m(x − x₁) and simplify to y = mx + b. The method works for any two distinct points, with one hard boundary: the x-coordinates must differ, because a vertical line has no slope and no y = mx + b form at all.
That boundary matters more than most tutorials admit. A single slip in sign handling on a fraction like (−2 − 5)/(3 − (−4)) sends every later step wrong, and the error survives into the final answer. The sequence below is arranged so each line can be checked against the one before it, and a final verification step catches mistakes the algebra itself won't flag.
Name the two points and label coordinates before any arithmetic
Assign labels first. Call one point (x₁, y₁) and the other (x₂, y₂). The labels are arbitrary — either point can be point one — but committing to them before subtracting prevents the most common error, which is mixing a y-value into the x-subtraction.
Suppose the points are (2, 3) and (6, 11). Then x₁ = 2, y₁ = 3, x₂ = 6, y₂ = 11. Writing those four numbers in a row above your workspace is not busywork; it's the step where sign errors get caught before they multiply.
Negative coordinates deserve a deliberate pause. For points (−4, 5) and (3, −2), you have x₁ = −4, y₁ = 5, x₂ = 3, y₂ = −2. The subtractions ahead become 3 − (−4) and −2 − 5. Each of those involves a double negative, and each converts differently: subtracting a negative adds, while a negative minus a positive goes further negative.
Order consistency is the real rule. If you compute y₂ − y₁ on top, you must compute x₂ − x₁ on bottom — never y₂ − y₁ over x₁ − x₂. Reversing one but not the other flips the fraction's sign while leaving its magnitude intact, producing a slope that looks plausible and fails silently. Slope, after all, is a ratio of directed changes, and ratios only mean something when both changes run in the same direction.
One quick naming convention earns its keep: keep the subscript pairing vertical on the page. Write the two points stacked, point one above point two, then subtract downward. Vertical alignment makes the pairing obvious and turns the labeling step into a visual check rather than a memory exercise.
Run the slope formula and reduce the fraction fully
The slope formula is m = (y₂ − y₁) / (x₂ − x₁). The letter m is traditional; nobody has established a definitive origin for it, and the notation doesn't affect the calculation. For (2, 3) and (6, 11): m = (11 − 3) / (6 − 2) = 8 / 4 = 2. For (2, 5) and (8, 17): m = (17 − 5) / (8 − 2) = 12 / 6 = 2 — same slope, different points, both lines rising two units for every one unit right.
Reduce the fraction before using it. From (−1, 4) and (2, −5), the numerator is −5 − 4 = −9 and the denominator is 2 − (−1) = 3, so m = −9/3. That reduces to −3, and carrying −9/3 forward into the point-slope form works but invites arithmetic strain later. Reduction is a free simplification.
Some slopes come out fractional and stay that way, which is fine. From (1, 2) and (4, 3): m = (3 − 2) / (4 − 1) = 1/3. A fractional slope is a perfectly ordinary result, not a sign of an error. If the reduction looks ugly, recheck the two subtractions directly rather than assuming the fraction is wrong.
A result of 0 is legitimate and means something specific. From (1, 4) to (5, 4), the numerator is zero and the slope is 0 — a horizontal line. The phrase "no slope" is a common misuse here. Zero is a number and a valid slope; "no slope" describes the vertical case, which is a different animal entirely and gets its own treatment below. Five seconds spent classifying the result — positive, negative, zero, or undefined — tells you what the line should look like before you plot anything.
Turn the slope and one point into point-slope form
Point-slope form is y − y₁ = m(x − x₁), and it exists precisely because it needs only one point plus a slope. Both points qualify as that one point, so either works — a useful property when one point's numbers are cleaner.
Apply it to (2, 3) with m = 2. Substitute: y − 3 = 2(x − 2). One detail carries disproportionate weight here: the notation subtracts y₁, so a negative y-coordinate flips into a plus. With the point (−4, 5), the left side becomes y − 5, while the right side's (x − x₁) becomes (x − (−4)), which is (x + 4). Getting that plus sign right is the single most valuable habit in this entire procedure.
Either point gives the same final line, which makes the second point a built-in check. Using (5, 1) with m = −2/3 gives y − 1 = (−2/3)(x − 5). Simplified, both versions reduce to the same equation — so if you have time, run the form with the other point and confirm the reduced results match. When they don't match, the error sits in the slope, because the slope is the one value both versions share.
The form itself needs no cleaning up to be correct. y − 3 = 2(x − 2) is a complete, legitimate equation of the line. Everything that follows — distributing, collecting terms — exists for convenience: slope-intercept form reads the y-intercept directly, while standard form may be requested by a teacher or a system. Know the form your context demands before deciding how far to simplify.
Distribute and solve for y to reach slope-intercept form
Slope-intercept form is y = mx + b, where b is the y-intercept — the y-value where the line crosses the x-axis's vertical counterpart, the y-axis. Starting from y − 3 = 2(x − 2): distribute to get y − 3 = 2x − 4, then add 3 to both sides for y = 2x − 1.
Read the result back against the points. The line y = 2x − 1 should pass through (2, 3), because 2(2) − 1 = 3, and through (6, 11), because 2(6) − 1 = 11. That double substitution is the verification step, and it costs about twenty seconds. Substituting the original points into the finished equation is the strongest error check available, and skipping it is how wrong answers get submitted with confidence.
Negative slopes flow the same way. From (−2, 4) and (3, −2): m = (−2 − 4) / (3 − (−2)) = −6/5. Point-slope with (−2, 4): y − 4 = (−6/5)(x + 2). Distribute: y − 4 = −(6/5)x − 12/5. Add 4, which is 20/5: y = −(6/5)x + 8/5. Check with the other point: −(6/5)(3) + 8/5 = −18/5 + 8/5 = −10/5 = −2. It passes.
Expect b to come out as a fraction perhaps a third of the time. A fractional intercept is not a failure mode; it's a normal outcome of realistic coordinates. Leave it as 8/5 rather than converting to 1.6 unless a decimal is specifically requested, since the fraction preserves exactness. And keep the negative sign attached to the slope in front of the x — y = −(6/5)x + 8/5 and y = (−6x + 8)/5 are equivalent, but the first reads the slope and intercept more directly.
Rewrite into standard form only when the setting demands it
Standard form is usually written Ax + By = C with integer coefficients, and many algebra courses and automated homework systems require it. Graders frequently insist that A, B, and C be integers and that A be non-negative; confirm the exact convention with your instructor or the platform's documentation, because implementations differ on whether A must be positive.
The conversion is mechanical. From y = 2x − 1, move the x-term left: −2x + y = −1. Multiply by −1 for a non-negative leading coefficient: 2x − y = 1. One equation, three legitimate presentations, and the only judgment call is which convention your setting enforces.
Fractional slopes make the integer requirement do real work. From y = (2/3)x + 1/3, multiply the entire equation by 3: 3y = 2x + 1, then rearrange to 2x − 3y = −1. Multiplying every term, including the constant, is where students slip — the constant is a term like any other.
Which form is best depends entirely on what you need to read off the equation:
| Form | Equation from (1, 5) and (3, 11) | What it reveals at a glance | Slope as a number | Best use |
|---|---|---|---|---|
| Point-slope | y − 5 = 3(x − 1) | A known point and the slope | 3 | Building the equation; fastest route from two points |
| Slope-intercept | y = 3x + 2 | Slope and y-intercept | 3 | Graphing; predicting y for any x |
| Standard | 3x − y = −2 | Integer coefficients, x- and y-intercepts | 3 (as −A/B) | Textbook answers, systems of equations |
The slope is 3 in every row, and that consistency is the point — the forms are costumes, not different lines. Pick the one your task rewards, and don't convert unless something requires it.
Recognize the vertical line, where the slope is undefined
Two points with equal x-coordinates — say (3, 1) and (3, 7) — produce a denominator of zero: (7 − 1)/(3 − 3) = 6/0. Division by zero is undefined, so the slope is undefined, and the line is vertical. Its equation is simply x = 3.
This is the one genuine exception to "find the equation from two points," and it's also the boundary the opening paragraph flagged. Point-slope form collapses here because m has no value to substitute, and no amount of rearranging produces y = mx + b. The line fails the vertical line test, which is precisely why it can't be written as a function of x.
A horizontal line is the opposite case and gets confused with it constantly. Points (1, 4) and (5, 4) give m = 0 and the equation y = 4 — a perfectly ordinary slope-intercept line with b = 4. Zero slope is defined; undefined slope is not. Textbooks differ on whether to call a vertical line's slope "undefined" or "no slope," so "undefined" is the safer term because it describes the arithmetic rather than the geometry.
Classifying before computing saves trouble. Glance at the x-coordinates: identical x means stop and write x = constant. Identical y means the slope is zero and the answer is y = constant. Only when both coordinates differ do you run the full five-step procedure, and that one glance prevents the most awkward error in the topic — a division by zero quietly written down as if it produced a number.
Work one full example from raw coordinates to a verified equation
Take the points (−4, 5) and (2, −1). Four rows on paper carry the whole job:
1: Label: x₁ = −4, y₁ = 5, x₂ = 2, y₂ = −1. 2: Slope: m = (−1 − 5) / (2 − (−4)) = −6 / 6 = −1. 3: Point-slope with the first point: y − 5 = −1(x + 4). 4: Simplify: y − 5 = −x − 4, so y = −x + 1. 5: Verify: −(−4) + 1 = 5 and −2 + 1 = −1. Both original points satisfy the equation.
If your own attempt misses, the failure almost always sits in one of three places. A double negative mishandled in step 2 flips the slope's sign. In step 3, forgetting that x − (−4) becomes x + 4 drops a sign from the right side. In step 4, adding 5 to only one term instead of the whole right side breaks the equality. Each failure leaves a fingerprint: a slope of +1 instead of −1, a right side reading (x − 4), or an intercept off by exactly the constant you moved. Check the slope first, since it poisons everything downstream.
Stay consistent when the setting uses f(x) notation
Some courses and nearly all calculus-adjacent material write y = mx + b as f(x) = mx + b. The mathematics is identical: f(x) = −x + 1 and y = −x + 1 describe the same line, and the two points still satisfy it. Swapping notation mid-problem is the error to avoid — finish in whichever form the problem opened with.
One related convention deserves a flag. A slope of zero written as f(x) = 4 is a valid constant function, while an undefined slope written as x = 3 is not a function in x at all. Courses that lean on function notation care about that distinction, and system-graded platforms are often strict about it. If you're entering answers into a platform, check its accepted formats before assuming y = mx + b is one of them.
Check the answer against both points every time
Substitute both original points into the finished equation. For y = 2x − 1, (2, 3) and (6, 11) both satisfy it. If both substitutions hold, the equation is correct — full stop. If either fails, the error is upstream in the slope or the intercept, and reworking step 2 catches it in under a minute.
A mental sanity pass supplements the substitution. Positive slope means the line rises left to right; negative means it falls; the y-intercept should sit where the line crosses x = 0. Checking signs costs seconds and catches roughly half of all careless errors before they reach paper. Given that a sign slip in the slope survives every subsequent step, this is the highest-yield check in the procedure.
There's a cost trade-off worth knowing, too. On a timed exam with five minutes per problem, the full five-step sequence plus verification fits comfortably in about ninety seconds, so skipping verification buys almost nothing. Automated homework systems, by contrast, often accept only one form; paste a slope-intercept answer into a field expecting standard form and it fails even when the math is right.
FAQ
Can the same line have different-looking equations?
Yes — point-slope, slope-intercept, and standard forms are all correct descriptions of one line. From points (1, 5) and (3, 11), they are y − 5 = 3(x − 1), y = 3x + 2, and 3x − y = −2. What changes is scale, not geometry: multiplying an entire standard-form equation by a nonzero constant produces an equivalent equation. Answer with the form your instructor or platform specifies.
What happens if the two points have the same x-coordinate?
The slope is undefined because the denominator becomes zero, and the line is vertical with equation x = the shared x-value. No y = mx + b form exists for it. If instead the y-coordinates match, the slope is 0 and the line is horizontal. Checking both coordinates before starting tells you which of the three cases you're in.
Is "no slope" the same as a slope of zero?
No, and the confusion is common. A slope of zero belongs to a horizontal line like y = 4, where y doesn't change as x does. "No slope" or "undefined slope" belongs to a vertical line like x = 3, where the run is zero. One is a number; the other is the absence of one.
Which point should I use in point-slope form?
Either. Both points lie on the line, so both produce the same final slope-intercept equation — choosing the point with smaller or cleaner numbers just reduces arithmetic. If the two versions disagree after simplification, the slope is wrong, since slope is the one value they share.
Which form does a graphing calculator need?
Most graphing calculators and graphing tools in homework platforms want slope-intercept form, entered as an expression in x. Check whether the tool expects y = or just the expression, since some accept only the right-hand side. Standard form usually has to be solved for y first.
How do I find the equation if I'm only given the slope and one point?
Use point-slope form directly: y − y₁ = m(x − x₁). Two points are one way to get the slope, not a requirement for the method. Substitute the known slope and the point's coordinates, then simplify to whichever form is requested.
Where does the slope formula come from?
It's the definition of slope: change in y divided by change in x, or rise over run. Between two points, the vertical change is y₂ − y₁ and the horizontal change is x₂ − x₁. Every rearrangement of slope-intercept form traces back to those two differences.