Distance Between 2 Points

Here is how to calculate the distance between two points when you know their coordinates:

graph 2 points

 

Let us call the two points A and B

 

graph 2 points

We can run lines down from A, and along from B, to make a Right Angled Triangle.

And with a little help from Pythagoras we know that:

a2 + b2 = c2

 

graph 2 points

Now label the coordinates of points A and B.

xA means the x-coordinate of point A
yA means the y-coordinate of point A

The horizontal distance a is (xA − xB)

The vertical distance b is (yA − yB)

 

Now we can solve for c (the distance between the points):

Start with:   c2 = a2 + b2
     
Put in the calculations for a and b:   c2 = (xA − xB)2 + (yA − yB)2
     
And the final result:   c = square root of [(xA-xB)^2+(yA-yB)^2]

Examples

Example 1

graph 2 points

 

Fill in the values:   c = square root of [(9-3)^2+(7-2)^2]
     
c = square root of [6^2+5^2] = square root of 61

Example 2

It doesn't matter what order the points are in, because squaring removes any negatives:

graph 2 points

 

Fill in the values:   c = square root of [(3-9)^2+(2-7)^2]
     
c = square root of [(-6)^2+(-5)^2] = square root of 61

Example 3

And here is another example with some negative coordinates ... it all still works:

graph 2 points

 

Fill in the values:   c = square root of [(-3-7)^2+(5-(-1))^2]
     
c = square root of [(-10)^2+(6)^2] = square root of 136

(Note √136 can be further simplified to 2√34 if you want)

Three or More Dimensions

It works perfectly well in 3 (or more dimensions) !

Square the difference for each axis, then sum them up and take the square root:

distance between (9,2,7) and (4,8,10) in 3d

The distance between the two points (9,2,7) and (4,8,10) is:

c = square root of [(9-4)^2+(2-8)^2+(7-10)^2]  square root of 70 = 8.37...