Analytic Geometry: Distance, Slope, and Midpoint
Place two points on a grid and geometry becomes algebra. Distance uses the Pythagorean theorem; slope is rise over run; midpoint averages coordinates.
Distance
d = √((x₂−x₁)² + (y₂−y₁)²). Order of points does not matter.
Slope and vertical lines
m = (y₂−y₁)/(x₂−x₁). When Δx = 0 the slope is undefined—a vertical line.