What This Calculator Does
This tool computes the straight-line, or Euclidean, distance between two points on a two-dimensional Cartesian plane. Enter the coordinates of point 1 as (x1, y1) and point 2 as (x2, y2), and the calculator returns the distance as both an exact simplified radical (for example, \(2\sqrt{34}\)) and a decimal rounded to six places, along with the full step-by-step working.
How to Use It
Type each coordinate into its box. Values are unitless coordinates on the same plane, so no unit selection is needed. You can enter integers, decimals, negative numbers, and fractions. Simple fractions like 3/4 and mixed fractions like 2 1/2 are parsed to decimals automatically before the formula is applied. The order of the two points does not matter — squaring the differences removes any sign.
The Formula Explained
The distance formula is a direct application of the Pythagorean theorem. The horizontal change is \(dx = x_2 - x_1\) and the vertical change is \(dy = y_2 - y_1\). These form the two legs of a right triangle whose hypotenuse is the distance:
$$d = \sqrt{dx^2 + dy^2}$$
To express the answer exactly, let \(S = dx^2 + dy^2\). When \(S\) is a whole number we find the largest integer \(k\) whose square divides \(S\), write \(S = k^2 \cdot m\), and report \(d = k\sqrt{m}\). If \(m = 1\) the distance is the whole number \(k\) (a perfect square); if \(k = 1\) it stays as \(\sqrt{m}\).
Worked Example
For \((x_1, y_1) = (-2, 3)\) and \((x_2, y_2) = (4, -7)\): \(dx = 4 - (-2) = 6\) and \(dy = -7 - 3 = -10\). So $$S = 6^2 + (-10)^2 = 36 + 100 = 136.$$ Since \(136 = 4 \cdot 34\) and \(4 = 2^2\), we get \(k = 2\) and \(m = 34\), so the exact distance is \(2\sqrt{34} \approx 11.661904\).
FAQ
Does the order of points matter? No. The differences are squared, so swapping the two points gives the same distance.
What if both points are the same? The distance is simply 0, with no error.
Can I enter fractions? Yes — both simple fractions (3/4) and mixed fractions (2 1/2) are supported. When inputs are fractional and \(S\) is not a whole number, only the decimal value is shown.