Allday Education

Distance in the Coordinate Plane

How far apart are two points on a graph? If they line up horizontally or vertically, you can simply count the units between them. When they don't line up, the segment connecting them is slanted — and the trick is to see that slanted segment as the hypotenuse of a right triangle.

Draw one leg going across and one leg going up, and the Pythagorean theorem a2+b2=c2a^2 + b^2 = c^2 hands you the distance. There is no new formula to learn — this is the same theorem you already know, pointed at the coordinate plane.

Build the right triangle

Start at one point and travel horizontally until you are directly below or above the other point, then travel vertically up to it. Those two paths are the legs of a right triangle, and the slanted segment between the original points is the hypotenuse.

The horizontal leg is the difference in the xx-coordinates, and the vertical leg is the difference in the yy-coordinates. In the figure, the legs are 44 and 33, so the distance is 42+32=25=5\sqrt{4^2 + 3^2} = \sqrt{25} = 5.

-11234567-11234567xy

The steps

Subtract the xx-coordinates to get the horizontal leg, and subtract the yy-coordinates to get the vertical leg. If a difference comes out negative, drop the sign — a leg is a length, and lengths are positive.

Then square both legs, add, and take the square root: the distance is c=a2+b2c = \sqrt{a^2 + b^2}, where aa and bb are the two legs.

Watch the negatives

Points with negative coordinates cause the most errors. The horizontal distance from x=3x = -3 to x=5x = 5 is 5(3)=85 - (-3) = 8, not 22 — subtracting a negative combines the distance on each side of zero. When in doubt, sketch the two points and count the units for each leg instead of relying on the arithmetic.

Worked examples

Example 1: two points given

What is the distance between the points (2,3)(2, 3) and (7,15)(7, 15)?

Horizontal leg72=57 - 2 = 5
Vertical leg153=1215 - 3 = 12
Pythagorean theorem52+122=c25^2 + 12^2 = c^2
Square and addc2=25+144=169c^2 = 25 + 144 = 169
Take the square rootc=13c = 13

Answer: 1313

Example 2: negative coordinates

What is the distance between the points (3,2)(-3, 2) and (5,17)(5, 17)?

Horizontal leg — subtracting a negative5(3)=85 - (-3) = 8
Vertical leg172=1517 - 2 = 15
Pythagorean theorem82+152=c28^2 + 15^2 = c^2
Square and addc2=64+225=289c^2 = 64 + 225 = 289
Take the square rootc=17c = 17

Answer: 1717

Example 3: a straight-line distance on a map

On a city map, each unit represents one block. Mia's house is at (1,4)(1, 4) and her school is at (7,12)(7, 12). How far is the school from her house in a straight line?

Horizontal leg71=67 - 1 = 6
Vertical leg124=812 - 4 = 8
Pythagorean theorem62+82=c26^2 + 8^2 = c^2
Square and addc2=36+64=100c^2 = 36 + 64 = 100
Take the square rootc=10c = 10

Answer: 1010 blocks

Try one yourself

246810-22468xy

Common questions

Is this the same as the distance formula?

Yes. The distance formula d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} is the Pythagorean theorem with the legs written as coordinate differences. If you can build the right triangle, you already know the formula.

What if the two points line up horizontally or vertically?

Then there is no triangle to build — the distance is just the difference of the coordinates that change. From (2,5)(2, 5) to (9,5)(9, 5) the distance is 92=79 - 2 = 7.

What if the distance isn't a whole number?

That happens often. If the legs are 22 and 44, then c2=4+16=20c^2 = 4 + 16 = 20, so the distance is 204.5\sqrt{20} \approx 4.5. Leave the answer as a square root unless the problem asks you to round.

Does it matter which point I start from?

No. Swapping the points flips the sign of each difference, and squaring removes the sign — so both orders give the same distance.

Want the video version?

Allday Everyday Math has video lessons, practice, and an AI tutor for every topic, Pre-Algebra through Algebra 2.

Try it for $1