Coordinate Geometry — Lines, Distances, Midpoints

⚡ Key Takeaways

Coordinate geometry translates geometric relationships into algebra using the Cartesian plane. The distance between two points is (x2−x1)2+(y2−y1)2\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}, their midpoint is the average of their coordinates, and straight lines are described by linear equations whose slope encodes direction. Applies wherever position, alignment, and separation must be computed exactly — navigation, computer graphics, physics, engineering. Founded by René Descartes and Pierre de Fermat in the 1630s.

💡 The Core Insight

Once you fix a coordinate system, every geometric relationship becomes an algebraic equation, and every algebraic equation describes a geometric shape. Distance is just the hypotenuse of a right triangle built from coordinate differences; a line's "steepness" is a single number (the slope); and parallelism, perpendicularity, and collinearity all reduce to simple arithmetic conditions on slopes and coordinates.

Formal Statement

DefinitionThe Cartesian Plane and a Point

The Cartesian plane is the set of all ordered pairs of real numbers (x,y)(x,y). Two perpendicular number lines — the xx-axis (horizontal) and yy-axis (vertical) — meet at the origin O=(0,0)O=(0,0). For a point P=(x1,y1)P=(x_1,y_1):

  • x1x_1 is the abscissa (signed horizontal distance from the yy-axis),
  • y1y_1 is the ordinate (signed vertical distance from the xx-axis).

The plane is divided into four quadrants, numbered I–IV counterclockwise from the upper right.

DefinitionDistance Between Two Points

For points P1=(x1,y1)P_1=(x_1,y_1) and P2=(x2,y2)P_2=(x_2,y_2), the distance dd between them is

1
d=(x2−x1)2+(y2−y1)2\quad d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}

Derivation hint: form a right triangle with legs ∣x2−x1∣|x_2-x_1| and ∣y2−y1∣|y_2-y_1|; apply the Pythagorean theorem to the hypotenuse P1P2‾\overline{P_1P_2}. Here d≥0d\ge 0 always, and d=0d=0 iff P1=P2P_1=P_2. The order of the points does not matter because the differences are squared.

DefinitionMidpoint of a Segment

The midpoint MM of the segment joining P1=(x1,y1)P_1=(x_1,y_1) and P2=(x2,y2)P_2=(x_2,y_2) is

2
M=(x1+x22, y1+y22)\quad M=\left(\frac{x_1+x_2}{2},\ \frac{y_1+y_2}{2}\right)

Derivation hint: the midpoint's coordinates are the arithmetic means of the endpoints' coordinates; equivalently, M=P1+12(P2−P1)M = P_1 + \tfrac12(P_2-P_1).

DefinitionSlope of a Line

The slope (gradient) mm of the line through P1=(x1,y1)P_1=(x_1,y_1) and P2=(x2,y2)P_2=(x_2,y_2), with x1≠x2x_1\ne x_2, is

3
m=y2−y1x2−x1=ΔyΔx\quad m=\frac{y_2-y_1}{x_2-x_1}=\frac{\Delta y}{\Delta x}

Derivation hint: slope is "rise over run" — the ratio of vertical change to horizontal change between any two points on the line. A vertical line (x1=x2x_1=x_2) has undefined slope. A horizontal line has slope 00.

DefinitionEquations of a Line

A non-vertical line may be written in several equivalent forms:

4
y−y1=m(x−x1)(point–slope form)\quad y - y_1 = m(x - x_1)\quad\text{(point–slope form)}

Derivation hint: rearrange the slope definition m=y−y1x−x1m=\frac{y-y_1}{x-x_1} for a general point (x,y)(x,y) on the line.

5
y=mx+b(slope–intercept form)\quad y = mx + b\quad\text{(slope–intercept form)}

Derivation hint: set x=0x=0 in [4] to identify bb as the yy-intercept; expand and collect terms.

6
Ax+By+C=0(general form, A,B not both 0)\quad Ax + By + C = 0\quad\text{(general form, }A,B\text{ not both }0)

Derivation hint: clear fractions and move all terms to one side; this form also handles vertical lines where B=0B=0.

TheoremParallel and Perpendicular Lines

Let two non-vertical lines have slopes m1m_1 and m2m_2. 1. They are parallel iff m1=m2m_1=m_2 (and they are distinct lines). 2. They are perpendicular iff

7
m1⋅m2=−1⟺m2=−1m1\quad m_1 \cdot m_2 = -1\quad\Longleftrightarrow\quad m_2=-\frac{1}{m_1}

Derivation hint: rotating a direction vector (1,m1)(1,m_1) by 90∘90^\circ gives (−m1,1)(-m_1,1), whose slope is −1/m1-1/m_1; the dot product of perpendicular direction vectors is zero.

TheoremDistance from a Point to a Line

The perpendicular distance from a point P0=(x0,y0)P_0=(x_0,y_0) to the line Ax+By+C=0Ax+By+C=0 is

8
d=∣Ax0+By0+C∣A2+B2\quad d=\frac{|Ax_0+By_0+C|}{\sqrt{A^2+B^2}}

Derivation hint: project the vector from any point on the line to P0P_0 onto the unit normal (A,B)A2+B2\frac{(A,B)}{\sqrt{A^2+B^2}}; the absolute value of that projection is the distance.

Why It Holds

ProofThe Distance Formula from the Pythagorean Theorem

1. Take points P1=(x1,y1)P_1=(x_1,y_1) and P2=(x2,y2)P_2=(x_2,y_2). 2. Construct a third point Q=(x2,y1)Q=(x_2,y_1) — directly below or above P2P_2 and level with P1P_1. This makes △P1QP2\triangle P_1QP_2 a right triangle with the right angle at QQ. 3. The horizontal leg P1Q‾\overline{P_1Q} has length ∣x2−x1∣|x_2-x_1| (same yy, differing xx). 4. The vertical leg QP2‾\overline{QP_2} has length ∣y2−y1∣|y_2-y_1| (same xx, differing yy). 5. By the Pythagorean theorem, the hypotenuse satisfies d2=∣x2−x1∣2+∣y2−y1∣2d^2=|x_2-x_1|^2+|y_2-y_1|^2. 6. Since ∣a∣2=a2|a|^2=a^2 for any real aa, this is d2=(x2−x1)2+(y2−y1)2d^2=(x_2-x_1)^2+(y_2-y_1)^2. 7. Taking the non-negative square root gives equation [1]. ■\blacksquare

∎
ProofThe Midpoint Formula

1. Let M=(xˉ,yˉ)M=(\bar x,\bar y) be the midpoint of P1P2‾\overline{P_1P_2}. 2. Because MM bisects the segment, the horizontal displacement from P1P_1 to MM equals that from MM to P2P_2: xˉ−x1=x2−xˉ\bar x - x_1 = x_2 - \bar x. 3. Solving: 2xˉ=x1+x22\bar x = x_1+x_2, so xˉ=x1+x22\bar x = \tfrac{x_1+x_2}{2}. 4. The identical argument on vertical displacements gives yˉ=y1+y22\bar y=\tfrac{y_1+y_2}{2}. 5. Hence M=(x1+x22,y1+y22)M=\left(\tfrac{x_1+x_2}{2},\tfrac{y_1+y_2}{2}\right), which is equation [2]. ■\blacksquare

∎
mathematician · René Descartes | 1596–1650

The French philosopher and mathematician René Descartes published La Géométrie in 1637 as an appendix to his Discours de la méthode. There he showed that geometric curves could be described by algebraic equations in two variables, unifying two fields the Greeks had kept apart. The modern "Cartesian" coordinate system bears his Latinized name (Cartesius). Working independently and slightly earlier, Pierre de Fermat developed equivalent ideas in an unpublished manuscript, Ad locos planos et solidos isagoge. Descartes' notation — using letters near the end of the alphabet (x,y,zx,y,z) for unknowns — survives essentially unchanged today.

Building Intuition

🧠 Intuition

Think of the plane as a city grid. Each point is an address: walk xx blocks east and yy blocks north from the central plaza (the origin).

  • The distance formula answers "how far apart are two addresses as the crow flies?" — not along the streets, but in a straight diagonal, which is why a right triangle and Pythagoras appear.
  • The midpoint is the meeting place exactly halfway between two friends: average where each one starts.
  • The slope is the grade of a hill: rise 3 metres over every 4 metres you walk forward and the slope is 3/43/4. A bigger slope means a steeper climb; a negative slope means you're descending.
  • Perpendicular slopes multiplying to −1-1 feels strange until you picture turning a corner: if a road climbs steeply, the road crossing it at a right angle must descend gently in the opposite sense — steep and shallow trade places, and the sign flips.
Figure
A segment from A(1,2)A(1,2) to B(7,6)B(7,6) with its midpoint MM, slope right triangle, and a perpendicular line through MM.
x y Δx = 6 Δy = 4 ⊥ slope −3/2 A(1,2) B(7,6) M(4,4)

Worked Examples

ExampleDistance, Midpoint, and Slope of a Segment

Given: A=(1,2)A=(1,2) and B=(7,6)B=(7,6) (coordinates in metres).

Find: the length of AB‾\overline{AB}, its midpoint, and its slope.

Step 1 — Distance, using [1]:

d=(7−1)2+(6−2)2=62+42=36+16=52=213.d=\sqrt{(7-1)^2+(6-2)^2}=\sqrt{6^2+4^2}=\sqrt{36+16}=\sqrt{52}=2\sqrt{13}.

Numerically 213≈7.212\sqrt{13}\approx 7.21 m.

Step 2 — Midpoint, using [2]:

M=(1+72,2+62)=(4,4).M=\left(\frac{1+7}{2},\frac{2+6}{2}\right)=(4,4).

Step 3 — Slope, using [3]:

m=6−27−1=46=23.m=\frac{6-2}{7-1}=\frac{4}{6}=\frac{2}{3}.
 d=213≈7.21 m,M=(4,4),m=23 \boxed{\,d=2\sqrt{13}\approx 7.21\text{ m},\quad M=(4,4),\quad m=\tfrac{2}{3}\,}
ExampleEquation of a Line and Distance from a Point

Given: the line ℓ\ell passing through A=(1,2)A=(1,2) with slope m=23m=\tfrac{2}{3}, and the external point P0=(6,1)P_0=(6,1).

Find: the equation of ℓ\ell in general form, and the perpendicular distance from P0P_0 to ℓ\ell.

Step 1 — Point–slope form, using [4]:

y−2=23(x−1).y-2=\tfrac{2}{3}(x-1).

Step 2 — Convert to general form [6]. Multiply by 3:

3y−6=2(x−1)=2x−2 ⟹ 2x−3y+4=0.3y-6=2(x-1)=2x-2\ \Longrightarrow\ 2x-3y+4=0.

So A=2, B=−3, C=4A=2,\ B=-3,\ C=4.

Step 3 — Distance from P0=(6,1)P_0=(6,1), using [8]:

d=∣2(6)−3(1)+4∣22+(−3)2=∣12−3+4∣13=1313=13.d=\frac{|2(6)-3(1)+4|}{\sqrt{2^2+(-3)^2}}=\frac{|12-3+4|}{\sqrt{13}}=\frac{13}{\sqrt{13}}=\sqrt{13}.

Numerically 13≈3.61\sqrt{13}\approx 3.61 units.

 ℓ: 2x−3y+4=0,d=13≈3.61 units \boxed{\,\ell:\ 2x-3y+4=0,\qquad d=\sqrt{13}\approx 3.61\text{ units}\,}

Common Misconceptions

⚠️ Common mistake

Sign and order errors are the most common mistakes.

  • In the distance formula, the differences are squared, so order does not matter — but students sometimes forget to square, or take ∣x2−x1∣⋅∣y2−y1∣|x_2-x_1|\cdot|y_2-y_1| instead of the sum of squares.
  • The midpoint uses addition then division by 2, not subtraction. (x1−x22,…)\left(\tfrac{x_1-x_2}{2},\ldots\right) is wrong.
  • For slope, subtract the coordinates in the same order in numerator and denominator: y2−y1x2−x1\frac{y_2-y_1}{x_2-x_1}, never y2−y1x1−x2\frac{y_2-y_1}{x_1-x_2}.
  • A vertical line has undefined slope, not "infinite" or "zero" slope. Treat it separately as x=constantx=\text{constant}.
  • In equation [8], the numerator must use Ax0+By0+CAx_0+By_0+C with the line written as =0=0. If you start from y=mx+by=mx+b, rewrite it first.
Counterexample

Claim (false): "If two lines have slopes whose product is negative, they are perpendicular." Consider ℓ1\ell_1 with slope m1=2m_1=2 and ℓ2\ell_2 with slope m2=−1m_2=-1. Their product is 2⋅(−1)=−22\cdot(-1)=-2, which is negative. But for perpendicularity we need the product to equal exactly −1-1, by equation [7]. Here −2≠−1-2\ne -1, so the lines meet at an angle that is not 90∘90^\circ. (The actual angle θ\theta satisfies tan⁡θ=∣m1−m21+m1m2∣=∣3−1∣=3\tan\theta=\left|\frac{m_1-m_2}{1+m_1m_2}\right|=\left|\frac{3}{-1}\right|=3, giving θ≈71.6∘\theta\approx 71.6^\circ.) A negative product alone is not enough — the precise value −1-1 is required.

Connections

connection

Coordinate geometry is the bridge linking pure synthetic geometry to algebra and analysis.

  • It rests on the Pythagorean Theorem, which supplies the distance formula directly.
  • The slope condition for perpendicularity is the two-dimensional case of the Dot Product of vectors, where perpendicular vectors have zero dot product.
  • Lines extend naturally to Conic Sections — circles, parabolas, ellipses, hyperbolas — each a quadratic equation in xx and yy, with the circle  (x−h)2+(y−k)2=r2\,(x-h)^2+(y-k)^2=r^2 being the distance formula set equal to a constant.
  • Slope is the discrete forerunner of the Derivative: the derivative is the limiting slope of a curve at a point.
  • The whole framework generalises to Vectors in the Plane and to three dimensions, where a third coordinate zz and an extended distance formula appear.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- c. 300 BCE — Euclid's Elements systematises synthetic geometry without coordinates; ratios and constructions dominate.
- c. 200 BCE — Apollonius of Perga studies conic sections using a precursor to coordinates ("diameters" and "ordinates") but no algebra.
- 14th c. — Nicole Oresme graphs quantities against time, an early use of coordinate-like representation of varying magnitudes.
- 1629–1636 — Pierre de Fermat writes Ad locos planos et solidos isagoge, deriving equations of lines and conics, anticipating analytic geometry (published posthumously, 1679).
- 1637 — René Descartes publishes La Géométrie, formally fusing algebra and geometry; the coordinate method spreads across Europe.
- 1684–1690s — Newton and Leibniz develop calculus, treating slope as the instantaneous rate of change, building directly on coordinate geometry.
- 1748 — Leonhard Euler's Introductio in analysin infinitorum standardises the modern treatment of functions and curves in the coordinate plane.
- 19th c. — Generalisation to nn-dimensional and non-Euclidean spaces (Riemann, Cayley) shows coordinate geometry is one instance of a far broader framework.
- 20th–21st c. — Digital computers make coordinate geometry the operational language of graphics, CAD, GIS, and scientific computing.

Subtleties & Limits

open-problem

The formulas above assume a flat Euclidean plane with the standard ("Pythagorean") notion of distance. Several deep questions and limitations arise when these assumptions are relaxed:

  • On the surface of a sphere (e.g. the Earth), the straight-line distance formula gives the chord through the planet, not the travel distance along the surface; the correct measure is the great-circle (geodesic) distance, which uses spherical trigonometry, not [1].
  • Replacing the Euclidean metric with the taxicab metric d=∣x2−x1∣+∣y2−y1∣d=|x_2-x_1|+|y_2-y_1| produces a self-consistent geometry where "circles" are diamonds and midpoints are no longer unique — illustrating that distance is a choice of axioms, not an absolute.
  • Determining the geometry of physical space is ultimately an empirical and unresolved matter: general relativity describes spacetime as curved, so the flat coordinate geometry of high school is an excellent local approximation, not the final word on real-world distance.
  • Even within the plane, generalising "the line minimising total distance to many points" leads to optimisation problems (the Fermat point, geometric median) that have no closed-form solution in general.

See Also

Pythagorean Theorem · Conic Sections · Vectors in the Plane · The Dot Product · The Derivative · Linear Equations in One Variable · Coordinate Geometry in Three Dimensions · Slope and Rate of Change