Quick Answer
The distance between points (1, 2) and (4, 6) is sqrt((4-1)^2 + (6-2)^2) = sqrt(9 + 16) = sqrt(25) = 5.
Point 1
Point 2
Common Examples
| Input | Result |
|---|---|
| (1, 2) to (4, 6) | Distance: 5 |
| (0, 0) to (3, 4) | Distance: 5 |
| (-2, 3) to (1, 7) | Distance: 5 |
| (1, 2, 3) to (4, 6, 3) | Distance: 5 (3D) |
| (0, 0, 0) to (1, 2, 2) | Distance: 3 (3D) |
How It Works
The Distance Formula (2D)
The distance between two points (x1, y1) and (x2, y2) in a two-dimensional plane is:
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
This formula is derived from the Pythagorean theorem. The horizontal difference (x2 - x1) and vertical difference (y2 - y1) form the two legs of a right triangle, and the distance is the hypotenuse.
The Distance Formula (3D)
For three-dimensional space, with points (x1, y1, z1) and (x2, y2, z2):
d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
This is a natural extension of the 2D formula, adding the squared difference in the z-coordinate. It applies the Pythagorean theorem twice: once in the xy-plane and once along the z-axis.
Midpoint Formula
The midpoint between two points is the average of their coordinates:
2D midpoint: ((x1 + x2)/2, (y1 + y2)/2)
3D midpoint: ((x1 + x2)/2, (y1 + y2)/2, (z1 + z2)/2)
The midpoint lies exactly halfway between the two points along the straight line connecting them.
Worked Example
Find the distance between (1, 2) and (4, 6).
Compute the differences: x2 - x1 = 4 - 1 = 3 and y2 - y1 = 6 - 2 = 4.
Square each difference: 3^2 = 9 and 4^2 = 16.
Sum: 9 + 16 = 25. Take the square root: sqrt(25) = 5.
The distance is 5 units. The midpoint is ((1+4)/2, (2+6)/2) = (2.5, 4).
For a 3D example, the distance from (0, 0, 0) to (1, 2, 2) is sqrt(1 + 4 + 4) = sqrt(9) = 3.
CalculateY