Math Lab

Distance Between Two Points

Coordinate Geometry · Class X

Drag two points A(x1,y1) and B(x2,y2) and watch the distance update.

1
type a value
-1010
2
type a value
-1010
4
type a value
-1010
6
type a value
-1010
Live values
  • Distance AB5
  • Slope of AB1.3333
  • Midpoint x2.5
  • Midpoint y4
xy
  • Line through A and B

Formulas in this lab

  • Distance AB
    (x2x1)2+(y2y1)2\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}
  • Slope of AB
    (y2y1)/(x2x1)(y_2-y_1)/(x_2-x_1)
  • Midpoint x
    (x1+x2)/2(x_1+x_2)/2
  • Midpoint y
    (y1+y2)/2(y_1+y_2)/2
Tip: The distance formula is just the Pythagorean theorem in disguise.

Frequently asked questions

What is the distance formula?

The distance between $A(x_1, y_1)$ and $B(x_2, y_2)$ is $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$. It is just Pythagoras applied to the right triangle formed by the two points and the horizontal and vertical gaps.

How do I use this lab?

Slide the four coordinates and the lab draws the segment AB and shows the distance live. Try $A(1, 2)$ and $B(4, 6)$ to see the classic 3-4-5 triangle producing distance 5.

Common mistake on this topic

Students forget to square the differences or forget the final square root. Order of subtraction does not matter since we square it, but always write the formula first to avoid sign mix-ups.

Where do we use distance in real life?

GPS apps compute the straight-line distance between two locations using the same formula (adapted for spheres). When two friends mark their houses on graph paper, the distance formula gives the bird's-eye gap between them.