how to find distance between two points
To find the distance between two points, you use the distance formula , which comes from the Pythagorean theorem.
Basic idea (2D)
If your two points are
A(x1,y1)A(x_1,y_1)A(x1,y1) and B(x2,y2)B(x_2,y_2)B(x2,y2), then the
distance between them is:
d=(x2−x1)2+(y2−y1)2d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}d=(x2−x1)2+(y2−y1)2
This is just a right triangle: one leg is the horizontal change (x2−x1)(x_2-x_1)(x2−x1), the other is the vertical change (y2−y1)(y_2-y_1)(y2−y1), and the distance is the hypotenuse.
Step‑by‑step recipe
- Write down the coordinates
- Point A: (x1,y1)(x_1,y_1)(x1,y1)
- Point B: (x2,y2)(x_2,y_2)(x2,y2)
- Find the differences
- Horizontal change: x2−x1x_2-x_1x2−x1
- Vertical change: y2−y1y_2-y_1y2−y1
- Square the differences
- (x2−x1)2(x_2-x_1)^2(x2−x1)2
- (y2−y1)2(y_2-y_1)^2(y2−y1)2
- Add them together
- (x2−x1)2+(y2−y1)2(x_2-x_1)^2+(y_2-y_1)^2(x2−x1)2+(y2−y1)2
- Take the square root
- d=(x2−x1)2+(y2−y1)2d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}d=(x2−x1)2+(y2−y1)2
Quick example
Find the distance between (3,4)(3,4)(3,4) and (4,3)(4,3)(4,3):
- x_1=3,\y_1=4
- x_2=4,\y_2=3
- x_2-x_1=4-3=1
- y_2-y_1=3-4=-1
- Square: 1^2=1,\(-1)^2=1
- Add: 1+1=2
- Distance: d=\sqrt{2}\approx 1.414
Special cases
- If both points are on a horizontal line (same y): distance is |x_2-x_1|.
- If both points are on a vertical line (same x): distance is |y_2-y_1|.
In 3D (if you ever need it)
For points A(x_1,y_1,z_1) and B(x_2,y_2,z_2), the distance is:
d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}
TL;DR:
Remember this one line and you’re set:
d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}