The distance formula and the Pythagorean theorem
Why the distance between two points is just the Pythagorean theorem in disguise, plus midpoint and slope worked through.
A right triangle hiding between two points
Drop two points onto a grid and draw the horizontal and vertical gaps between them, and you have quietly built a right triangle. The horizontal leg is the change in x, the vertical leg is the change in y, and the straight line joining the points is the hypotenuse. The Pythagorean theorem says the hypotenuse squared equals the sum of the squares of the legs, so the distance is the square root of the change in x squared plus the change in y squared. The distance formula is not a separate rule to memorize; it is that theorem written in coordinates.
Why squaring removes direction
It might seem to matter whether you go left or right, up or down, but the formula does not care. Squaring a difference always gives a non-negative result, so the change from 1 to 4 and the change from 4 to 1 both contribute 9 to the total. That is why distance and midpoint come out the same no matter which point you enter first. The only quantities that keep a sign are delta x and delta y themselves, which is why they can appear negative even when the distance never does.
Midpoint and slope from the same two points
The same pair of coordinates carries more than a length. Averaging the two x values and the two y values lands you exactly halfway along the segment, the midpoint, which is useful for finding centers or bisecting a line. Dividing the change in y by the change in x gives the slope, the steepness of the line through both points. When the two points share an x value the change in x is zero, the line stands straight up, and the slope is undefined rather than infinite, which is why this tool labels a vertical line that way.
A worked example end to end
Take the points (1, 2) and (4, 6). The change in x is 4 minus 1, which is 3, and the change in y is 6 minus 2, which is 4. Squaring and adding gives 9 plus 16, which is 25, and the square root of 25 is 5, a clean 3-4-5 triangle. The midpoint is the average of the coordinates, (2.5, 4), and the slope is 4 divided by 3, about 1.3333. Every value this calculator prints for that pair traces back through these three short steps.