Distance Formula Calculator
Find the distance between two points in 2D or 3D with AI-powered step-by-step solutions
Drag & drop or click to add images or PDF
What is the Distance Formula?
The distance formula computes the straight-line distance between two points in coordinate space. It's a direct consequence of the Pythagorean theorem applied to the right triangle formed by the horizontal and vertical separation between the points.
2D form — for points and :
3D form — for points and :
-dimensional form (Euclidean distance):
This generalizes naturally to any number of dimensions, which is why it's the workhorse 'distance' notion in physics, statistics, and machine learning.
How to Use the Distance Formula
Step-by-Step
- Label the points and . Either assignment works — the formula is symmetric.
- Compute differences: , .
- Square them: and .
- Sum: .
- Take the square root: .
- Simplify the radical if possible (e.g., ).
Geometric Derivation
Draw a horizontal segment from to — length .
Draw a vertical segment from to — length .
The original segment is the hypotenuse of a right triangle with these two legs, so by the Pythagorean theorem:
Taking square roots gives the distance formula. The absolute values aren't needed because squaring removes the sign.
Related Formulas
- Midpoint: — the average of the coordinates.
- Slope: — uses the same differences as the distance formula.
- Distance from point to origin: (special case with ).
Manhattan / Taxicab Distance (For Comparison)
Note that the formula above is Euclidean distance. Manhattan distance measures travel on a grid (no diagonals). They are different metrics — make sure you know which one your problem wants.
Common Mistakes to Avoid
- Forgetting to square: . The squares (and the square root) are essential.
- Sign errors: , so subtraction order doesn't matter — but only because of the square. Don't drop the square because you 'see' the difference.
- Forgetting to take the square root: is , not . Many students stop one step early.
- Not simplifying the radical: . Leaving as is technically correct but usually marked down on exams.
- Mixing 2D and 3D: If your problem is in 3D, include the term. If 2D, don't invent a term.
Examples
Frequently Asked Questions
The Pythagorean theorem. The horizontal and vertical separations between two points form the legs of a right triangle, and the straight-line distance is the hypotenuse. Squaring, summing, and taking a square root is exactly the Pythagorean recipe.
No. The formula is symmetric because the differences are squared. (x₂ - x₁)² and (x₁ - x₂)² are equal, so you can label the points either way.
Just add a squared difference for each dimension: d = √(Σ(b_i - a_i)²). This is the Euclidean distance in n-dimensional space, used heavily in machine learning, statistics, and physics.
That's a different problem — use the point-to-line distance formula: d = |Ax₀ + By₀ + C| / √(A² + B²) for line Ax + By + C = 0 and point (x₀, y₀). The basic distance formula only handles point-to-point.
Related Solvers
Related Guides
Try AI-Math for Free
Get step-by-step solutions to any math problem. Upload a photo or type your question.
Start Solving