Analytic (Coordinate) Geometry

slope

Slope measures how steep a line is, and which way it tilts. Picture walking along a straight road on graph paper: for every step you take to the right, how much do you climb or descend? That single number — climb per step of rightward travel — is the slope. A gentle ramp has small slope; a steep stair has large slope; a flat floor has slope zero.

Formally, between two points (x_1, y_1) and (x_2, y_2) on the line, the slope m is the rise over the run: m = (y_2 - y_1)/(x_2 - x_1), the change in y divided by the change in x. A positive slope rises as you move right (uphill); a negative slope falls (downhill); a slope of 0 is a flat horizontal line. A vertical line has no run at all (x_2 - x_1 = 0), so you would be dividing by zero — its slope is undefined, not infinite, and you simply say the line is vertical. Crucially, for a straight line you get the same slope no matter which two points you pick; that constancy is exactly what makes the line straight.

Slope is the single most useful number about a line: it tells you instantly whether two lines are parallel (same slope) or perpendicular (slopes that multiply to -1), it is the heart of the slope-intercept equation y = m x + b, and it is the seed of the derivative in calculus, where slope becomes the steepness of a curve at an instant. Just remember rise-over-run, not run-over-rise — the order matters.

The line through (2, 1) and (6, 9) has slope m = (9 - 1)/(6 - 2) = 8/4 = 2: it rises 2 units for every 1 unit right. The line through (0, 5) and (4, 5) has slope (5 - 5)/(4 - 0) = 0 — perfectly flat. The line through (3, 1) and (3, 8) has run 0, so its slope is undefined: it is vertical.

Positive slope climbs, zero slope is flat, an undefined slope means vertical.

A vertical line's slope is undefined, not 'infinity' — there is no rise-over-run because the run is zero. Also keep the subtraction order consistent: top and bottom must use the same point first.

Also called
gradientrise over run梯度坡度