Distance Formula: Finding the Distance Between Two Points

distance formula
The distance formula is an algebraic expression that gives the shortest distance between two points in a two-dimensional space. Dream01/Shutterstock/HowStuffWorks

You're sitting in math class trying to survive your latest pop quiz. Sweat trickles down your forehead as you read the prompt: "Find the distance between these points."

The distance formula you're looking for is fairly straightforward and has ties to one of the most useful and famous concepts in all of mathematics: the Pythagorean theorem.

What Is the Distance Formula?

The distance formula is an algebraic equation used to find the length of a line segment between two points on a graph, called the Cartesian coordinate system (also known as the point coordinate plane).

This two-dimensional plane is defined by two perpendicular axes (usually labeled the x-axis and the y-axis) that intersect at a central point called the origin. Here's how it's expressed:

In a two-dimensional space with two points P (x₁, y₁) and Q(x₂, y₂), the distance (d) between these two points is given by the formula: d = √ (x₂ - x₁)² + (y₂ - y₁)²

In a three-dimensional space with two points P(x₁, y₁, z₁) and Q(x₂, y₂, z₂), the distance (d) between these two points is given by the formula: d = √ (x₂ - x₁)² + (y₂ - y₁)² + (z₂ - z₁)²

Next up, we'll take a closer look at the point coordinate plane, which can help you find exact spots by their horizontal and vertical positions, essential for everything from math problems to GPS navigation.

Understanding the Point Coordinate Plane

When most people hear the word "graph," they're picturing a chart with two lines — one vertical, one horizontal — that intersect each other at a right angle.

The vertical line is called the y-axis, and its horizontal counterpart is the x-axis. Both lines work together to tell a story with data.

If you want to make sense of where one point rests on your graph, measure where it falls along the two dimensions (the x-axis and the y-axis). These are known as the point's coordinates.

You need to find the coordinates for the first point and the second point before you can calculate the distance between them. You'll use the distance formula to measure the straight line segment connecting the two points.

Now let's explore the blissful relationship between the Pythagorean theorem and the distance formula.

The Pythagorean Theorem and the Distance Formula

The Pythagorean theorem was named for the Greek philosopher Pythagoras, but over a millennium before his birth, the ancient Babylonians already understood the geometric principle that is now associated with his name.

In essence, the Pythagorean theorem tells us how to find the longest side of a triangle when we know the lengths of the other two sides, and the distance formula uses this idea to measure how far apart two points are on a graph by treating the points as if they're at the corners of a right triangle.

For those in need of a quick refresher, the Pythagorean theorem says: The area of the square built upon the hypotenuse of a right triangle is equal to the sum of the areas of the squares upon the remaining sides.

There are a few key points to understand here. A right triangle, or right-angled triangle, has one angle measuring 90 degrees, known as a right angle. The longest side of this triangle is termed the hypotenuse, which is located opposite the right angle.

As we all know, a triangle may have three sides, but a square has four. So, imagine taking the hypotenuse of a right triangle and turning it into one of the four lines of a brand-new square. Then, do the same thing to the other two sides in the original triangle. You'll end up with three individual squares.

According to the Pythagorean theorem, the square formed by the hypotenuse has an area equal to the sum of the areas of the squares formed by the other two sides. If the hypotenuse is labeled "c," and the other two sides are labeled "a" and "b," then we could express that idea like so:

Pythagoras theorem
The Pythagorean theorem says a2 + b2 = c2. The distance formula is derived by using the theorem. grebeshkovmaxim/Shutterstock

How to Find the Distance Between Two Points

The first point and second points on your graph will each have an x coordinate and a y coordinate. You can calculate the shortest distance between these two points by using the Euclidean distance formula, which is a Pythagorean theorem-related algebraic expression.

D = √(x₂ - x₁) ² + (y₂ - y₁)²

Here, D stands for "distance." As for x₂ and x₁, they refer to the x coordinates of Point 2 and Point 1, respectively. Same goes for y₂ and y₁, except those are the two y coordinates.

So, to calculate the distance, our first step is to subtract x₁ from x₂. Then we have to multiply the resulting number by itself (or, in other words, "square" that number).

After that, we must subtract y₁ from y₂ and then square the answer we get from doing so. This will leave us with two numbers we must add together.

Then, finally, take that number and find its square root. And that square root, ladies and gentlemen, is our distance.

Distance Formula Example

OK, so let's say Point A has an x coordinate of 2 and a y coordinate of 5 (2,5). Let us also assume that Point B's got an x coordinate of 9 and a y coordinate of 13 (9,13). Plug those values into the handy-dandy formula and you get this:

D = √(9-2)² + (13-5)²

What's 9 minus 2? Easy, 7. And 13 minus 5 is 8, of course.

Now we're left with this:

D = √7² + 8²

If you "square" 7 — as in, multiply the number by itself — you end up with 49. As for 8 squared that works out to 64. Let's plug those values into the equation, eh?

D = √49 + 64

Now we're cooking. Add 49 and 64, and you get 113.

D = √113

What's the square root of 113? The answer is 10.63, so therefore:

D = 10.63

Go forth and ace your next pop quiz!

This article was updated in conjunction with AI technology, then fact-checked and edited by a HowStuffWorks editor.

Now That's Interesting

Pythagoras was a vegetarian. As Tristam Stuart writes in his 2008 book, "The Bloodless Revolution: A Cultural History of Vegetarianism: From 1600 to Modern Times," the ancient Greek philosopher subscribed to "the notion that all living things are kindred, and the corollary that it was wrong to cause suffering to animals."

Original article: Distance Formula: Finding the Distance Between Two Points

Copyright © 2023 HowStuffWorks, a division of InfoSpace Holdings, LLC, a System1 Company