Academy
Formulas/maths/Straight Lines/Slope from Two Points

Slope from Two Points

Slope of the line passing through (x₁, y₁) and (x₂, y₂). Undefined when x₁ = x₂.
Derivation

Slope of a line

Let P(x1,y1)P(x_1, y_1) and Q(x2,y2)Q(x_2, y_2) be two distinct points on a line, with x1x2x_1 \neq x_2. Draw a right triangle by dropping a horizontal from PP and a vertical from QQ. The horizontal leg has length x2x1x_2 - x_1 and the vertical leg has length y2y1y_2 - y_1.

The angle θ\theta the line makes with the positive xx-axis satisfies:

tanθ=y2y1x2x1\tan\theta = \frac{y_2 - y_1}{x_2 - x_1}

This signed ratio is the slope.

Remember
The sign encodes direction: positive for rising lines, negative for falling.
m=y2y1x2x1\boxed{m = \frac{y_2 - y_1}{x_2 - x_1}}

The choice of points does not matter

Take any other two points A,BA, B on the same line. The triangles formed are similar (same angle θ\theta), so the ratios of vertical to horizontal legs are equal.

Remember
Slope is a property of the line, not of the pair of points chosen.

Vertical lines

When x1=x2x_1 = x_2, the horizontal leg is zero and the ratio is undefined.

Remember
Vertical lines have no slope.