Understanding the distance between two points
Distance is one of the first things geometry teaches, and it stays useful long after school. Two points on a map, two positions on a screen, the start and end of a cut on a piece of timber — in each case the question is the same: how far apart are they, as the crow flies? The points (0, 0) and (3, 4) are 5 units apart, a result that feels almost too neat until you see why: the horizontal gap is 3, the vertical gap is 4, and those two gaps form the sides of a right-angled triangle whose hypotenuse is the distance.
Formula and method
Euclidean distance: (x₁, y₁) — the first point. (x₂, y₂) — the second point. d — the straight-line distance between them, in the same units as the coordinates. How it works. The difference in the x-coordinates is the horizontal leg of a right-angled triangle, and the difference in the y-coordinates is the vertical leg. The distance is the hypotenuse, so it follows directly from Pythagoras' theorem: the square of the hypotenuse equals the sum of the squares of the other two sides. Squaring each difference removes the sign, so it does not matter which point is called first — swapping the two points gives the same distance. The result is always zero or positive, and it is zero only when the two points are the same point. The units of the answer are the units of the coordinates: if the coordinates are in metres, the distance is in metres; if they are in pixels, the distance is in pixels. This is a distance in a flat plane. It does not account for the curvature of the Earth, so it is not the right tool for the distance between two places given by latitude and longitude.
Worked example
Example 1 — From (0, 0) to (3, 4) (the live-page example) The first point is (0, 0) and the second point is (3, 4). Horizontal gap: 3 − 0 = 3; vertical gap: 4 − 0 = 4 Squares: 3² = 9, 4² = 16; sum: 9 + 16 = 25 Distance: √25 = 5 The distance is 5 units. This is the classic 3-4-5 triangle: the two legs are 3 and 4, and the hypotenuse is exactly 5, with no rounding needed. It is a useful check case — if a calculator gives anything other than 5 for these points, something is wrong with the calculator, not the maths.