Distance Formula
The distance between (x₁,y₁) and (x₂,y₂) is d=√[(x₂−x₁)²+(y₂−y₁)²] — the Pythagorean theorem in coordinate form. Extends to 3D. Manhattan distance |Δx|+|Δy| measures grid steps.
Did our AI summary help? Let us know.
Euclidean distance is the straight-line "as the crow flies" distance. Manhattan distance equals the minimum grid steps (no diagonals). Distance formula generalizes to n dimensions: √(Σ Δxᵢ²).
Ready to run the numbers?
Why: Distance formula is the Pythagorean theorem applied to coordinates. Used in geometry, navigation, GIS, and machine learning (e.g., k-NN). Manhattan distance models city-block travel.
How: 2D: d=√[(x₂−x₁)²+(y₂−y₁)²]. 3D: add (z₂−z₁)². Manhattan: |x₂−x₁|+|y₂−y₁|. Midpoint: average of coordinates. Slope: (y₂−y₁)/(x₂−x₁) when x₁≠x₂.
Run the calculator when you are ready.
📍 Examples — Click to Load
📐 Calculation Steps
- Given: P₁(1, 2, 0) and P₂(4, 6, 0)
- Horizontal distance: Δx = x₂ − x₁ = 4 − 1 = 3
- Vertical distance: Δy = y₂ − y₁ = 6 − 2 = 4
- Depth: Δz = z₂ − z₁ = 0 − 0 = 0
- 2D Euclidean: d = √(Δx² + Δy²) = √(3² + 4²) = √25 = 5
- 3D Euclidean: d = √(Δx² + Δy² + Δz²) = 5
- Manhattan: |Δx| + |Δy| + |Δz| = 7
- Midpoint: (2.5, 4, 0)
- Slope: m = Δy/Δx = 4/3 = 1.3333
Distance Components (Δx, Δy, d)
Component Contributions to d²
For educational and informational purposes only. Verify with a qualified professional.
🧮 Fascinating Math Facts
Distance formula = Pythagorean theorem with legs Δx and Δy.
— Geometry
Manhattan: |3−1|+|4−2|=2+2=4 (grid steps).
— Example
📋 Key Takeaways
- • The distance formula d = √[(x₂−x₁)² + (y₂−y₁)²] is the Pythagorean theorem in coordinate form
- • Euclidean distance measures straight-line "as the crow flies" distance between two points
- • Manhattan distance |Δx| + |Δy| measures grid/city-block distance — useful in navigation
- • The midpoint is the average of coordinates: ((x₁+x₂)/2, (y₁+y₂)/2)
- • Slope m = Δy/Δx describes steepness; undefined for vertical lines
💡 Did You Know?
📖 How the Distance Formula Works
Plot two points (x₁,y₁) and (x₂,y₂). Draw a right triangle: the horizontal leg has length Δx = x₂−x₁, the vertical leg Δy = y₂−y₁. The hypotenuse is the straight-line distance. By the Pythagorean theorem: d² = Δx² + Δy², so d = √(Δx² + Δy²).
Example: (1,2) to (4,6)
Δx = 4−1 = 3, Δy = 6−2 = 4. So d = √(3² + 4²) = √25 = 5. This is the classic 3-4-5 right triangle!
3D Extension
For points in space, add the z-difference: d = √(Δx² + Δy² + Δz²). Same idea — diagonal of a 3D box.
🎯 Expert Tips
💡 Order Doesn't Matter
Distance from (1,2) to (4,6) equals (4,6) to (1,2). Squaring removes sign.
💡 Manhattan vs Euclidean
Manhattan ≥ Euclidean always. Use Manhattan for grid-based pathfinding.
💡 Vertical Lines
When Δx = 0, slope is undefined. Distance is simply |Δy|.
💡 Unit Consistency
Use same units for all coordinates. Miles, feet, or grid cells — stay consistent.
📊 Reference: Distance Metrics
| Metric | Formula (2D) | Use Case |
|---|---|---|
| Euclidean | √(Δx² + Δy²) | Straight-line, GPS, physics |
| Manhattan | |Δx| + |Δy| | Grid navigation, city blocks |
| Chebyshev | max(|Δx|, |Δy|) | King moves in chess |
❓ FAQ
What is the distance formula?
d = √[(x₂−x₁)² + (y₂−y₁)²]. It gives the straight-line distance between two points, derived from the Pythagorean theorem.
How does it relate to the Pythagorean theorem?
The horizontal and vertical differences form the legs of a right triangle. The distance is the hypotenuse: c² = a² + b².
What is Manhattan distance?
|Δx| + |Δy| — the sum of absolute differences. Like walking city blocks: only horizontal or vertical moves.
When is slope undefined?
When Δx = 0 (vertical line). You cannot divide by zero, so slope has no value.
How do I find 3D distance?
Add the z-term: d = √(Δx² + Δy² + Δz²). Same Pythagorean idea in three dimensions.
Can I use this for map distance?
For flat maps in the same units, yes. For Earth curvature, use the Haversine formula.
📐 Quick Reference
⚠️ Disclaimer: This calculator computes Euclidean and Manhattan distances in a flat coordinate system. For geographic distances on Earth, curvature matters — use specialized geodesic formulas. Educational use only.
Related Calculators
Midpoint Calculator
Find the midpoint between two points in 2D or 3D. Supports weighted midpoint (section formula for division in given ratio) and find endpoint from midpoint....
MathematicsAbsolute Value Equation Calculator
Solve absolute value equations and inequalities including |ax+b|=c, |ax+b|=|cx+d|, and |ax+b|≤c forms. Features solution verification, number line...
MathematicsAbsolute Value Inequalities Calculator
Solve absolute value inequalities |ax+b| < c, > c, ≤ c, ≥ c. Get solution intervals, interval notation, set builder notation, number line visualization...
MathematicsBessel Function Calculator
Calculate Bessel functions J_n(x), Y_n(x), I_n(x), and K_n(x) with series approximation. Supports first kind (J), second kind/Neumann (Y), and modified Bessel functions (I, K). Applications include vibrating drum modes, electromagnetic waveguides, heat conduction in cylinders, and Bessel filter design in signal processing. Uses the power series J_n(x) = Σ (-1)^m/(m!(m+n)!)·(x/2)^(2m+n). Includes convergence info, Bar chart comparing values at different x, Doughnut chart showing series term contributions, and educational content on Bessel's differential equation and cylindrical harmonics.
MathematicsBinomial Coefficient Calculator
Calculate binomial coefficients C(n,k) = n!/(k!(n-k)!) — the number of ways to choose k items from n without regard to order. Also known as n choose k or ⁿCₖ. Features Pascal's triangle row generation, factorial breakdown, Bar chart of full row C(n,0)..C(n,n), Doughnut chart showing k vs n−k. Applications: lottery (C(49,6)), poker hands (C(52,5)), committee selection, DNA combinations, binary strings. Educational content on combinatorics, binomial theorem (x+y)ⁿ expansion, and Pascal's identity.
MathematicsBox Method Calculator
Multiply polynomials visually using the box method (area model). Step-by-step solutions for binomials, trinomials, and factoring. Interactive grid...
Mathematics