Coordinate Geometry • Topic 1 of 3

Distance Formula

What is the distance formula? The distance formula calculates the straight-line distance between any two points in a coordinate plane. If P($x_1$, $y_1$) and Q($x_2$, $y_2$) are two points, the distance PQ is given by:

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

This formula comes directly from the Pythagorean theorem. Drop a horizontal line from P and a vertical line from Q; they meet at a right angle at the point R$(x_2, y_1)$. The horizontal leg PR has length $|x_2-x_1|$ and the vertical leg QR has length $|y_2-y_1|$. Since PQ is the hypotenuse, $PQ^2=(x_2-x_1)^2+(y_2-y_1)^2$, and taking the positive square root gives the formula above. Because we square the differences, the order in which you subtract does not matter — $(x_2-x_1)^2=(x_1-x_2)^2$.

Distance of a point from the origin. The origin is O$(0,0)$, so the distance of any point P$(x,y)$ from the origin is the special case

$OP=\sqrt{(x-0)^2+(y-0)^2}=\sqrt{x^2+y^2}$.

Why the distance formula is so useful. Almost every "type of figure" question in coordinate geometry is solved by computing a few distances and comparing them. The table below lists what to check.

To prove the figure is a…Condition on side / diagonal lengths
Isosceles triangleExactly two sides equal
Equilateral triangleAll three sides equal
Right trianglePythagoras holds: (longest side)$^2$ = sum of squares of the other two
SquareAll four sides equal and both diagonals equal
RhombusAll four sides equal, but diagonals unequal
RectangleOpposite sides equal and both diagonals equal
ParallelogramOpposite sides equal (diagonals need not be equal)

Testing collinearity with distances. Three points A, B, C are collinear when one of the three distances equals the sum of the other two — for example AB + BC = AC means B lies between A and C on a straight line. If no such sum holds, the points form a genuine triangle.

Finding an unknown coordinate. When you are told a distance and one coordinate is unknown, set up the equation $\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}=d$, square both sides to clear the root, and solve. Squaring often gives a quadratic, so be ready for two answers — both may be valid points.

Key properties.

  • Distance is always non-negative; we keep only the positive square root.
  • Distance is symmetric: PQ = QP.
  • If the points share the same $y$ (a horizontal line), distance $=|x_2-x_1|$.
  • If the points share the same $x$ (a vertical line), distance $=|y_2-y_1|$.

Common mistakes to avoid.

  • Forgetting to square the differences, or forgetting the square root at the end.
  • Sign slips with negative coordinates: $(-2)-(3)=-5$, and $(-5)^2=25$ — keep the minus inside the bracket until you square.
  • Declaring a square too early — equal sides alone give a rhombus; you must also check the diagonals are equal.
  • For a right triangle, always square the largest side and test it against the sum of the other two squares.
Distance formula as the hypotenuse of a right triangle on a coordinate gridDistance = hypotenuse of a right trianglexyOA(2,3)B(5,7)R(5,3)|x₂−x₁| = 3|y₂−y₁| = 4AB = 5PQ = √[(x₂−x₁)²+(y₂−y₁)²]= √(3²+4²) = √25 = 5Distance of a point from the originDistance from the origin: OP = √(x²+y²)xyOP(4,3)x = 4y = 3OP = 5OP = √(4²+3²)= √25 = 5
1
Worked Example
Find the distance between the points A(2, 3) and B(5, 7).
Solution
  1. Step 1: Write $x_1=2,\ y_1=3,\ x_2=5,\ y_2=7$.
  2. Step 2: $x_2-x_1=5-2=3$ and $y_2-y_1=7-3=4$.
  3. Step 3: $AB=\sqrt{3^2+4^2}=\sqrt{9+16}=\sqrt{25}$.

Answer: $AB=5$ units

2
Worked Example
Find the distance of the point P(−6, 8) from the origin.
Solution
  1. Step 1: Distance from origin $=\sqrt{x^2+y^2}$.
  2. Step 2: Substitute $x=-6,\ y=8$: $OP=\sqrt{(-6)^2+8^2}=\sqrt{36+64}$.
  3. Step 3: $OP=\sqrt{100}=10$.

Answer: $OP=10$ units

3
Worked Example
Find the distance between A(−3, −2) and B(2, 10).
Solution
  1. Step 1: $x_2-x_1=2-(-3)=5$ and $y_2-y_1=10-(-2)=12$.
  2. Step 2: $AB=\sqrt{5^2+12^2}=\sqrt{25+144}=\sqrt{169}$.
  3. Step 3: $\sqrt{169}=13$.

Answer: $AB=13$ units

4
Worked Example
Show that the points A(7, 10), B(−2, 5) and C(3, −4) are the vertices of an isosceles right triangle.
Solution
  1. Step 1: $AB^2=(-2-7)^2+(5-10)^2=81+25=106$.
  2. Step 2: $BC^2=(3+2)^2+(-4-5)^2=25+81=106$.
  3. Step 3: $CA^2=(7-3)^2+(10+4)^2=16+196=212$.
  4. Step 4: $AB^2=BC^2$, so AB = BC — the triangle is isosceles.
  5. Step 5: $AB^2+BC^2=106+106=212=CA^2$, so by the converse of Pythagoras the angle at B is a right angle.

Answer: Isosceles right triangle (AB = BC, right angle at B)

5
Worked Example
Show that the points (1, 5), (2, 3) and (−2, −11) are NOT collinear.
Solution
  1. Step 1: Let A(1, 5), B(2, 3), C(−2, −11).
  2. Step 2: $AB=\sqrt{(2-1)^2+(3-5)^2}=\sqrt{1+4}=\sqrt5$.
  3. Step 3: $BC=\sqrt{(-2-2)^2+(-11-3)^2}=\sqrt{16+196}=\sqrt{212}$.
  4. Step 4: $AC=\sqrt{(-2-1)^2+(-11-5)^2}=\sqrt{9+256}=\sqrt{265}$.
  5. Step 5: $AB+BC=\sqrt5+\sqrt{212}\approx2.24+14.56=16.80$, while $AC\approx16.28$. No single distance equals the sum of the other two.

Answer: The points are not collinear (they form a triangle)

6
Worked Example
Find a point on the x-axis which is equidistant from A(5, 4) and B(−2, 3).
Solution
  1. Step 1: A point on the x-axis has the form P$(x, 0)$.
  2. Step 2: $PA^2=(x-5)^2+(0-4)^2=(x-5)^2+16$.
  3. Step 3: $PB^2=(x+2)^2+(0-3)^2=(x+2)^2+9$.
  4. Step 4: Set $PA^2=PB^2$: $(x-5)^2+16=(x+2)^2+9$.
  5. Step 5: Expand: $x^2-10x+25+16=x^2+4x+4+9$.
  6. Step 6: Cancel $x^2$: $-10x+41=4x+13\Rightarrow -14x=-28\Rightarrow x=2$.

Answer: P(2, 0)

7
Worked Example
Find the value of $y$ for which the distance between P(2, −3) and Q(10, $y$) is 10 units.
Solution
  1. Step 1: $PQ=\sqrt{(10-2)^2+(y+3)^2}=10$.
  2. Step 2: Square: $64+(y+3)^2=100$.
  3. Step 3: $(y+3)^2=36\Rightarrow y+3=\pm6$.
  4. Step 4: $y+3=6\Rightarrow y=3$, or $y+3=-6\Rightarrow y=-9$.

Answer: $y=3$ or $y=-9$

8
Worked Example
If the point P($x$, $y$) is equidistant from A(3, 6) and B(−3, 4), find a relation between $x$ and $y$.
Solution
  1. Step 1: $PA^2=PB^2$ since P is equidistant from A and B.
  2. Step 2: $(x-3)^2+(y-6)^2=(x+3)^2+(y-4)^2$.
  3. Step 3: Expand: $x^2-6x+9+y^2-12y+36=x^2+6x+9+y^2-8y+16$.
  4. Step 4: Cancel $x^2,y^2$ and the 9: $-6x-12y+36=6x-8y+16$.
  5. Step 5: $-12x-4y+20=0\Rightarrow 3x+y-5=0$.

Answer: $3x+y-5=0$

9
Worked Example
Show that the points A(1, 7), B(4, 2), C(−1, −1) and D(−4, 4) are the vertices of a square.
Solution
  1. Step 1: $AB=\sqrt{(4-1)^2+(2-7)^2}=\sqrt{9+25}=\sqrt{34}$.
  2. Step 2: $BC=\sqrt{(-1-4)^2+(-1-2)^2}=\sqrt{25+9}=\sqrt{34}$.
  3. Step 3: $CD=\sqrt{(-4+1)^2+(4+1)^2}=\sqrt{9+25}=\sqrt{34}$ and $DA=\sqrt{(1+4)^2+(7-4)^2}=\sqrt{25+9}=\sqrt{34}$.
  4. Step 4: All four sides equal $\sqrt{34}$.
  5. Step 5: Diagonals: $AC=\sqrt{(-1-1)^2+(-1-7)^2}=\sqrt{4+64}=\sqrt{68}$ and $BD=\sqrt{(-4-4)^2+(4-2)^2}=\sqrt{64+4}=\sqrt{68}$.
  6. Step 6: Both diagonals equal $\sqrt{68}$, so the equal-sided quadrilateral is a square.

Answer: ABCD is a square (sides $\sqrt{34}$, diagonals $\sqrt{68}$)

10
Worked Example
Show that A(−3, 2), B(−5, −5), C(2, −3) and D(4, 4) are the vertices of a rhombus, and check whether it is a square.
Solution
  1. Step 1: $AB=\sqrt{(-5+3)^2+(-5-2)^2}=\sqrt{4+49}=\sqrt{53}$.
  2. Step 2: $BC=\sqrt{(2+5)^2+(-3+5)^2}=\sqrt{49+4}=\sqrt{53}$.
  3. Step 3: $CD=\sqrt{(4-2)^2+(4+3)^2}=\sqrt{4+49}=\sqrt{53}$ and $DA=\sqrt{(-3-4)^2+(2-4)^2}=\sqrt{49+4}=\sqrt{53}$.
  4. Step 4: All four sides equal $\sqrt{53}$, so ABCD is a rhombus.
  5. Step 5: Diagonals: $AC=\sqrt{(2+3)^2+(-3-2)^2}=\sqrt{25+25}=\sqrt{50}$ and $BD=\sqrt{(4+5)^2+(4+5)^2}=\sqrt{81+81}=\sqrt{162}$.
  6. Step 6: The diagonals are unequal ($\sqrt{50}\ne\sqrt{162}$), so it is a rhombus but NOT a square.

Answer: Rhombus (all sides $\sqrt{53}$), not a square because diagonals differ

11
Worked Example
Find a point equidistant from the three points A(3, 0), B(−1, 0) and that also lies such that its distance from each equals 5 — actually, find the centre of the circle through A(6, −6), B(3, −7) and C(3, 3).
Solution
  1. Step 1: Let the centre be P$(x, y)$. Then $PA=PB=PC$.
  2. Step 2: From $PA^2=PB^2$: $(x-6)^2+(y+6)^2=(x-3)^2+(y+7)^2$.
  3. Step 3: Expand and cancel: $-12x+36+12y+36=-6x+9+14y+49$, giving $-6x-2y+14=0\Rightarrow 3x+y=7$.
  4. Step 4: From $PB^2=PC^2$: $(x-3)^2+(y+7)^2=(x-3)^2+(y-3)^2$, so $(y+7)^2=(y-3)^2$.
  5. Step 5: $14y+49=-6y+9\Rightarrow 20y=-40\Rightarrow y=-2$.
  6. Step 6: Substitute in $3x+y=7$: $3x-2=7\Rightarrow x=3$.

Answer: Centre P(3, −2)

12
Worked Example
Determine whether the points A(−2, −1), B(1, 0), C(4, 3) and D(1, 2) form a parallelogram.
Solution
  1. Step 1: $AB=\sqrt{(1+2)^2+(0+1)^2}=\sqrt{9+1}=\sqrt{10}$.
  2. Step 2: $CD=\sqrt{(1-4)^2+(2-3)^2}=\sqrt{9+1}=\sqrt{10}$, so AB = CD.
  3. Step 3: $BC=\sqrt{(4-1)^2+(3-0)^2}=\sqrt{9+9}=\sqrt{18}$ and $DA=\sqrt{(-2-1)^2+(-1-2)^2}=\sqrt{9+9}=\sqrt{18}$, so BC = DA.
  4. Step 4: Both pairs of opposite sides are equal.
  5. Step 5: Diagonals $AC=\sqrt{(4+2)^2+(3+1)^2}=\sqrt{36+16}=\sqrt{52}$ and $BD=\sqrt{(1-1)^2+(2-0)^2}=\sqrt{0+4}=2$; the diagonals are unequal, so it is a parallelogram (not a rectangle).

Answer: ABCD is a parallelogram

Key Points

  • Distance formula: $d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
  • Formula comes from the Pythagorean theorem
  • Distance is always a non-negative real number; PQ = QP
  • Distance from the origin: $d=\sqrt{x^2+y^2}$
  • Collinearity: one distance equals the sum of the other two
  • Square: all sides equal AND diagonals equal; rhombus: sides equal but diagonals unequal
  • Rectangle: opposite sides equal and diagonals equal; parallelogram: opposite sides equal
  • Right triangle: (longest side)$^2$ = sum of squares of the other two sides
  • Finding an unknown coordinate: square the distance equation — expect up to two answers
  • Points on the x-axis are $(x,0)$; on the y-axis are $(0,y)$
Tap an option to check your answer0 / 4
Q1.The distance between $(x_1,y_1)$ and $(x_2,y_2)$ is:
Explanation: Distance formula.
Q2.The distance between $(0,0)$ and $(3,4)$ is:
Explanation: $\sqrt{9+16}=5$.
Q3.The distance from the origin to $(a,b)$ is:
Explanation: Distance from origin.
Q4.The distance between $(1,2)$ and $(1,5)$ is:
Explanation: Only $y$ differs by $3$.