Find the slope and equation of a line through two points.
Slope is rise over run: the change in vertical distance divided by the change in horizontal distance. Between two points it is (y2 - y1) / (x2 - x1). A positive slope rises left to right, a negative one falls, a horizontal line has a slope of zero, and a vertical line has no defined slope because the run is zero and division by zero is undefined.
The same steepness gets written three different ways depending on the field, which causes a lot of confusion. As a ratio or decimal (0.25), as a percentage (25 per cent, which is the decimal times 100), or as an angle in degrees (about 14 degrees, the arctangent of the decimal). These are not interchangeable numbers: a 100 per cent slope is 45 degrees, not vertical. Construction and highway work usually use percentage or a ratio like 1 in 4; geometry and trigonometry use degrees.
Percentage is rise divided by run times 100. Angle is the arctangent of rise over run. They are not proportional: 100 per cent slope equals 45 degrees, and 50 per cent is about 26.6 degrees, not half of 45.
Because the run is zero and division by zero has no defined result. Saying the slope tends to infinity describes the behaviour as a line approaches vertical, but the vertical line itself simply has no slope value.
It rises one unit for every twenty travelled horizontally, which is 0.05 as a decimal, 5 per cent, or about 2.9 degrees. This ratio form is common in road, drainage and accessibility ramp specifications.
Parallel lines have identical slopes. Perpendicular lines have slopes that multiply to minus one, so each is the negative reciprocal of the other: a line of slope 2 is perpendicular to one of slope minus one half.