Measuring Distance

Part 6, Chapter 6: Distance, Angles, and the Pythagorean Theorem

Learning objectives

  • Compute the distance between two points on the number line using absolute value
  • Compute the distance between two points in the coordinate plane
  • State and apply the properties of distance: non-negativity, symmetry, and the triangle inequality

How far apart are two things? The question sounds trivial, but the moment you sharpen it, you discover that "distance" is the most-used operation in mathematics. Every theorem about circles, every notion of "close enough" in calculus, every Euclidean intuition rests on knowing how to measure the gap between two points. In this section we package that idea into a single formula that works on the number line and in the plane.

Distance on the number line

Two integers aa and bb live somewhere on the same horizontal line. To measure the gap between them, count the steps from one to the other. Stepping right or left should not change the count, only the magnitude matters. That is why we use absolute value:

d(a,b)=abd(a, b) = |a - b|

For example, d(3,5)=35=8=8d(-3, 5) = |-3 - 5| = |-8| = 8. The subtraction can be done in either order: ab=ba|a - b| = |b - a| because squaring (which absolute value secretly does) erases sign.

Distance in the plane, Pythagoras shows up

For points P=(x1,y1)P = (x_1, y_1) and Q=(x2,y2)Q = (x_2, y_2), the horizontal gap is x2x1x_2 - x_1 and the vertical gap is y2y1y_2 - y_1. These two gaps form the legs of a right triangle whose hypotenuse is the straight-line distance from PP to QQ. By the Pythagorean theorem:

d(P,Q)=sqrt(x2x1)2+(y2y1)2d(P, Q) = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Squaring inside the radical handles the sign issue automatically, we do not need to wrap the differences in absolute values, because (3)2=32=9(-3)^2 = 3^2 = 9. The order of PP and QQ does not matter.

Where this shows up
  • GPS Navigation: Your phone solves a distance-minimisation problem against four satellite signals to pin down your location; the triangle inequality is what bounds the worst-case error from each individual signal.
  • Robotics: A robot arm planning a collision-free path computes Euclidean distances between its end-effector and obstacles thousands of times per second; the symmetry of distance lets it cache one direction's measurement.
  • Genomics: Edit distance, how far apart two DNA sequences are, is a non-Euclidean distance metric, but it still satisfies the same three properties (non-negative, symmetric, triangle inequality).

Three properties every distance must satisfy

Mathematicians abstract this idea into a list of properties, called a metric. Any function dd that pairs two points with a number is a distance if it obeys:

1. Non-negativity. d(A,B)geq0d(A, B) \geq 0, with equality only when A=BA = B. A negative distance is meaningless.

2. Symmetry. d(A,B)=d(B,A)d(A, B) = d(B, A). Walking from AA to BB covers the same ground as walking back.

3. Triangle inequality. d(A,C)leqd(A,B)+d(B,C)d(A, C) \leq d(A, B) + d(B, C). The detour through BB is never shorter than the straight path. In Euclidean geometry, equality holds only when BB lies on the segment from AA to CC.

Try it

  • Place P=(P = (, )) and Q=(Q = (, )). Predict first: what is the distance from the origin to (3,4)(3, 4)? Place the points and confirm the readout shows 55 for the famous 3-4-5 triangle.
  • Now drag Q=(Q = (, )) with PP pinned at the origin. Notice the distance scales with the spread of the coordinates.
  • Place P=(P = (, )) and Q=(Q = (, )). Before placing them: the yy-coordinates match, so what should the distance be? Place the points and confirm x2x1=4|x_2 - x_1| = 4.

A trap to watch for

Beginners frequently write d(P,Q)=x2x1+y2y1d(P, Q) = |x_2 - x_1| + |y_2 - y_1|. This is wrong, the right-hand side is the so-called "taxicab" distance, the length of a path that goes right then up (like a New York taxi confined to a grid). The Euclidean distance is the diagonal, which is always shorter than the sum of the legs. Concretely: from (0,0)(0,0) to (3,4)(3, 4) the taxicab distance is 3+4=73 + 4 = 7, but the Euclidean distance is 55. The square root is what bends the legs into a hypotenuse.

What you now know

You can compute the distance between any two points on the line or in the plane, and you can recognise the three properties that distinguish a metric from an arbitrary numerical pairing. The next section uses these tools to talk about angles, the other half of Euclidean geometry, and Pythagoras' theorem itself takes centre stage one section after that.

Quick check

Mark section complete →

References

  • Lang, S. (1971). Basic Mathematics. Springer. Chapter 5, §1, the original motivation-first treatment of distance.
  • Euclid (c. 300 BCE). Elements, Book I, Propositions 47-48 (Heath translation, Dover, 1956). The geometric source of the distance formula via Pythagoras.
  • Coxeter, H. S. M. (1969). Introduction to Geometry, 2nd ed. Wiley. Chapter 1 develops Euclidean distance from synthetic axioms.
  • Stewart, J. (2015). Calculus, 8th ed. Cengage. Appendix B reviews distance and the algebra-geometry bridge that this section establishes.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.