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 P has coordinates (2;1)(2;1) and point Q has coordinates (2;2)(2;2). How far apart are points A and B? 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 R. 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
(10)The length of ABAB is the distance between the points A and B.
In order to generalise the idea, assume A is any point with coordinates (x1;y1)(x1;y1) and B 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 A and B 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
(11)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
(12)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
(13)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 P and Q with coordinates (2;1) and (2;2) is then found as follows. Let the coordinates of point P be (x1;y1)(x1;y1) and the coordinates of point Q 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
(14)