Back to the on-screen lesson ·

Distance between two points

The Pythagorean theorem applied to coordinates.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

In this lesson you find the distance between two points on a coordinate grid. There is no new theorem: the change in $x$ and the change in $y$ are the two legs of a right triangle, and the distance is its hypotenuse. You will find distances in all four quadrants, estimate the ones that are not whole numbers, and use distances on maps and screens.

2. What you already know

You can plot a point such as $(-3, 5)$ on a coordinate grid, in any of the four quadrants. You can find the distance between two points on the same grid line by counting or subtracting, and you know that subtracting a negative number is adding: $4 - (-3) = 7$. From the last lesson you know the Pythagorean theorem, $a^{2} + b^{2} = c^{2}$, and how to take a square root. That is everything this lesson needs. The new step is seeing where the right triangle is when all you are given is two pairs of numbers, and reading its legs straight off them.

3. Words this lesson uses

TermWhat it means
CoordinatesThe pair $(x, y)$ that locates a point: $x$ across, $y$ up.
Horizontal distance (change in $x$)How far apart two points are across the grid: the difference of their $x$-coordinates.
Vertical distance (change in $y$)How far apart two points are up and down: the difference of their $y$-coordinates.
DistanceThe length of the straight segment joining two points. It is never negative.
Distance formula$d = \sqrt{(x_2 - x_1)^{2} + (y_2 - y_1)^{2}}$: the Pythagorean theorem written in coordinates.
Straight-line (as the crow flies) distanceThe distance measured directly, not along streets or grid lines.

4. A right triangle hiding between two points

Any two points that are not on the same grid line are the ends of the hypotenuse of a right triangle whose legs run along the grid. The horizontal leg is the change in $x$ and the vertical leg is the change in $y$. So the distance between the points comes from the Pythagorean theorem:

$$d^{2} = (\text{change in } x)^{2} + (\text{change in } y)^{2}.$$

For $(1, 2)$ and $(4, 6)$: the change in $x$ is $4 - 1 = 3$, the change in $y$ is $6 - 2 = 4$, and $d = \sqrt{9 + 16} = \sqrt{25} = 5$.

Written with letters for the points $(x_1, y_1)$ and $(x_2, y_2)$, this is the distance formula:

$$d = \sqrt{(x_2 - x_1)^{2} + (y_2 - y_1)^{2}}.$$

There is no new theorem here. The formula is the Pythagorean theorem with the legs read off the coordinates, which is why it is better to understand it than to memorize it: you can always rebuild it by drawing the triangle.

Another way: picture

Plot the two points and draw a line straight across from the lower one and straight down from the higher one. The two lines meet at a square corner. You now have a right triangle: count the squares along the bottom for one leg and up the side for the other. The slanted side, the one you cannot count, is the distance, and the theorem measures it for you.

Another way: story

In a city laid out in blocks, a taxi driving from one corner to another goes across and then up: that is the two legs added together. A bird flies straight over the buildings: that is the hypotenuse. The bird's trip is always shorter, unless the two corners are on the same street.

5. Finding the legs, and why the signs do not matter

The corner of the right triangle takes its $x$-coordinate from one point and its $y$-coordinate from the other. For $A(-3, 5)$ and $B(9, 0)$, the corner is $C(9, 5)$: go across from $A$ to $C$, then down to $B$.

The horizontal leg is $9 - (-3) = 12$ and the vertical leg is $5 - 0 = 5$. Take care with negative coordinates: $9 - (-3)$ is $9 + 3$, not $9 - 3$. Counting squares on the grid is a good check: from $-3$ to $0$ is $3$ squares, and from $0$ to $9$ is $9$ more.

What if you subtract the other way round, $-3 - 9 = -12$? A length cannot be negative, but it does not matter here, because the next step squares it: $(-12)^{2} = 144 = 12^{2}$. That is why the distance formula works whichever point you call the first one. You can take the points in any order, as long as you use the same order for $x$ and for $y$.

When the two points share an $x$-coordinate or a $y$-coordinate, one leg is $0$, the triangle flattens into a line, and the distance is just the other difference. The formula still works: $\sqrt{0^{2} + 7^{2}} = 7$.

6. Answers that are not whole numbers

Many distances are square roots of numbers that are not perfect squares. From $(0, 0)$ to $(2, 3)$ the distance is $\sqrt{4 + 9} = \sqrt{13}$.

To estimate it, find the perfect squares on either side: $9 < 13 < 16$, so $3 < \sqrt{13} < 4$. Since $13$ is closer to $16$ than to $9$, the root is a little closer to $4$; a calculator gives $\sqrt{13} \approx 3.61$.

Give the exact answer $\sqrt{13}$ when a question asks for an exact distance, and a rounded decimal when it asks for a measurement. Either way, the square root must be taken at the end, after adding: $\sqrt{4 + 9}$ is not $\sqrt{4} + \sqrt{9} = 5$.

7. Using distances to study a shape

Once you can measure any segment on the grid, you can measure a whole shape. Take the triangle with corners $A(1, 1)$, $B(7, 1)$ and $C(7, 9)$.

So the perimeter is $6 + 8 + 10 = 24$ units.

Distances also tell you what kind of shape you have. If two sides come out equal, the triangle is isosceles. If the squares of the two shorter sides add to the square of the longest, the converse of the Pythagorean theorem says there is a right angle, even when no side runs along a grid line. For $P(0, 0)$, $Q(3, 1)$ and $R(2, 4)$: $PQ^{2} = 9 + 1 = 10$, $QR^{2} = 1 + 9 = 10$ and $PR^{2} = 4 + 16 = 20$. Two sides are equal, and $10 + 10 = 20$, so $PQR$ is an isosceles right triangle with the right angle at $Q$.

Notice that the test used the squared distances and never needed a square root. Working with $d^{2}$ is often simpler, and it keeps the numbers exact.

8. The method, step by step, and how to check it

  1. Write down the two points and decide which is first. Any order works.
  2. Find the change in $x$: second $x$ minus first $x$. Watch the signs.
  3. Find the change in $y$: second $y$ minus first $y$.
  4. Square both changes. Any minus sign disappears here.
  5. Add the squares. This is $d^{2}$.
  6. Take the square root. Leave it exact or round it, as the question asks.

Why each move is allowed. The grid lines are perpendicular, so the horizontal and vertical legs meet at a right angle and the Pythagorean theorem applies. The legs' lengths are differences of coordinates because a coordinate is a distance from an axis. Squaring removes any sign, so the order of the points does not matter.

How to check. The distance must be at least as long as the longer leg, and no longer than the two legs added together (the walk around the corner). Sketch the points: a distance of $5$ between points that look about $10$ squares apart means an arithmetic slip. Finally, if the legs form a familiar triple such as $3, 4$ or $5, 12$, the answer should be $5$ or $13$.

9. In the world: as the crow flies

Maps on a phone often give two distances: the road distance and the straight-line distance. On a town map drawn on a grid with blocks $\frac{1}{10}$ of a mile long, a school at $(0, 0)$ and a library at $(9, 12)$ are $9 + 12 = 21$ blocks apart by road: $2.1$ miles. In a straight line they are $\sqrt{81 + 144} = \sqrt{225} = 15$ blocks: $1.5$ miles. The straight line saves $0.6$ miles, which is why a delivery drone, a helicopter or a bird has a shorter trip than a car.

Emergency planners use the same calculation to check whether a fire station can cover a neighborhood: they compare the straight-line distance with a limit, knowing that the road distance will be somewhat longer.

10. In the world: screens and games

A computer screen is a coordinate grid of pixels. A full HD screen is $1920$ pixels wide and $1080$ pixels tall, so from its bottom-left corner $(0, 0)$ to its top-right corner $(1920, 1080)$ is

$$\sqrt{1920^{2} + 1080^{2}} = \sqrt{3\,686\,400 + 1\,166\,400} = \sqrt{4\,852\,800} \approx 2203 \text{ pixels}.$$

Video games do this constantly. When a character at $(300, 200)$ checks whether an enemy at $(420, 250)$ is within $150$ pixels, the game works out $\sqrt{120^{2} + 50^{2}} = \sqrt{14\,400 + 2500} = \sqrt{16\,900} = 130$. That is less than $150$, so the enemy is in range. Many games skip the square root and compare $16\,900$ with $150^{2} = 22\,500$ instead, which gives the same answer faster.

11. In the world: a shortcut on a trail map

Park trail maps are often printed on a grid. Suppose a map uses one unit for $100$ feet, the trailhead is at $(-4, -2)$, and a lookout is at $(8, 3)$. The marked trail goes east along a stream and then north up a ridge, following the grid: $12 + 5 = 17$ units, or $1700$ feet. A straight route would be $\sqrt{12^{2} + 5^{2}} = \sqrt{169} = 13$ units, or $1300$ feet.

The straight route is $400$ feet shorter, but rangers ask hikers to stay on marked trails: cutting across damages plants and loosens soil, which washes away in the next storm. The calculation still helps a hiker plan, because it shows how far the lookout really is from the start.

12. Mistakes to watch for

Adding the legs. From $(0, 0)$ to $(3, 4)$ is not $3 + 4 = 7$. That is the walk around the corner; the straight line is $\sqrt{9 + 16} = 5$.

Sign slips with negatives. From $x = -2$ to $x = 5$ is $5 - (-2) = 7$, not $3$. Count squares if unsure.

Mixing the order. If you do second minus first for $x$, do second minus first for $y$ too. (Squaring rescues a sign, but mixing up which coordinates go together gives wrong legs.)

Subtracting an $x$ from a $y$. The horizontal leg uses only the $x$-coordinates and the vertical leg only the $y$-coordinates.

Square-rooting too early. $\sqrt{a^{2} + b^{2}}$ is not $a + b$. Add the squares first, then take one square root of the total.

13. Distance in the first quadrant

  1. Find the distance between $A(1, 2)$ and $B(4, 6)$. Locate the corner of the right triangle: $x$ from $B$, $y$ from $A$.

    $C(4, 2)$

    From $A$ go straight across to $C$, then straight up to $B$; the turn at $C$ is a right angle.

  2. Find the horizontal leg $AC$.

    $4 - 1 = 3$

    Along $AC$ only $x$ changes.

  3. Find the vertical leg $CB$.

    $6 - 2 = 4$

    Along $CB$ only $y$ changes.

  4. Square the legs and add.

    $AB^{2} = 3^{2} + 4^{2} = 9 + 16 = 25$

    $AB$ is the hypotenuse, so the Pythagorean theorem gives its square.

  5. Take the square root.

    $AB = \sqrt{25} = 5$

    A distance is positive. The legs are $3$ and $4$, so the triple $3, 4, 5$ confirms it.

14. Distance with negative coordinates

  1. Find the distance between $P(-3, 5)$ and $Q(9, 0)$. Subtract the $x$-coordinates.

    $9 - (-3)$

    The horizontal leg is the change in $x$.

  2. Simplify: subtracting a negative is adding.

    $9 + 3 = 12$

    From $-3$ to $0$ is $3$ steps and from $0$ to $9$ is $9$ more.

  3. Subtract the $y$-coordinates in the same order.

    $0 - 5 = -5$

    Second minus first, as for $x$. The minus sign only says $Q$ is lower than $P$.

  4. Square both changes.

    $12^{2} = 144, \qquad (-5)^{2} = 25$

    Squaring makes both positive, so the sign from the last step does no harm.

  5. Add the squares.

    $PQ^{2} = 144 + 25 = 169$

    $PQ$ is the hypotenuse of the right triangle.

  6. Take the square root and check.

    $PQ = \sqrt{169} = 13, \qquad 12 < 13 < 12 + 5$

    The distance is longer than the longer leg but shorter than the walk around the corner.

15. A distance that is not a whole number

  1. Find the distance between $M(-2, -1)$ and $N(3, 4)$. Find the change in $x$.

    $3 - (-2) = 5$

    Subtracting a negative is adding: $3 + 2$.

  2. Find the change in $y$.

    $4 - (-1) = 5$

    Again subtracting a negative: $4 + 1$.

  3. Square and add.

    $MN^{2} = 5^{2} + 5^{2} = 25 + 25 = 50$

    $MN$ is the hypotenuse of a right triangle with two legs of $5$.

  4. Write the exact distance.

    $MN = \sqrt{50}$

    $50$ is not a perfect square, so the exact answer stays a square root.

  5. Find the perfect squares on either side of $50$.

    $49 < 50 < 64 \quad\Rightarrow\quad 7 < \sqrt{50} < 8$

    $7^{2} = 49$ and $8^{2} = 64$, and square roots keep the same order.

  6. Estimate more closely.

    $\sqrt{50} \approx 7.07$

    $50$ is only $1$ more than $49$, so the root is only a little more than $7$. A calculator confirms it.

  7. Check against the legs.

    $5 < 7.07 < 5 + 5$

    The distance is longer than either leg and shorter than the two legs added, as it must be.

16. Your turn: find the distance between $(2, -3)$ and $(8, 5)$

  1. Find the change in $x$.

    $8 - 2 = 6$

    The horizontal leg.

  2. Find the change in $y$.

    $5 - (-3) = 8$

    The vertical leg; subtracting a negative is adding.

  3. Your turn: work this step out. Its working is at the end of the packet.

    Square and add.

  4. Your turn: work this step out. Its working is at the end of the packet.

    Take the square root.

17. Guided practice

Find the distance between $(-4, 4)$ and $(0, 4)$.

Answer:

18. Guided practice

Complete the worked solution to find the distance between $P(0, -6)$ and $Q(4, -3)$.

  1. Subtract the $x$-coordinates to get the horizontal leg.

    $4 - (0) = 4$

    The horizontal leg is the change in $x$.

  2. Subtract the $y$-coordinates to get the vertical leg.

    $-3 - (-6) = 3$

    The vertical leg is the change in $y$.

  3. Square both legs and add.

    $PQ^{2} = 4^{2} + 3^{2} = 16 + 9 =$ t

    $PQ$ is the hypotenuse of the right triangle.

  4. Take the square root.

    $PQ =$ d

    The distance is the positive number whose square is the total.

19. Guided practice

The segment from $A(2, 2)$ to $B(11, 8)$ is the hypotenuse of a right triangle whose legs follow the grid lines. How long is each leg?

Horizontal leg: h. Vertical leg: k.

20. Practice

Find the distance between the points $(-4, 0)$ and $(-1, 4)$.

Answer:

21. Practice

On a town map with one unit per yard, a rectangular park has corners at $(0, 0)$, $(120, 0)$, $(120, 160)$ and $(0, 160)$. A straight path runs from $(0, 0)$ to $(120, 160)$. How long is the path, in yards?

Answer:

22. Practice

Point $A$ is at $(2, -1)$. Point $B$ has $x$-coordinate $10$, lies above $A$, and is $10$ units from $A$. What is the $y$-coordinate of $B$?

Answer:

23. Somewhere new

On a map where one grid unit is one mile, a delivery drone's base is at $(0, 0)$ and a customer is at $(8, 6)$. On a full battery the drone can fly $11$ miles in a straight line. Can it reach the customer?

24. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

25. Test question

Find the distance between the points $(2, 2)$ and $(10, 8)$.

Answer:

26. What you can do now

You can find the distance between two points from their coordinates. Without looking: what right triangle are you using, and where are its two legs?

Working for the steps left to you

16. Your turn: find the distance between $(2, -3)$ and $(8, 5)$, step 3

$d^{2} = 6^{2} + 8^{2} = 36 + 64 = 100$

The distance is the hypotenuse.

16. Your turn: find the distance between $(2, -3)$ and $(8, 5)$, step 4

$d = \sqrt{100} = 10$

$10^{2} = 100$; the legs $6$ and $8$ are the triple $3, 4, 5$ doubled.