Coordinate Geometry Toolkit, Explained

After reading this you can compute distance, midpoint, slope and a line equation from two points, measure the gap from a point to a line, find where two lines cross, and build the circle through any three points, all by hand and with the numbers checked.

Analytic geometry puts points on a grid and turns shapes into equations. Once a point is a pair (x, y), questions like "how far apart" or "where do these cross" become arithmetic. The Coordinate Geometry Toolkit runs the five most common of these calculations. This guide explains the formulas behind each one and shows you how to read the answer.

Here is the hook. Two points (1, 2) and (4, 6) sit three units apart horizontally and four vertically. The straight-line distance between them is exactly 5, because \sqrt{3^2 + 4^2} = 5. That 3-4-5 triangle is the whole subject in miniature: horizontal change, vertical change, and the diagonal that connects them.

What the toolkit computes

The tool has four modes. Each answers a different question about points and lines.

Two points
Given (x_1, y_1) and (x_2, y_2), it returns the distance, the midpoint, the slope, and the equation of the line through them.
Distance from point to line
Given a line as ax + by + c = 0 and a point (p_x, p_y), it returns the shortest (perpendicular) distance.
Intersection of two lines
Given two lines as ax + by = c, it returns the single crossing point, or tells you the lines are parallel.
Circle through three points
Given three points that are not collinear, it returns the center and radius of the unique circle passing through all three.

Notice the line format changes between modes. Point-to-line uses ax + by + c = 0, so the demo line a=1, b=1, c=-4 means x + y - 4 = 0. Intersection uses ax + by = c, so the same coefficients mean x + y = -4. Read the field help before you type.

When to use it, and when not

Reach for this tool when your data is already coordinates: points on a map, pixels on a screen, corners of a drawing, samples on a plane. Every result comes from the coordinates alone, with no angles or side lengths assumed.

If instead you know sides and angles of a triangle, use the Triangle Solver. For area, perimeter and centroid of a many-sided figure from its vertices, use the Polygon Area Calculator. If you already have a circle's radius and want arcs, sectors or chords, the Circle Calculator is the better fit. This toolkit builds the circle from three points; that other tool measures a circle you already have.

Three points define a circle only when they are not on the same straight line. If they are collinear, no finite circle passes through all three, and the tool cannot return a center. Nudge one point off the line and try again.

The formulas and why they work

Distance. The straight-line distance between two points is the Pythagorean theorem applied to the horizontal and vertical gaps.

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

Here x_2 - x_1 is the run and y_2 - y_1 is the rise. Squaring removes the sign, so the order of the points does not matter.

Midpoint. The midpoint is the average of the coordinates.

M = \left( \frac{x_1 + x_2}{2}, \; \frac{y_1 + y_2}{2} \right)

Slope. Slope is rise over run.

m = \frac{y_2 - y_1}{x_2 - x_1}

When x_2 = x_1 the run is zero and the slope is undefined; the line is vertical, written x = x_1.

Point to line. For a line ax + by + c = 0 and a point (p_x, p_y), the perpendicular distance is

d = \frac{|a p_x + b p_y + c|}{\sqrt{a^2 + b^2}}

The numerator measures how far the point sits from the line's equation being satisfied. The denominator scales that back to true distance, since (a, b) is the line's normal direction.

Intersection. For two lines a_1 x + b_1 y = c_1 and a_2 x + b_2 y = c_2, Cramer's rule gives the crossing point. Let D = a_1 b_2 - a_2 b_1. If D = 0 the lines are parallel. Otherwise

x = \frac{c_1 b_2 - c_2 b_1}{D}, \qquad y = \frac{a_1 c_2 - a_2 c_1}{D}

Worked example: the demo data

Two points (1, 2) and (4, 6)

Load the demo values x1=1, y1=2, x2=4, y2=6 and press Calculate. Here is every number.

  1. Run and rise: 4 - 1 = 3 and 6 - 2 = 4.
  2. Distance: \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5.
  3. Midpoint: \left( \frac{1 + 4}{2}, \frac{2 + 6}{2} \right) = (2.5, \; 4).
  4. Slope: m = \frac{4}{3} \approx 1.333.
  5. Line equation: start from y - 2 = \frac{4}{3}(x - 1), which simplifies to y = \frac{4}{3}x + \frac{2}{3}.

Check the line by putting the second point back in: \frac{4}{3}(4) + \frac{2}{3} = \frac{16}{3} + \frac{2}{3} = \frac{18}{3} = 6. It matches y_2 = 6.

The two input points, the midpoint at (2.5, 4) between them, and the line y = (4/3)x + 2/3 they define.

Try changing one point

Distance and slope both react to moving a single point, but in different ways. Drag one endpoint and watch how the diagonal length and the steepness respond.

Fix point A at (1, 2). Move point B around the plane. With B at (4, 6) the distance is 5 and the slope is 4/3. Slide B to (7, 2) and the distance grows to 6 while the slope drops to 0 (a flat line). Move B straight above A to (1, 8) and the slope becomes undefined (a vertical line) with distance 6.

Reading the other three modes

Distance from point to line. Use the point-line line x + y - 4 = 0 and the point (3, 5). Then |1(3) + 1(5) - 4| = |4| = 4 and \sqrt{1^2 + 1^2} = \sqrt{2} \approx 1.414, so the distance is \frac{4}{\sqrt{2}} = 2\sqrt{2} \approx 2.828. This is measured along the perpendicular, the shortest possible route to the line.

Intersection. Take x + y = -4 and x - y = 0. Here D = (1)(-1) - (1)(1) = -2, which is nonzero, so they cross. The formulas give x = \frac{(-4)(-1) - (0)(1)}{-2} = \frac{4}{-2} = -2 and y = \frac{(1)(0) - (1)(-4)}{-2} = \frac{4}{-2} = -2. The lines meet at (-2, -2), and indeed -2 + -2 = -4 and -2 - (-2) = 0.

Circle through three points. Take (0, 0), (4, 0) and (0, 4). The center is equidistant from all three, which lands it at (2, 2). The radius is the distance to any of them, \sqrt{2^2 + 2^2} = \sqrt{8} \approx 2.828.

Sample results by mode
ModeInputResult
Two points(1,2), (4,6)d = 5, mid = (2.5, 4), m = 1.333
Point to linex+y-4=0, (3,5)d = 2.828
Intersectionx+y=-4, x-y=0(-2, -2)
Circle(0,0),(4,0),(0,4)center (2, 2), r = 2.828

Common mistakes

Mixing the two line formats. The sign of c flips meaning between modes. In point-line, c=-4 gives x + y - 4 = 0, the line y = 4 - x. In intersection, c=-4 gives x + y = -4, the line y = -4 - x. Those are different lines.

Confusing perpendicular distance with vertical distance. The point-to-line result is measured straight across the line, not straight down. For x + y - 4 = 0 and (3, 5), the vertical drop to the line is 5 - (4 - 3) = 4, but the true perpendicular distance is only 2.828. The perpendicular is always the shorter one unless the line is horizontal.

To check any intersection, substitute the answer into both original equations. If both hold exactly, you have the right point. A tiny mismatch usually means a sign error in one coefficient.

Reversing rise and run in slope. Slope is rise over run, \frac{\Delta y}{\Delta x}, not the other way. For the demo, \frac{4}{3} \approx 1.333, not \frac{3}{4} = 0.75.

Related tools

Once you have coordinates and want to go further, several tools continue the work. The Right Triangle Calculator handles the 3-4-5 style triangles that distance produces. For angle and ratio work, use the Trigonometry Calculator. Regular shapes with equal sides are covered by the Regular Polygon Calculator, and volume questions move to the 3D Solid Geometry Calculator.

Frequently asked questions

Does the order of the two points change the distance?

No. Distance squares the differences, so (x_2 - x_1)^2 gives the same value as (x_1 - x_2)^2. Swapping (1,2) and (4,6) still yields 5. Slope keeps the same value too, since both the top and bottom flip sign and cancel.

What does the tool return when two lines are parallel?

It reports that there is no single intersection. Parallel lines give D = a_1 b_2 - a_2 b_1 = 0. For example x + y = 1 and 2x + 2y = 5 have D = (1)(2) - (2)(1) = 0, so they never cross.

Why can't three points in a line make a circle?

The center of a circle through three points is where the perpendicular bisectors of the segments meet. When the points are collinear those bisectors are parallel and never meet, so no finite center exists. The tool flags this instead of returning a huge or invalid radius.

Is the point-to-line distance ever negative?

No. The formula uses the absolute value of a p_x + b p_y + c, so the result is zero or positive. Zero means the point lies exactly on the line.

How do I get a line's equation from two points by hand?

Find the slope m, then use y - y_1 = m(x - x_1). For (1,2) and (4,6), m = \frac{4}{3}, giving y - 2 = \frac{4}{3}(x - 1), which simplifies to y = \frac{4}{3}x + \frac{2}{3}.