Equation of a Line

Find a line equation through two distinct points, including vertical lines.

Inputs

Formula
m = (y₂ − y₁)/(x₂ − x₁); y = mx + b (or x = x₁ for a vertical line)
  • (x₁, y₁), (x₂, y₂) — two distinct points on the line
  • m — line slope (undefined for a vertical line)
  • b — y-intercept for a non-vertical line