# Distance Calculator

This calculator computes the distance between two points in a two- or three-dimensional space. To use the calculator, please provide the coordinates of two points and click the "Calculate" button.

## What is distance?

Distance is a measure of how far apart a set of objects or points are. In its everyday use, distance is measured in units of meters, miles, yards, and more. It is most commonly discussed in terms of distance traveled. Distance traveled is measured as the length of the complete path traveled. For example, referencing the figure below, John's house is 1 mile from his school.

If John were to travel directly to school, he would travel a distance of 1 mile. However, if John instead walks a half mile to school, then decides to travel an extra 0.5 miles to a park that is 0.3 miles from the school, the total distance that John traveled to get to school is 0.5 + 0.5 + 0.3 = 1.3 miles.

The concept of distance discussed above is not what this calculator measures. The distance that this calculator measures is the distance between points in a two- or three-dimensional Euclidean space, rather than the everyday concept of distance (which is measured differently). Euclidean distance is measured using the Cartesian coordinates of the points in a Euclidean space along with a formula based on the Pythagorean theorem.

## Distance formula for Euclidean space

The formula for calculating the distance between two points in a two-dimensional Euclidean space is as follows,

where d is distance, and x_{i} and y_{i} are the coordinates of the two points. The formula for calculating the distance between two points in a three-dimensional Euclidean space is similar, with the addition of the third dimension, z:

Using the formulas is relatively straightforward. Simply select which point will represent (x_{1}, y_{1}) for a distance in two-dimensional space, or (x_{1}, y_{1}, z_{1}) for a distance in three-dimensional space. The other point will be (x_{2}, y_{2}) and (x_{2}, y_{2}, z_{2}) respectively. For example, referencing the figure below, the distance between the two points can be calculated using the distance formula for a two-dimensional Euclidean space.

It does not matter which point is selected first, as long as we are consistent with the corresponding points. For this example, we will designate (1, 2) as (x_{1}, y_{1}) and (5, 4) as (x_{2}, y_{2}). Plugging this into the distance formula yields:

Using the distance formula for a three-dimensional Euclidean space involves the same process with the addition of the corresponding z-coordinates.