How to calculate straight line distance between two points

How to calculate straight line distance between two points

Updated December 15, 2020

By Nucreisha Langdon

Knowing how to calculate distance between two coordinates has many practical applications in science and construction. To find the distance between two points on a 2-dimensional grid, you need to know the x- and y-coordinates of each point. To find the distance between two points in 3-dimensional space, you need to know the z-coordinates of the points as well.

The distance formula is used to handle this job and is straightforward: Take the difference between the X-values and the difference between the Y-values, add the squares of these, and take the square root of the sum to find the straight-line distance, as in the distance between two points on Google maps over the ground rather than on a winding road or waterway.

    Calculate the positive difference between the x-coordinates and call this number X. The x-coordinates are the first numbers in each set of coordinates. For example, if the two points have coordinates (-3, 7) and (1, 2), then the difference between -3 and 1 is 4, and so X = 4.

    Calculate the positive difference between the y-coordinates and call this number Y. The y-coordinates are the second numbers in each set of coordinates. For example, if the two points have coordinates (-3, 7) and (1, 2), then the difference between 7 and 2 is 5, and so Y = 5.

    D^2=X^2+Y^2

    to find the squared distance between two points. For example, if X = 4 and Y = 5, then

    D^2=4^2+5^2=41

    Thus, the square of the distance between the coordinates is 41.

    Take the square root of D2 to find D, the actual distance between the two points. For example, if D2 = 41, then D = 6.403, and so the distance between (-3, 7) and (1, 2) is 6.403.

    Calculate the positive difference between the z-coordinates and call this number Z. The z-coordinates are the third numbers in each set of coordinates. For example, suppose two points in three-dimensional space have coordinates (-3, 7, 10) and (1, 2, 0). The difference between 10 and 0 is 10, and so Z = 10.

    D^2=X^2+Y^2+Z^2

    to find the squared distance between two points in three-dimensional space. For example, if X = 4, Y = 5, and Z = 10, then

    D^2=4^2+5^2+10^2=141

    Thus, the square of the distance between the coordinates is 141.

    Take the square root of D2 to find D, the actual distance between the two points. For example, if D2 = 141, then D = 11.874, and so the distance between (-3, 7, 10) and (1, 2, 0) is 11.87.

Calculate the distance between 2 points in 2 dimensional space.

Enter 2 sets of coordinates in the x y-plane of the 2 dimensional Cartesian coordinate system, (X1, Y1) and (X2, Y2), to get the distance formula calculation for the 2 points and calculate distance between the 2 points.

Accepts positive or negative integers and decimals. (6 and/or 6.5)

Distance Formula:

The distance between two points is the length of the path connecting them. The shortest path distance is a straight line. In a 2 dimensional plane, the distance between points (X1, Y1) and (X2, Y2) is given by the Pythagorean theorem:

\( d = \sqrt {(x_{2} - x_{1})^2 + (y_{2} - y_{1})^2} \)

Calculate Distance

To calculate the distance between 2 points, (X1, Y1) and (X2, Y2), for example, (5, 6) and (-7,11), we plug our values into the distance formula:

\( d = \sqrt {(-7 - 5)^2 + (11 - 6)^2} \)

combining terms inside parentheses we get:

\( d = \sqrt {(-12)^2 + (5)^2} \)

squaring both terms we get,

\( d = \sqrt {144 + 25} \)

adding the 2 results,

finally,

This tool enables you to calculate the straight line distance between two locations or two cities, "as the crow flies". As you can share your location, it will let you know easily how far you are in a straight line from any point of interest. Here are the steps to use it:

  1. Enter the address or the city of the first location.
  2. Enter the address or the city of the second location.
  3. Click on the "Calculate the distance" button.

How far is it? The result of the geodesic distance calculation is immediately displayed, along with a map showing the two points linked by a straight line.

Geodesic distance calculator

Our formula integrates the curve of the earth to calculate as best as possible the distance as the crow flies. It is extremely accurate, especially for shorter distances.

Click on the button to use your geolocation instead of manually entering an address.

* World Geodetic System 84 (WGS 84)

How to calculate straight line distance between two points
Allow or deny location access to proceed

Distance between two points is the length of the line segment that connects the two given points. Distance between two points in coordinate geometry can be calculated by finding the length of the line segment joining the given coordinates. Let us understand the formula to find the distance between two points in a two-dimensional and three-dimensional plane.

What is the Distance Between Two Points?

The distance between any two points is the length of the line segment joining the points. There is only one line passing through two points. So, the distance between two points can be calculated by finding the length of this line segment connecting the two points. For example, if A and B are two points and if \(\overline{AB}=10\) cm, it means that the distance between A and B is 10 cm.

How to calculate straight line distance between two points

The distance between two points is the length of the line segment joining them (but this CANNOT be the length of the curve joining them). Note that the distance between two points is always positive.

How to calculate straight line distance between two points

Distance Between Two Points Formula

The distance between two points using the given coordinates can be calculated by applying the distance formula. For any point given in the 2-D plane, we can apply the 2D distance formula or the Euclidean distance formula given as,

Formula for Distance Between Two Points:

The formula for the distance, \(d\), between two points whose coordinates are \((x_1, y_1)\) and \((x_2, y_2\)) is:

d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2]

This is called the Distance Formula.

To find the distance between two points given in 3-D plane, we can apply the 3D distance formula, given as,

d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2 + (\(z_2\) − \(z_1\))2]

Let's learn how to derive this formula next.

Derivation of Formula for Distance Between Two Points

To derive the formula to calculate the distance between two points in a two-dimensional plane, let us assume that there are two points with the coordinates given as, A(\(x_1, y_1\)) B(\(x_2, y_2\))

Next, we will assume that the line segment joining A and B is \(\overline{AB}=d\). Now, we will plot the given points on the coordinate plane and join them by a line.

How to calculate straight line distance between two points

Next, we will construct a right-angled triangle with \(\overline{AB}\) as the hypotenuse.

How to calculate straight line distance between two points

Applying Pythagoras theorem for the △ABC:

AB2 = AC2 + BC2

d2 = (\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2 (Values from the figure)

Here, the vertical distance between the given points is |\(y_2\) − \(y_1\)|.

The horizontal distance between the given points is |\(x_2\) − \(x_1\)|.

d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2] (Taking square root on both sides)

Thus, the distance formula to find the distance between two points is proved.

Note: In case the two points A and B are on the x-axis, i.e. the coordinates of A and B are (\(x_1\), 0) and (\(x_2\), 0) respectively, then the distance between two points AB = |\(x_2\) − \(x_1\)|.

Using similar steps and concept, we can also derive the formula to find the distance between two points given in the 3D plane.

How to Find Distance Between Two Points?

The distance between two points using the given coordinates can be calculated with the help of the following given steps:

  • Note down the coordinates of the two given points in the coordinate plane as, A(\(x_1, y_1\)) and B(\(x_2, y_2\)).
  • We can apply the distance formula to find the distance between the two points, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2]
  • Express the given answer in units.

Note: We can apply the 3D distance formula in case the two points are given in 3D plane, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2 + (\(z_2\) − \(z_1\))2]

Example: Find the distance between the two points with coordinates given as, A = (1, 2) and B = (1, 5).

Solution:

The distance between two points using coordinates can be given as, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2], where (\(x_1, y_1\)) and (\(x_2, y_2\)) are the coordinates of the two points.

⇒ d = √[(1 − 1)2 + (5 − 2)2]

⇒ d = 3 units

From the above example, we can also observe that when the x-coordinates of the given points are the same, we can find the distance between the two points by finding the difference between the y-coordinates.

Distance Between Two Points in Complex Plane

The distance between two points in a complex plane or two complex numbers z\(_1\) = a + ib and z\(_2\) = c + id in the complex plane is the distance between points (a, b) and (c, d), given as,

|z\(_1\) − z\(_2\)| = √[(a − c)2 + (b − d)2]

Related topics:

  • Euclidean Distance Formula
  • Geometry
  • x and y axis

Important Notes on distance between two points:

  • The distance, d, between two points whose coordinates are \((x_1, y_1)\) and \((x_2, y_2\)) is: d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2]
  • Distance of a point (a, b) from: (i) x - axis is |b|. (ii) y - axis is |a|.

    We have used the absolute value signs because distance can never be negative.

  1. Example 1: Find the distance between the two points (2, -6) and (7, 3)

    Solution:

    Let us assume the given points to be:

    \((x_1,y_1)\) = (2, -6)
    \((x_2, y_2)\) = (7,3)

    The formula to find the distance between two points is:

    d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2]
    d = √[(7−2)2 + (3−(−6))2]
    d = √(52 + 92) d = √(25 + 81)

    d = √106

Distance =√106

  • Example 2: Show that the points (2, -1), (0, 1) and (2, 3) are the vertices of a right-angled triangle.

    Solution:

    Let us assume the given points to be:

    A = (2, −1) B = (0, 1)

    C = (2, 3)

    We will find the distance between every two points using the distance formula.

    AB = √[(0−2)2 + (1−(−1))2]
    = √[(−2)2 + (2)2] = √(4 + 4)

    = √8

    BC = √[(2 − 0)2 + (3 − 1)2]
    = √[(2)2 + (2)2] = √(4 + 4)

    = √8

    CA = √[(2 − 2)2 + (3−(−1))2]
    = √(02 + 42) = √16

    = 4

    Now that we know the lengths of all three sides,

    AB2 + BC2 = CA2
    (√8)2 + (√8)2 = 42 8 + 8 = 16

    16 = 16

    Thus, A, B and C satisfy the Pythagoras theorem.

    So △ABC is a right-angled triangle.

    We can prove the same by marking all the coordinates on a graph:

    How to calculate straight line distance between two points

    Thus, the given points form a right-angled triangle.

  • Example 3: Find a point on the y-axis that is equidistant from the points (-1, 2) and (2, 3).

    Solution:

    We know that the x-coordinate of any point on the y-axis is 0.

    Hence, we assume the point that is equidistant from the given points to be (0, k). i.e.,

    Distance between (0, k) and (-1, 2) = Distance between (0, k) and (2, 3)

    √[(−1 − 0)2 + (2 − k)2] = √[(2 − 0)2 + (3 − k)2]

    Squaring on both sides,

    (−1 − 0)2 + (2 − k)2 = (2 − 0)2 + (3 − k)2
    1 + 4 + k2 − 4k = 4 + 9 + k2 − 6k 2k = 8

    k = 4

    Therefore, the required point is, (0, k) = (0, 4)

    ∴Required Point = (0, 4)

  • go to slidego to slidego to slide

    How to calculate straight line distance between two points

    Have questions on basic mathematical concepts?

    Become a problem-solving champ using logic, not rules. Learn the why behind math with our certified experts

    Book a Free Trial Class

    FAQs on Distance Between Two Points

    The distance between two points is defined as the length of the straight line connecting these points in the coordinate plane. This distance can never be negative, therefore we take the absolute value while finding the distance between two given points.

    How Do We Calculate the Distance Between Two points in 2D Plane?

    The distance between any two points given in two-dimensional plane can be calculated using their coordinates. Distance between two points A(\(x_1, y_1\)) and B(\(x_2, y_2\)) can be calculated as, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2].

    How to Find the Distance Between Two points in 3D Plane?

    To calculate the distance between two points in a three-dimensional plane, we can apply the 3D distance formula given as, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2 + (\(z_2\) − \(z_1\))2], where 'd' is the distance between the two points and (\(x_1, y_1, z_1\)), (\(x_2, y_2, z_2\)) are the coordinates of the two points.

    What is the Shortest Distance Between Two Points?

    The shortest distance between two points can be calculated by finding the length of the straight line connecting both the points. We can apply the distance formula to find this distance depending on the coordinates given in two or three-dimensional plane.

    How to Find the Distance Between Two Points Using Pythagorean Theorem?

    The distance between two points in the cartesian plane can be calculated by applying the Pythagorean theorem. We can form a right-angled triangle using the line joining the given two points as the hypotenuse. Here the perpendicular and base will be the lines parallel to x and y-axis with one end as one of the given points and the other end as their intersecting point. Using the Pythagoras' theorem, (hypotenuse)2 = (base)2 + (perpendicular)2, we can find the length of the hypotenuse with the help of the given coordinates of two points. This length is equal to the distance between two points.

    What is the Distance Formula to Find Distance Between Two Points in Coordinate Geometry?

    In coordinate geometry, the distance between two points formula is given as, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2], where, (\(x_1, y_1\)), (\(x_2, y_2\)) are the coordinates of the two points. We can apply another formula if the given points liw in 3D plane, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2 + (\(z_2\) − \(z_1\))2], where 'd' is the distance between the two points and (\(x_1, y_1, z_1\)), (\(x_2, y_2, z_2\)) are the coordinates of the two points.

    How to Derive the Formula to Find The Distance Between Two Points?

    We can apply the Pythagoras theorem to derive the distance between two points formula. We can take the line joining the two points as the hypotenuse of a right triangle formed in the cartesian plane. The length of the hypotenuse can be calculated using the Pythagorean theorem and the given coordinates of two points to derive the distance between two points formula.

    How to Find the Vertical Distance Between Two Points?

    The vertical distance between two points can be found by calculating the difference of the y coordinates of the two points, i.e., vertical distance between two points, \(d_y\) = \(y_2 - y_1\), where (\(x_1, y_1\)), (\(x_2, y_2\)) are the coordinates of the two points.

    What are Steps to Find Euclidean Distance Between Two Points?

    The Euclidean distance between two points can be calculated using the following steps,

    • Note the coordinates of both the given points as (\(x_1, y_1\)) and (\(x_2, y_2\)).
    • Apply the Euclidean distance formula, distance, d = √[(\(x_2\) − \(x_1\))2 + (\(y_2\) − \(y_1\))2]
    • Express the given answer in units.