Everything Student

Distance, Midpoint and Slope Calculator

From two points, find the distance between them (with its exact radical), the midpoint, the slope as a fraction and the equation of the line.

  • Math
  • Instant Results
  • Works Offline

Two points on a graph are enough to answer four common questions: how far apart they are, where the point halfway between them is, how steep the line through them is, and what that line’s equation is. Enter the points and this calculator answers all four, with exact fractions and radicals where your class expects them.

How to Use It

  1. Enter the first point as x₁ and y₁.
  2. Enter the second point as x₂ and y₂.
  3. Press Calculate to see the distance, the midpoint, the slope and the equation of the line.

How It Works

The run and rise are the changes in x and y. The distance comes from the Pythagorean theorem:

d=(x2−x1)2+(y2−y1)2d = \sqrt{(\vA{x_2 - x_1})^2 + (\vB{y_2 - y_1})^2}

The midpoint averages each coordinate:

M=(x1+x22,y1+y22)M = \left( \frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2} \right)

The slope is rise over run, and the line’s equation in slope-intercept form uses it:

m=y2−y1x2−x1y=mx+b,b=y1−mx1m = \frac{\vB{y_2 - y_1}}{\vA{x_2 - x_1}} \qquad y = mx + b, \quad b = y_1 - m x_1

When the run is 0, the line is vertical: its slope is undefined and its equation is x=x1x = x_1.

Worked Example

For (1, 2) and (5, 8), the run is 4 and the rise is 6.

d=42+62=52=213≈7.2111d = \sqrt{4^2 + 6^2} = \sqrt{52} = 2\sqrt{13} \approx 7.2111

The midpoint is (1+52,2+82)=(3,5)\left(\frac{1 + 5}{2}, \frac{2 + 8}{2}\right) = (3, 5) and the slope is 64=32\frac{6}{4} = \frac{3}{2}. Then b=2−32(1)=12b = 2 - \frac{3}{2}(1) = \frac{1}{2}, so the line is y=32x+12y = \frac{3}{2}x + \frac{1}{2}.

Tips and Common Mistakes

  • Subtract in the same order. Use y2−y1y_2 - y_1 over x2−x1x_2 - x_1, never y2−y1y_2 - y_1 over x1−x2x_1 - x_2.
  • Square before adding. In the distance formula, square each difference first; a negative difference squared is positive.
  • Rise goes on top. Slope is change in y over change in x, not the other way round.
  • Vertical and horizontal lines are special. Horizontal lines have slope 0 (y=by = b); vertical lines have no slope (x=ax = a).
  • Keep exact answers when asked. 2132\sqrt{13} and 32\frac{3}{2} are exact; 7.2111 and 1.5 are the same values as decimals.

Frequently Asked Questions

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²). It's the Pythagorean theorem: the run and rise are the legs of a right triangle, and the distance is the hypotenuse.

How do I find the midpoint?

Average the x-coordinates and average the y-coordinates: ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2).

How is slope calculated?

Rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). A positive slope goes up to the right, a negative one down, and 0 is flat.

Why is the slope undefined?

When both points have the same x, the line is vertical. The run is 0, and you can't divide by 0. Its equation is x = that value.

What does 2√13 mean?

The exact distance, simplified. √52 = √(4 × 13) = 2√13. It appears when the coordinates are whole numbers; the decimal is the same distance rounded.

Does the order of the points matter?

Not for the distance, midpoint, slope or equation. Swapping them only flips the signs of the rise and run.

Sources

Home