Last verified · v1.0
Calculator · math
Line Equation From Two Points Calculator
Find the equation of any straight line by entering two coordinate points. Returns slope, y-intercept, and the complete y = mx + b equation instantly.
Inputs
Computed Value
—
Explain my result
Get a plain-English breakdown of your result with practical next steps.
The formula
How the
result is
computed.
How to Find the Equation of a Line From Two Points
Given any two distinct points on a coordinate plane, exactly one straight line passes through them. The line equation from two points calculator derives that line in slope-intercept form (y = mx + b) using three sequential steps grounded in algebraic geometry. Any two coordinate pairs — integers, decimals, or negatives — are sufficient to define the complete equation.
The Three Core Formulas
Three formulas work in sequence to produce the line equation from coordinates (x1, y1) and (x2, y2):
- Slope: m = (y2 - y1) / (x2 - x1)
- Y-intercept: b = y1 - m * x1
- Line equation: y = mx + b
Step 1: Calculate the Slope (m)
The slope measures the rate of vertical change per unit of horizontal change between the two points. A positive slope means the line ascends from left to right; a negative slope means it descends. A slope of zero indicates a horizontal line. According to Portland Community College's slope resource, slope is defined as rise divided by run — the vertical difference divided by the horizontal difference between any two points on the line. The order of subtraction must remain consistent: if y2 appears in the numerator, x2 must appear in the denominator.
Step 2: Find the Y-Intercept (b)
With slope known, substitute either coordinate pair into b = y1 - m * x1 to isolate the y-intercept. The result is the y-value at which the line crosses the vertical axis (x = 0). Using either point produces an identical b because both points are collinear. In applied contexts, the y-intercept often represents a fixed baseline — a starting salary, an initial position, or a fixed cost — before the slope-driven rate of change takes effect.
Step 3: Write the Complete Equation
Insert m and b into y = mx + b to obtain the slope-intercept equation. As detailed in Richland College's Lines in the Plane lecture notes, slope-intercept form is the standard representation because both key parameters are immediately visible and any y-value can be computed by direct substitution of x.
Worked Example
Find the equation of the line through points (3, 7) and (9, 19).
- Slope: m = (19 - 7) / (9 - 3) = 12 / 6 = 2
- Y-intercept: b = 7 - 2 * 3 = 7 - 6 = 1
- Equation: y = 2x + 1
Verification: substituting x = 9 gives y = 2(9) + 1 = 19, matching the second given point. The result is confirmed.
Special Cases
- Vertical lines (x1 = x2): The denominator equals zero, making slope undefined. The line is written x = c, where c is the shared x-coordinate. Points (5, 2) and (5, 8) define x = 5.
- Horizontal lines (y1 = y2): Slope equals zero and the equation simplifies to y = c, the shared y-coordinate.
- Lines through the origin: When b = 0, the equation reduces to y = mx.
Real-World Applications
Determining a line equation from two points is a practical skill across many fields:
- Physics: Deriving a constant-velocity equation from two position-time measurements — an object at 4 m at t = 1 s and at 10 m at t = 4 s yields v = 2t + 2.
- Finance: Modeling straight-line depreciation from an asset's initial value and projected salvage value.
- Engineering: Interpolating sensor output between two verified calibration readings to predict intermediate values.
- Data science: Establishing a linear baseline between anchor observations before fitting a full regression model.
Alternative Equation Forms
The same line is expressible in point-slope form (y - y1 = m(x - x1)) or standard form (Ax + By = C). Point-slope form avoids computing b explicitly and is faster when a known point and slope are already available. Standard form is preferred for systems of linear equations. All three are mathematically equivalent representations of the same geometric object.
Methodology sources: Khan Academy — Slope-Intercept Equation from Two Points and BYU-Idaho — How to Find the Equation of a Line from Two Points.
Reference