Coordinate Geometry
Coordinate geometry gives every point a numerical address, so shapes become equations and geometry problems become algebra you can solve.
Why Does This Exist?
Geometry draws; algebra computes. For centuries the two were separate skills, and a question like "where do these two paths cross?" meant careful drawing and hoping. Coordinate geometry fuses them: put the picture on a numbered grid, and every shape becomes an equation while every intersection becomes a system to solve.
ML lives inside this fusion. Datasets are clouds of coordinate points, decision boundaries are curves on the grid, and distances between points drive clustering and retrieval. This page is the overview: what coordinates buy you and which tools come with them. The pieces get full treatments in the Cartesian plane, distance and midpoint, equations of lines, and circles, ellipses, parabolas.
The one idea you need first
A coordinate is a number that locates a point along one axis. In two dimensions the pair is the point's address: walk along the horizontal, then up the vertical. The whole subject is consequences of that addressing scheme.
Think of It Like This
Street addresses for a meadow
Imagine a featureless meadow where people meet by description: "by the big oak, near the stream." Then someone lays out numbered streets both ways and every spot gets an address like "3rd and 4th." Meetings become exact, distances become subtraction, and "halfway between us" becomes averaging two numbers.
Coordinates are street addresses for the plane. The oak-and-stream descriptions are classical geometry: true but hard to compute with. The moment every point has numbers, shape questions turn into arithmetic, which is the only kind of question a computer welcomes.
How It Actually Works
The machinery has four moving parts, each a formula that converts between picture and number:
- Points locate. The plane splits into four quadrants by the signs of and .
- Slope measures a segment's steepness: rise over run.
- Midpoint averages the addresses to find the halfway point.
- Distance applies Pythagoras to the run and rise.
In plain words: slope compares vertical change to horizontal change; the midpoint is the average in each direction; distance is the straight-line gap via the same Pythagoras from trigonometry. Curves enter by the same trick: a circle is the set of points at fixed distance from a center, which the distance formula turns into an equation.
Worked example
Take and :
- Run: . Rise: . Slope .
- Midpoint: .
- Distance: .
A 3-4-5 triangle hiding in the coordinates, which is why the distance came out exact. Check the midpoint lies on the segment: slope from to is , matching. Same line, confirmed.
Watch Out For
Dividing by zero run on vertical segments
Slope needs run in the denominator, and a vertical segment has run zero. Code that computes slope for "every pair of points" crashes or returns inf the first time two points share an x-coordinate.
Branch on it: treat near-vertical pairs with a direction vector or angle instead of a slope, or use the general line form that never divides. If inf slopes appear in output, look for the vertical pair first.
Averaging coordinates that should not be averaged
Midpoints assume a flat plane where halfway in numbers means halfway in reality. On angles, latitudes, or curved surfaces the average of the coordinates is the wrong place: the average of and is by numbers but on the circle.
Average only plain spatial coordinates. For circular or geographic quantities, convert to vectors first, average those, and convert back.
The Quick Version
- Coordinates address every point with numbers, turning shapes into equations.
- Slope is rise over run; midpoint averages each coordinate; distance is Pythagoras on the gaps.
- and give slope , midpoint , distance .
- Vertical segments have undefined slope, so never divide blindly.
- Curves like circles are fixed-distance conditions written through the distance formula.
- Detail pages cover the plane, distance, lines, and conic curves separately.