The distance between two points · Mathematics Class 9–10 | StemPy Lab
Course 6.2·Lesson 1 of 3
The distance between two points
The distance between two points comes from the Pythagoras theorem: square the horizontal and vertical steps, add them, and take the square root. From the origin it is the square root of x squared plus y squared.
about 25 min1 simulation2 practice questions
Lesson 1 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
A right triangle hides in every pair of points
Two points A(x1,y1) and B(x2,y2) are on a slant. How far apart are they?
Draw a horizontal line from A and a vertical line down from B. They meet at a right angle, and we have a right triangle with AB as the hypotenuse.
A slanted line from the point A with coordinates x one and y one to the point B with coordinates x two and y two. A dashed horizontal line from A has length x two minus x one. A dashed vertical line below B has length y two minus y one. Together with the slanted line, d, they make a right-angled triangle.
The horizontal side has length ∣x2−x1∣.
The vertical side has length ∣y2−y1∣.
By the Pythagoras theorem,
d2=(x2−x1)2+(y2−y1)2
The distance formula
d=(x2−x1)2+(y2−y1)2
You may choose either point as the first one. The squares make every number positive, so the answer is the same.
The distance from the origin
When one point is the origin (0,0), the formula is shorter:
d=x2+y2
Example: the point (3,4) is 9+16=25=5 units from the origin.
Worked example
Find the distance between A(1,2) and B(5,5).
The horizontal step: 5−1=4.
The vertical step: 5−2=3.
d=42+32=16+9=25=5 units.
This is the well-known 3,4,5 right triangle.
With negative coordinates. Find the distance between (−2,3) and (3,−9). The steps are 3−(−2)=5 and −9−3=−12. The sign does not matter, because we square it. d=25+144=169=13 units. This is the triple 5,12,13.
Make the two points share a y. The vertical step vanishes, and the distance is simply the horizontal step.
Using the formula
Equal distances. To show that a point is the same distance from two others, find the two distances and compare them. Compare the squares to avoid square roots.
Finding an unknown. If d is given, square both sides, solve for the unknown, and check every answer. A square can give two values.
Example. Finding an unknown. The distance between (2,−3) and (k,1) is 5. Find k.
(k−2)2+(1+3)2=25⇒(k−2)2=9⇒k−2=±3
So k=5 or k=−1. There are two such points, one on each side.
Example. A point on the x-axis, equally far from two points. Find the point (x,0) that is equidistant from (2,−5) and (−2,9).
(x−2)2+25=(x+2)2+81
Expanding: x2−4x+4+25=x2+4x+4+81. The x2 and 4 cancel, and −8x=56, so x=−7. The point is (−7,0).
Where is the formula used?
On a map with a grid, the distance between two towns follows from their coordinates. The satellite of a phone uses the same idea in three dimensions, to find how far you are from each satellite. A game uses it to find whether two objects are touching.
A common mistake
Do not add the coordinates. The distance between (1,2) and (4,6) is not(4+1)2+(6+2)2. We take the difference of the coordinates: 32+42=5 units.
Practise with new numbers
Try it in Python
This program finds the distance between two points.
Remember these
d=(x2−x1)2+(y2−y1)2, from the Pythagoras theorem.
The distance from the origin is x2+y2.
Take the difference of the coordinates, never the sum.
Compare squares to avoid square roots, and check the answers.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
What is the distance of (6,8) from the origin?
What is the distance between (2,3) and (2,9)?
For which numbers y is the point (0,y) at a distance of 5 units from the origin?
Is (1,5) closer to (0,0) or to (4,4)?
Enroll free in Distance, Midpoint and Section Formulas
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.