One of the simplest things that can be done with analytical geometry is to calculate the distance between two points. Distance is a number that describes how far apart two point are. For example, point PP has coordinates (2,1)(2,1) and point QQ has coordinates (2,2)(2,2). How far apart are points PP and QQ? In the figure, this means how long is the dashed line?
In the figure, it can be seen that the length of the line PRPR is 3 units and the length of the line QRQR is four units. However, the ▵PQR▵PQR, has a right angle at RR. Therefore, the length of the side PQPQ can be obtained by using the Theorem of Pythagoras:
P
Q
2
=
P
R
2
+
Q
R
2
∴
P
Q
2
=
3
2
+
4
2
∴
P
Q
=
3
2
+
4
2
=
5
P
Q
2
=
P
R
2
+
Q
R
2
∴
P
Q
2
=
3
2
+
4
2
∴
P
Q
=
3
2
+
4
2
=
5
(12)The length of PQPQ is the distance between the points PP and QQ.
In order to generalise the idea, assume AA is any point with coordinates (x1;y1)(x1;y1) and BB is any other point with coordinates (x2;y2)(x2;y2).
The formula for calculating the distance between two points is derived as follows. The distance between the points AA and BB is the length of the line ABAB. According to the Theorem of Pythagoras, the length of ABAB is given by:
A
B
=
A
C
2
+
B
C
2
A
B
=
A
C
2
+
B
C
2
(13)However,
B
C
=
y
2

y
1
A
C
=
x
2

x
1
B
C
=
y
2

y
1
A
C
=
x
2

x
1
(14)Therefore,
A
B
=
A
C
2
+
B
C
2
=
(
x
1

x
2
)
2
+
(
y
1

y
2
)
2
A
B
=
A
C
2
+
B
C
2
=
(
x
1

x
2
)
2
+
(
y
1

y
2
)
2
(15)Therefore, for any two points, (x1;y1)(x1;y1) and (x2;y2)(x2;y2), the formula is:
Distance=(x1x2)2+(y1y2)2(x1x2)2+(y1y2)2
Using the formula, distance between the points PP and QQ with coordinates (2;1) and (2;2) is then found as follows. Let the coordinates of point PP be (x1;y1)(x1;y1) and the coordinates of point QQ be (x2;y2)(x2;y2). Then the distance is:
Distance
=
(
x
1

x
2
)
2
+
(
y
1

y
2
)
2
=
(
2

(

2
)
)
2
+
(
1

(

2
)
)
2
=
(
2
+
2
)
2
+
(
1
+
2
)
2
=
16
+
9
=
25
=
5
Distance
=
(
x
1

x
2
)
2
+
(
y
1

y
2
)
2
=
(
2

(

2
)
)
2
+
(
1

(

2
)
)
2
=
(
2
+
2
)
2
+
(
1
+
2
)
2
=
16
+
9
=
25
=
5
(16)The following video provides a summary of the distance formula.