Ekuation

application

Distance Formula Calculator

Calculate the distance between two points using d = \u221A((x\u2082\u2212x\u2081)\u00B2 + (y\u2082\u2212y\u2081)\u00B2). Based on the Pythagorean theorem applied to coordinate geometry.

Back to Pythagorean Theorem Calculator

Pythagorean Theorem Tips

Click to show tips

Try an Example

Pick a scenario to see how the calculator works, then adjust the values

Ladder Against Wall

A 10-foot ladder leans against a wall with the base 6 feet away. How high does it reach?

Key values: Leg a = 6 ft · Hypotenuse c = 10 ft · Solve for leg b

TV Screen Diagonal

Find the diagonal of a TV with a 16:9 aspect ratio (width 40", height 22.5").

Key values: Width = 40 in · Height = 22.5 in · Find diagonal

Classic 3-4-5 Triangle

Verify that sides 3, 4, and 5 form a right triangle (the most famous Pythagorean triple).

Key values: Sides: 3, 4, 5 · Right triangle · Primitive triple

Documentation

The Distance Formula

The distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) in the Cartesian plane is derived directly from the Pythagorean theorem:

d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Why It Works

Draw a right triangle with the two points as endpoints of the hypotenuse. The horizontal leg has length x2x1|x_2 - x_1| and the vertical leg has length y2y1|y_2 - y_1|. By the Pythagorean theorem, the hypotenuse (the distance) is (Δx)2+(Δy)2\sqrt{(\Delta x)^2 + (\Delta y)^2}.

Key insight: The distance formula is not a separate concept to memorize—it is the Pythagorean theorem applied to coordinates. Every distance calculation in coordinate geometry is a right triangle in disguise.


Extension to Three Dimensions

The same principle extends naturally to 3D by applying the Pythagorean theorem twice:

d=(x2x1)2+(y2y1)2+(z2z1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

First compute the distance in the xy-plane, then treat that result and the z-difference as legs of a second right triangle. This generalizes to any number of dimensions:

d=i=1n(piqi)2d = \sqrt{\sum_{i=1}^{n} (p_i - q_i)^2}

This n-dimensional version is called the Euclidean distance and is fundamental to machine learning, statistics, and physics.


Worked Examples

Example 1: Distance Between Two Cities on a Map

On a coordinate grid where 1 unit = 1 mile, City A is at (3, 7) and City B is at (11, 1).

d=(113)2+(17)2=64+36=100=10 milesd = \sqrt{(11-3)^2 + (1-7)^2} = \sqrt{64 + 36} = \sqrt{100} = 10 \text{ miles}

Example 2: Checking If a Point Lies on a Circle

Does the point (5, 12) lie on the circle centered at the origin with radius 13?

d=52+122=25+144=169=13d = \sqrt{5^2 + 12^2} = \sqrt{25 + 144} = \sqrt{169} = 13 \quad \checkmark

Yes—the distance from the origin equals the radius, so the point is on the circle. (This is also the Pythagorean triple (5, 12, 13)!)

Example 3: Midpoint Verification

The midpoint of two points should be equidistant from both. For (2, 4) and (8, 10), the midpoint is (5, 7). Verify:

d1=(52)2+(74)2=9+9=32d_1 = \sqrt{(5-2)^2 + (7-4)^2} = \sqrt{9+9} = 3\sqrt{2}
d2=(85)2+(107)2=9+9=32d_2 = \sqrt{(8-5)^2 + (10-7)^2} = \sqrt{9+9} = 3\sqrt{2} \quad \checkmark

Applications

  • Navigation: GPS distance calculations between waypoints
  • Computer graphics: Collision detection, path length, object proximity
  • Machine learning: k-Nearest Neighbors (kNN), clustering algorithms (k-means), and dimensionality reduction all use Euclidean distance
  • Physics: Calculating displacement, electric field strength (inverse-square law), and gravitational force

Frequently Asked Questions

What is the distance formula?

The distance formula d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} calculates the straight-line distance between two points in a coordinate plane. It is derived directly from the Pythagorean theorem by treating the horizontal and vertical displacements as the legs of a right triangle.

How is the distance formula related to the Pythagorean theorem?

The distance formula is the Pythagorean theorem applied to coordinates. The horizontal displacement x2x1|x_2 - x_1| and vertical displacement y2y1|y_2 - y_1| form the two legs of a right triangle, and the distance between the points is the hypotenuse.

Does the distance formula work in three dimensions?

Yes. In 3D, add the z-component: d=(x2x1)2+(y2y1)2+(z2z1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}. This generalizes to any number of dimensions as d=(squared differences)d = \sqrt{\sum (\text{squared differences})}, known as the Euclidean distance.

Can I use the distance formula to check if a point is on a circle?

Yes. A point (x,y)(x, y) lies on a circle centered at (h,k)(h, k) with radius rr if the distance from the point to the center equals rr. Calculate d=(xh)2+(yk)2d = \sqrt{(x - h)^2 + (y - k)^2} and check if d=rd = r.

What are common applications of the distance formula?

Common applications include GPS navigation between waypoints, collision detection in computer graphics, k-nearest neighbor algorithms in machine learning, calculating displacement in physics, and verifying geometric properties like midpoint equidistance.

Related application Variants

Explore more application options

More Math Calculators

Explore the category

Calculator Search

Search and find calculators