Pythagoras’ Theorem (Distance between 2 points)

Rohan das
4 min readJan 6, 2025

--

In one Dimension

Question: find distance between 2 points. Starting position is 1 and end position is 5.

Answer: Here the point A is starting so we start from A and if we take 1 step at a time how many steps we need to reach B the end point.
We need 4 steps right, so we need B-A steps hence distance between these 2 points is B-A which is 4.

And what if we need to go back to A, we again need 4 steps.

Hence, we can do A-B too the answer will remain same. This is because the distance has only magnitude not the direction.
so to find out distance between 2 points in 1 Dimension the formula is: |x1-x2| (proof of distance formula in 1D), here because of modulus give the positive value only.

In two Dimension

Question: find distance between 2 points. Starting position is (10,20) and the end position is (13,16).

Answer:
Here the point A is (10,20) and point B is (13,16).
we constructed two lines. Line a from A and line b from B so that a and b intersect and make a 90 degree angle on point C (10,16).

to find out length of a we considered 2 points on 1D plane. the points are 20 and 16.
using |x1-x2|
a = |20–16|
a = 4

Similarly,

using |x1-x2|
b = |10–13|
b = 3

Now, lets assume the length A to B as c. and a² + b² = c², now lets proof it.

So, putting the values in a² + b² = c²
42 + 32 = c²
16 + 9 = c²
25 = c2
c = √25
c = 5

Hence, the formula to find out distance between 2 points in 2D is: a² + b² = c² (proof of Pythagoras theorem), here a and b are 2 sides of right angle triangle which we construct by drawing lines from A and B intersect at c making 90 degree angle. and c is distance between A and B

or we can se here a = x1-x2 and b = y1-y2, so the formula can be:
c = √((x1−x2)²+(y1−y2)²) (proof of distance in 2D formula)

In three Dimension

Question: find out the distance between 2 points. Starting position is (10,20,30) and end position is (2,3,4)

Amswer: Here we have to find distance of AB, so we know AC which is z and for BC we have to use triangle BDC.

In triangle BDC
BD = x and DC = y
Bc = (x)²+(y)² (using Pythagoras)

Now moving on to triangle ABC

so in traingle ABC
BC = √((√((x)²+(y)²))²+(z)²) (using Pythagoras)
here inner square root is cancled by inner sqaure
BC = √((x)²+(y)²+(z)²)

Finding x,y,z:

x = |10–2| (using |x1-x2|)
x = 8

Similarly,

y = |20–3|
y = 17

z = |30–4|
z = 26

Now putting values of x,y,z in √((x)²+(y)²+(z)²)

BC = √((8)²+(17)²+(26)²)
BC = √(64+289+676)
BC = √1029
BC = 721

or we can say here a = x1-x2, b = y1-y2 and z = z1-z2, so the formula can be:
c = ((x1−x2)²+(y1−y2)²+(z1−z2)²) (proof of distance in 3D formula)

--

--

Rohan das
Rohan das

Written by Rohan das

Rohan Das on a data science journey. Through insightful blogs, he shares his experiences & knowledge. Join Rohan as he inspires fellow data science enthusiasts.

No responses yet