Line slope: the formula behind ramps, roofs and road grade
Slope measures how steep a line is: how much it rises (or falls) for every unit it runs sideways. Give the formula two points and it hands back three numbers — slope, the angle in degrees, and the y-intercept — and all three describe the exact same line.
The method
From two points (x₁, y₁) and (x₂, y₂):
- Slope:
m = (y₂ − y₁) ÷ (x₂ − x₁)— rise divided by run. - Angle:
arctan(m), converted from radians to degrees. - Y-intercept:
y₁ − m × x₁— where the line would cross x = 0, even if neither of your two points is anywhere near there.
That's the whole tool. Everything below is just picking real (x, y) pairs.
A real example: a wheelchair ramp
Accessibility codes commonly cap ramp slope at 1-in-12 — 1 inch of rise for every 12 inches of run — though the exact limit depends on the code you're building to, so check the one that applies before pouring concrete. A ramp that rises 2 feet over a 24-foot run:
m = (2 − 0) ÷ (24 − 0) = 0.083333
That's exactly 1/12. In degrees, arctan(0.083333) × 180 ÷ π ≈ 4.763642° — a ramp at the accessibility limit is barely a 5° incline, which is part of why it needs 24 feet of run to gain 2 feet of height.
A second example: roof pitch
Roofers don't talk in degrees; they talk in "rise over 12" — how many inches a roof climbs for every 12 inches of horizontal run. A "6-in-12" roof rises 6 inches over a 12-inch run:
m = (6 − 0) ÷ (12 − 0) = 0.5, and arctan(0.5) × 180 ÷ π ≈ 26.565051°.
Same formula as the ramp, just a different pair of points — and it converts a carpentry unit (rise-per-12) directly into the angle a protractor would read on the actual roof.
When the line doesn't start at zero: the y-intercept
Both examples above happened to start at the origin, which made the y-intercept a trivial 0. It stops being trivial once your two points are somewhere else entirely. Say a road survey takes elevation readings at two stations: 100 feet of elevation at station 50, and 40 feet of elevation at station 250, all measured in feet along the road.
m = (40 − 100) ÷ (250 − 50) = −60 ÷ 200 = −0.3
The road drops 0.3 feet of elevation for every foot it runs — an angle of arctan(−0.3) × 180 ÷ π ≈ −16.699244°. The y-intercept extrapolates that same straight grade back to station 0, a point that was never actually surveyed: 100 − (−0.3 × 50) = 100 + 15 = 115 feet. If the road really is a straight grade between those two stations, station 0 sits at 115 feet — useful for filling in a point you didn't measure, as long as you remember it's an extrapolation, not a reading.
Why this is one formula, not three
Slope, angle and y-intercept aren't three separate facts about a line — they're three ways of describing the same two points. Once you have the slope, the angle is just trigonometry (arctan undoes tangent, the same way a square root undoes a square), and the y-intercept is just plugging one of your original points back into the line's own equation. Two points is always enough for all three.