Equation of a line
m = (y₂ − y₁) / (x₂ − x₁)
The slope-intercept equation y = mx + b from what you know: two points on the line, or the slope and one point. The tool returns the slope with its calculation (m = Δy / Δx), the y-intercept, the x-intercept (the root), the slope of a perpendicular, and can evaluate y at a chosen x. The vertical case is handled honestly: x = c, not a function, no infinite slope. Two coinciding points are refused with the reason: infinitely many lines pass through a point.
y = -0.5x + 3
- Calculation
- m = Δy / Δx = -3 / 6 = -0.5
- Calculation
- b = y₁ − m·x₁ = 3 − (-0.5) × 0 = 3
Graph
The equation of the line is y = -0.5x + 3.
The slope reads "when x increases by 1, y changes by m": m = 2 climbs two units per step, m = −0.5 drops half a unit. Two lines are parallel if and only if they share the same slope.
A perpendicular has slope −1/m: the product of the two slopes is −1. The rule does not apply to horizontal and vertical lines, perpendicular to each other without a product of slopes.
Scientific dossier
What the tool computes, what it assumes, where it stops being valid, and where its data comes from.
Method & formulasm = (y₂ − y₁) / (x₂ − x₁)
m = (y₂ − y₁) / (x₂ − x₁)
b = y₁ − m·x₁
root: x = −b / m
perpendicular: m⊥ = −1 / m
The slope first, from the increments; the y-intercept next, by making the line pass through one of the points. Either of the two: it is a free check, the result must be the same through the other point.
- Slope
- · the change in y when x increases by 1. Positive, the line climbs; negative, it drops; zero, it is horizontal.
- y-intercept
- · the y of the point where the line crosses the vertical axis, at x = 0.
- x-intercept (root)
- · the x where the line crosses the horizontal axis, at y = 0. It is the solution of mx + b = 0.
- Linear (affine) function
- · x ↦ mx + b. Proportional if b = 0: the line then passes through the origin and y is proportional to x.
Validity domainThe tool works in the usual Cartesian plane, with exact coordinates: it passes the line through the given points, with no fitting.
The tool works in the usual Cartesian plane, with exact coordinates: it passes the line through the given points, with no fitting. Two very close points give a slope highly sensitive to input rounding: at a spacing of 10⁻⁷, a hundredth of error on y moves the slope by several orders of magnitude. Measured points deserve a regression, not a line through two points.
The vertical caseTwo points with the same abscissa define a perfectly legitimate line, but its equation is x = c: at that abscissa, every y.
Two points with the same abscissa define a perfectly legitimate line, but its equation is x = c: at that abscissa, every y. It is not a function (one x, many y) and the slope formula would divide by zero. So the tool returns x = c and an absent slope, not an infinity: an infinite slope is not a number, and writing y = ∞·x + b means nothing.
Reading the resultParallels and perpendiculars are read on the slope: same slopes, parallel lines; product of slopes equal to −1, perpendicular.
Parallels and perpendiculars are read on the slope: same slopes, parallel lines; product of slopes equal to −1, perpendicular. The root serves in every threshold problem (when does the quantity reach zero?), and evaluation at a chosen x answers the most common interpolation question. To fit a line through noisy measured points, this is no longer the tool: that is linear regression.