Frequently asked questions
How is the slope calculated? ▾
The slope is the change in y divided by the change in x: m = (y₂ − y₁) / (x₂ − x₁), often called rise over run. For the points (0, 0) and (2, 4) the slope is (4 − 0) / (2 − 0) = 2.
What happens with a vertical line? ▾
If both points have the same x-coordinate the run is zero, so the slope is undefined (you would be dividing by zero). The line is vertical and is written x = constant; it has no y-intercept.
How do I find the equation of the line? ▾
First compute the slope m, then the y-intercept b = y₁ − m·x₁. The line in slope-intercept form is y = mx + b. For (1, 1) and (3, 5): m = 2 and b = −1, so y = 2x − 1.
What are the distance and midpoint? ▾
The distance is the straight-line length between the two points, d = √((x₂ − x₁)² + (y₂ − y₁)²). The midpoint is the point exactly halfway between them, ((x₁ + x₂) / 2, (y₁ + y₂) / 2).