Theory:

In a map where locations are represented in coordinates, the distance and the midpoint between two points A (x1,y1) and B (x2,y2) can be calculated with the following algebraic expressions.
\(Distance =\) (x2x1)2+(y2y1)2
 
\(Midpoint =\) (x1+x22,y1+y22)
Example:
Find the distance between two points \(A\) (\(-1\), \(3\)) and \(B\) (\(2\), \(-3\)), and it's midpoint.
 
8_1.png
 
Coordinate of \(A\) is given as (\(-1\),\(3\)); therefore, we understand that \(x1 = -1\) and \(y1 = 3\).
 
Similarly, the coordinate of \(B\) is given as (\(2\),\(-3\)); therefore, we understand that \(x2 = 2\) and \(y2 = -3\).
 
On substituting the coordinates in the given distance expression we get,
 
\(Distance =\) (2(1))2+((3)3)2
 
Hence, \(Distance =\) \(6.7082\) 
 
Similarly, on substituting the coordinates in the given midpoint expression, we get,
 
\(Midpoint =\) (1+22,3+(3)2)
 
Hence, \(Midpoint =\) (\(0.5\),\(0\))