Curious Jr By PW

Distance Formula in Maths - Derivation, Examples

Distance Formula in Maths explained with derivation, 2D & 3D examples, and ways to calculate distances between points and lines for easy understanding.
authorImageJiya Tyagi12 Sept, 2025

Share

Distance formula

Distance formula is an important topic in Mathematics used to find the distance between 2 points on a plane or in 3D. It is commonly used in geometry to measure points at straight line distance. The distance formula is based on Pythagoras' theorem, which allows for quick derivation and understanding. By using the coordinates of points, we can calculate distance in either 2D or 3D. We can also apply it in determining the distance between two lines. In this article, we will learn what the distance formula is, derive the distance formula, and solve a few simple distance formula examples.

What is Distance Formula?

The distance formula shows us how far apart two points are from one another, comprising a straight line distance. When one has coordinates, one can simply find distances in two-dimensional or three-dimensional space with one easy formula. 

  • In 2D, the distance between points A(x1, y1) and B(x2, y2) is:

d = √((x2 - x1)² + (y2 - y1)²)

  • In 3D, the distance between points A(x1, y1, z1) and B(x2, y2, z2) is:

d = √((x2 - x1)² + (y2 - y1)² + (z2 - z1)²)

Here, ddd represents the distance between the two points.

We also use the distance formula to find the distance between two lines if their equations are given.

Read more: Brackets in Maths

Derivation of Distance Formula

The derivation of the distance formula is based on Pythagoras' theorem. By creating a right triangle between the two points, knowing the horizontal and vertical differences lets us calculate the straight-line distance easily by using their differences in this formula. 

1. Take two points A(x1, y1) and B(x2, y2) on a plane.

2. Draw a right-angled triangle by drawing lines parallel to the axes from these points.

3. Horizontal side = |x2 - x1|

4. Vertical side = |y2 - y1|

5. According to the Pythagoras theorem:

   AB² = (x2 - x1)² + (y2 - y1)²

6. Taking the square root on both sides, we get:

   AB = √((x2 - x1)² + (y2 - y1)²)

This is the distance formula. Similarly, in 3D, we just add the z-coordinate difference squared.

Read more: Counting Numbers

Distance Between Two Points in 3D

In three-dimensional space, points have three coordinates. The three-dimensional distance formula allows students to calculate the straight-line distance between two points by considering the x, y, and z differences at the same time. It is an extension of the two-dimensional formula.

d = √((x2 - x1)² + (y2 - y1)² + (z2 - z1)²)

This formula calculates straight-line distance in 3D, useful for measuring distances between buildings, objects, or places in real life.

Distance Between Two Lines

The distance between two lines can also be calculated using formulas derived from the distance formula. Lines can be parallel or intersecting. Finding the distance between them is important in geometry. For parallel lines, the formula gives the perpendicular distance, helping students understand the spacing between lines clearly.

  • If lines are parallel, the distance is the perpendicular distance between them.

  • If lines are intersecting, the distance is zero because they meet at a point.

Read More: Binary to Octal Conversion

Distance Formula Examples

Examples help students practice and understand how the distance formula works. By solving real problems, students can easily calculate distances in 2D, 3D, and between lines, building confidence in geometry concepts. Let’s see some simple distance formula examples:

Example 1: Find the distance between points A(1, 2) and B(4, 6).

Solution: d = √((4 - 1)² + (6 - 2)²)  = √(3² + 4²)  = √(9 + 16)  = √25  = 5

So, the Distance between A and B is 5 units.

Example 2: Find the distance between points P(2, 3, 5) and Q(5, 7, 9) in 3D.

Solution: d = √((5 - 2)² + (7 - 3)² + (9 - 5)²) = √(3² + 4² + 4²)  = √(9 + 16 + 16)  = √41

Distance PQ = √41 units.

Example 3: Find the distance between two parallel lines y = 2x + 3 and y = 2x - 5.

Solution: Use the formula for the distance between two lines:

d = |c2 - c1| / √(1 + m²) 

Here, m = 2, c1 = 3, c2 = -5:

d = |-5 - 3| / √(1 + 2²)  = 8 / √5

Distance = 8 / √5 units.

These examples show how the distance formula works in 2D, 3D, and for lines.

Also Read: Numerator and Denominator

Make Your Child a Math Expert with CuriousJr’s Mental Maths Course

Give your child the confidence to solve maths quickly and accurately with CuriousJr Mental Maths Online Classes. These classes turn screen time into skill time through engaging practice, simple tricks, and fun activities that make learning enjoyable.

CuriousJr Mental Maths Classes help children strengthen calculation skills, improve accuracy, and build confidence step by step. With live sessions, dedicated mentors, regular practice, and progress tracking, every child receives the right support to grow at their own pace.

Parents stay connected through updates, while rewards and encouragement keep children motivated and excited to learn. Book a demo class today

Distance Formula FAQs

What is the distance formula used for?

It is used to find the distance between two points in 2D or 3D space.

How is the distance between two points in 3D calculated?

By using d = √((x2 - x1)² + (y2 - y1)² + (z2 - z1)²).

Can the distance formula be used for lines?

Yes, it helps find the distance between two parallel lines.

What is the derivation of the distance formula?

It comes from the Pythagoras theorem applied to a right-angled triangle formed between the points.

Are there examples to practice the distance formula?

Yes, students should try simple 2D and 3D points to become confident.
Curious Jr By PW

Curious Jr By PW

We understand that every student has different needs and capabilities, which is why we create such a wonderful and unique curriculum that is the best fit for every student.