Curvingo · Made in India

Glossary

Select one of the keywords on the left…

Coordinate GeometryDistance Formula

Reading time: ~50 min

Aman lives in town A. His nani lives in town B, which is 36 km east and 15 km north of A. The bus follows the roads — 36 km east, then 15 km north, 51 km in all. Now the state wants to build a straight highway from A to B, across fields and over a river. How long will it be? Nobody is going to walk across with a measuring tape.

Let's warm up on a smaller map first. Town A sits at the origin and every square is 1 km.

Most spots for B give a highway with an awkward length like 2.24 km. A few give a whole number.

Drag town B and find three spots where the highway is exactly 5 km, 10 km and 13 km long — with B on neither axis.

The east road and the north road are the bus route; the highway cuts straight across.

Back to Aman's Highway

Every whole-number highway you found was the longest side of a right : the east road and the north road meet at right angles, so by the Pythagoras Theorem, \text{highway}^2 = \text{east}^2 + \text{north}^2.

The real towns work in the same way. In Fig. 7.1, the 36 km road east and the 15 km road north meet at a right angle, and the highway AB is the hypotenuse:

AB^2 = 36^2 + 15^2 = 1296 + 225 =

So AB = \sqrt{1521} = km — a full 12 km shorter than the bus ride, and found without measuring anything.

Points on the Axes

Start with the easiest case: two points on the same axis. Take A(4, 0) and B(6, 0) on the x-axis in Fig. 7.2. You can read off OA = 4 units and OB = 6 units, so the distance from A to B is AB = OB − OA = 6 − 4 = units.

The y-axis works the same way. For C(0, 3) and D(0, 8), CD = 8 − 3 = units.

Now a harder one: how far is A from C? They sit on different axes, so OA, OC and AC form a right triangle with its right angle at O. With OA = 4 and OC = 3, AC = \sqrt{3^2 + 4^2} = units. In the same way, BD = units.

Each distance you get right is drawn into the figure.

Building the Triangle Yourself

What if neither point lies on an axis? We can still use the theorem — we just have to build the right triangle ourselves.

In Fig. 7.3, P(4, 6) and Q(6, 8) both lie in the first quadrant. Drop perpendiculars PR and QS to the x-axis, and draw PT perpendicular to QS. Then R is (4, 0) and S is (6, 0), so RS = units. Also QS = 8 units and TS = PR = 6 units.

So the upright side QT = 8 − 6 = units, and the flat side PT = RS = 2 units.

Now Pythagoras in the right triangle PTQ:

PQ^2 = PT^2 + QT^2

= 2^2 + 2^2 =

So the slanting side PQ = \sqrt{8} = 2\sqrt{2} units.

Across the Quadrants

What about two points in different quadrants? Take P(6, 4) and Q(−5, −3), as in Fig. 7.4. Draw QS perpendicular to the x-axis, and draw PT from P perpendicular to QS extended; on its way, PT crosses the y-axis at R.

Then PT = units and QT = units.

Why? Across, P is 6 units to the right of the y-axis and Q is 5 units to the left of it, so PT = 6 + 5. Up, P is 4 units above the x-axis and Q is 3 units below it, so QT = 4 + 3.

Pythagoras in the right triangle PTQ gives

PQ = \sqrt{11^2 + 7^2} = units.

The Formula for Any Two Points

Now let's find the distance between any two points, P(x_1, y_1) and Q(x_2, y_2). Fig. 7.5 below is live. Wherever you put the points, the horizontal gap x_2 - x_1 and the vertical gap y_2 - y_1 make a right triangle, with PQ as its hypotenuse.

Drag P and Q (a press grabs whichever point is nearer) and complete all three missions.

Here is the same reasoning with letters instead of numbers. Draw PR and QS perpendicular to the x-axis, and PT perpendicular to QS. Then

OR = x_1, \; OS = x_2, so RS = x_2 - x_1 = PT

SQ = y_2, \; ST = PR = y_1, so QT = y_2 - y_1

Applying the Pythagoras theorem in \triangle PTQ,

PQ^2 = PT^2 + QT^2 =

A distance can never be negative, so we keep only the positive square root. The distance between P(x_1, y_1) and Q(x_2, y_2) is

PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

which is called the distance formula.

Why it works

There is nothing new to memorise here — the distance formula is the Pythagoras theorem in disguise. The horizontal gap and the vertical gap between two points are the two legs of a right triangle, and the straight-line distance is its hypotenuse. Square the two gaps, add, take the square root: that is just \text{leg}^2 + \text{leg}^2 = \text{hypotenuse}^2.

Two quick consequences are worth remembering.

Note

  1. The distance of a point P(x, y) from the origin O(0, 0) is OP = \sqrt{x^2 + y^2}.
  2. We can also write PQ = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}. (Why?)

Try the first one: the point (−6, 8) is units from the origin.

And the answer to "Why?": x_1 - x_2 is just the negative of x_2 - x_1, and a number and its negative have . So it never matters which point you subtract from which — the mission with Q to the left of P showed exactly this.

Example 1 : Do the points (3, 2), (–2, –3) and (2, 3) form a triangle? If so, name the type of triangle formed.

Solution : Call the points P(3, 2), Q(–2, –3) and R(2, 3), and find all three distances with the distance formula:

PQ = \sqrt{(3 + 2)^2 + (2 + 3)^2} = \sqrt{5^2 + 5^2} = \sqrt{50} = (approx.)

QR = \sqrt{(-2 - 2)^2 + (-3 - 3)^2} = \sqrt{(-4)^2 + (-6)^2} = \sqrt{52} = (approx.)

PR = \sqrt{(3 - 2)^2 + (2 - 3)^2} = \sqrt{1^2 + (-1)^2} = \sqrt{2} = (approx.)

Any two of these distances add up to more than the third, so P, Q and R form a .

Also PQ^2 + PR^2 = 50 + 2 = 52 = QR^2, so by the converse of the Pythagoras theorem, \angle P = 90^\circ. Therefore PQR is a triangle.

Example 2 : Show that the points (1, 7), (4, 2), (–1, –1) and (– 4, 4) are the vertices of a square.

Solution : Let A(1, 7), B(4, 2), C(–1, –1) and D(– 4, 4) be the given points. A quadrilateral is a square when all four sides are equal and both diagonals are equal too, so we find all six lengths:

AB = \sqrt{(1 - 4)^2 + (7 - 2)^2} = \sqrt{9 + 25} =

BC = \sqrt{(4 + 1)^2 + (2 + 1)^2} = \sqrt{25 + 9} =

CD = \sqrt{(-1 + 4)^2 + (-1 - 4)^2} = \sqrt{9 + 25} =

DA = \sqrt{(1 + 4)^2 + (7 - 4)^2} = \sqrt{25 + 9} =

AC = \sqrt{(1 + 1)^2 + (7 + 1)^2} = \sqrt{4 + 64} =

BD = \sqrt{(4 + 4)^2 + (2 - 4)^2} = \sqrt{64 + 4} =

So AB = BC = CD = DA and AC = BD: all four sides of the quadrilateral ABCD are equal, and so are its two diagonals. Therefore ABCD is a .

Alternative Solution : Find the four sides and just one diagonal, say AC, as above. Here AD^2 + DC^2 = 34 + 34 = 68 = AC^2, so by the converse of the Pythagoras theorem, \angle D = 90^\circ. A quadrilateral with four equal sides and one right angle is a square, so ABCD is a .

Example 3 : Fig. 7.6 shows the arrangement of desks in a classroom. Ashima, Bharti and Camella are seated at A(3, 1), B(6, 4) and C(8, 6) respectively. Do you think they are seated in a line? Give reasons for your answer.

Solution : Using the distance formula,

AB = \sqrt{(6 - 3)^2 + (4 - 1)^2} = \sqrt{9 + 9} = \sqrt{18} =

BC = \sqrt{(8 - 6)^2 + (6 - 4)^2} = \sqrt{4 + 4} = \sqrt{8} =

AC = \sqrt{(8 - 3)^2 + (6 - 1)^2} = \sqrt{25 + 25} = \sqrt{50} =

Since AB + BC = 3\sqrt{2} + 2\sqrt{2} = 5\sqrt{2} = AC, the points A, B and C are collinear: going from A to C through B is no longer than going straight. So the three girls are seated in a .

Example 4 : Find a relation between x and y such that the point (x , y) is equidistant from the points (7, 1) and (3, 5).

Riya lives at A(7, 1) and Aman at B(3, 5) on the town map. They want to meet at a chai stall that is exactly as far from Riya's house as from Aman's. Where could the stall be? Fig. 7.7 below is live.

Drag the purple point P and find three grid points that are equally far from A and B.

Your three points lie on one straight line, the purple line in Fig. 7.7. Let us find its equation.

Solution : Let P(x, y) be equidistant from A(7, 1) and B(3, 5). Then AP = BP, and so AP^2 = BP^2:

(x - 7)^2 + (y - 1)^2 = (x - 3)^2 + (y - 5)^2

x^2 - 14x + 49 + y^2 - 2y + 1 = x^2 - 6x + 9 + y^2 - 10y + 25

The x^2 and y^2 terms cancel, leaving -14x - 2y + 50 = -6x - 10y + 34, i.e. -8x + 8y = -16, i.e.

x - y =

which is the required relation.

Note

The graph of x - y = 2 is a — the purple line that your three points lit up in Fig. 7.7. You know from earlier classes that a point equally far from A and B lies on the perpendicular bisector of AB, so the graph of x - y = 2 is the perpendicular bisector of AB.

Example 5 : Find a point on the y-axis which is equidistant from the points A(6, 5) and B(– 4, 3).

Solution : Every point on the y-axis looks like (0, y), so let P(0, y) be equally far from A and B. Then PA^2 = PB^2:

(6 - 0)^2 + (5 - y)^2 = (-4 - 0)^2 + (3 - y)^2

i.e., 36 + 25 + y^2 - 10y = 16 + 9 + y^2 - 6y

i.e., 4y = 36

i.e., y =

So the required point is (0, 9).

Let's check the answer: AP = \sqrt{(6 - 0)^2 + (5 - 9)^2} = \sqrt{36 + 16} =

BP = \sqrt{(-4 - 0)^2 + (3 - 9)^2} = \sqrt{16 + 36} = ✓

Note

Using the remark in Example 4, (0, 9) is the point where the crosses the perpendicular bisector of AB.

Speed Round: How Far Apart?

No figure this time. Find the two gaps, square them, add, and take the square root — all in your head.

Get five right to move on.

Sina