Where exactly?
“The treasure is buried somewhere in the field” is not much help. “Walk 30 paces east from the old baobab tree, then 20 paces north” is. Two numbers, measured from an agreed starting point in two agreed directions, pin down a place exactly.
People use this idea everywhere. A chess move is written as a letter and a number, such as e4. A seat in a cinema has a row and a number. A ship's position is given by latitude and longitude: Quito lies almost exactly on the equator, at latitude . Many cities, from La Plata in Argentina to Chandigarh in India, are laid out in grids of streets, so a delivery rider thinks in “blocks east” and “blocks north”.
Mathematics takes this everyday idea and makes it precise. The result, the coordinate plane, lets us draw numbers and calculate with pictures. It is one of the most useful inventions in the whole of mathematics.
Two number lines at right angles
Take a number line and lay it horizontally: this is the -axis. Take a second number line and stand it up vertically, crossing the first at : this is the -axis. The crossing point is the origin. Every point of the plane can now be reached from the origin by moving some distance left or right (along the -axis) and then some distance up or down (parallel to the -axis).
To reach A, start at the origin, go 3 to the right, then 2 up. To reach B, go 2 to the right, then 3 up. Same two numbers, different order, different place.
Definitions
Definition— coordinate plane
The coordinate plane is formed by two perpendicular number lines, the -axis (horizontal) and the -axis (vertical), which meet at their zeros. The meeting point is the origin, .
Definition— coordinates
The coordinates of a point are its signed horizontal and vertical positions relative to the origin: is the -coordinate (positive to the right, negative to the left) and is the -coordinate (positive up, negative down). An ordered pair is a pair of numbers in which the order matters: exactly when and .
Definition— quadrants
The axes split the rest of the plane into four quadrants: I where and ; II where and ; III where and ; IV where and . Points on an axis are in no quadrant.
Definition— absolute value
The absolute value is the distance of from on the number line: if , and if . So , and .
Definition— reflection in an axis
The reflection of a point in a line is the point on the other side of such that crosses the segment at right angles, exactly halfway. A point on is its own reflection.
Worked examples
Example— Plotting with negative numbers and fractions
To plot : from the origin go units left (the -coordinate is negative), then units down. is in quadrant III. The point is in quadrant IV, and lies on the -axis, in no quadrant.
Example— Reading a distance along a horizontal line
How far is from ? Both points are 2 units up, so the segment joining them is horizontal. From to is 3 units; from to is 4 more. The distance is . It is not : the points are on opposite sides of the -axis.
Example— A vertical distance
From to the segment is vertical, and its length is .
Example— Distance along the grid
A delivery rider in a city of square blocks travels from to along the streets. She must go blocks east and blocks south: blocks, whichever route she picks (as long as she never doubles back). This grid distance is also called the taxicab distance.
Example— Reflections
Reflect in the -axis: it lands at , 2 units below the axis. Reflect it in the -axis: . Reflect it in both: , the same as turning half way round the origin.
Example— Plotting a relationship
A kettle's water starts at and warms by degrees each minute. Plotting (minutes, temperature) gives , , , , : the points lie on a straight line. Turning a table into points in the plane makes patterns visible — the starting point for linear relationships.
Why it all works
Theorem— Theorem 1 (one point, one ordered pair)
Every point of the plane has exactly one pair of coordinates, and every ordered pair of numbers is the address of exactly one point. Two points are the same exactly when their -coordinates are equal and their -coordinates are equal.
Proof
Given a point , draw the line through parallel to the -axis. It crosses the -axis at exactly one point, which is some number on that number line. Likewise the line through parallel to the -axis crosses the -axis at exactly one number . So has the coordinates , and no others.
Conversely, given , the vertical line through and the horizontal line through are perpendicular, so they cross at exactly one point. That point has coordinates .
So points and ordered pairs match up one-to-one, and two points are equal exactly when their pairs are equal, that is, when both coordinates agree.
∎
In particular : their -coordinates differ.
Theorem— Theorem 2 (distance along a line)
The distance between and is . The distance between and is . Also .
Proof
The points and lie on the horizontal line at height , which is a copy of the -axis number line. On a number line the distance between and is the larger minus the smaller. If that is , which equals because . If it is , which equals because . Either way the distance is ; and because the distance does not depend on which point we call first, . The vertical case is the same, using the -coordinates.
∎
Theorem— Theorem 3 (reflections in the axes)
Reflecting in the -axis gives ; reflecting it in the -axis gives . Reflecting twice in the same axis brings every point back, and reflecting in both axes, in either order, gives .
Proof
Let . The line through perpendicular to the -axis is the vertical line at , so the reflection also has -coordinate . The -axis must cross halfway, so is as far below the axis as is above it (or vice versa): its -coordinate is . (If , then is on the axis and .) The -axis case is the same with the roles of the coordinates swapped.
Reflecting in the -axis gives , the starting point. Reflecting in the -axis and then the -axis gives ; the other order gives . The same point.
∎
Theorem— Theorem 4 (reflections and quadrants)
Reflection in the -axis swaps quadrants I and IV, and II and III. Reflection in the -axis swaps I and II, and III and IV. The points that reflection in the -axis leaves where they are are exactly the points of the -axis.
Proof
Reflection in the -axis keeps the sign of the -coordinate and reverses the sign of the -coordinate. Quadrants I and IV are exactly the two quadrants with , differing only in the sign of ; so are II and III with . For the last claim: exactly when , that is , that is . The -axis case is the same with the coordinates swapped.
∎
Theorem— Theorem 5 (reflections keep distances)
Reflecting two points in an axis does not change the horizontal distance, the vertical distance, or the grid distance between them.
Proof
Reflect and in the -axis. The horizontal distance is still . The vertical distance becomes by Theorem 2. So the grid distance is unchanged too. The -axis is similar.
∎
Taxicab geometry: a different distance
In a city of square blocks, the grid distance is the distance that matters to a taxi driver: you cannot drive through buildings. It obeys the same basic rule as ordinary distance, the triangle inequality: going from to by way of a third point is never shorter than going directly.
Theorem— Theorem 6 (triangle inequality for grid distance)
For any points , , : .
Proof
On a number line, for all numbers and : if and have the same sign, both sides are equal; if they have opposite signs, they partly cancel on the left. Apply this with and for the -coordinates of : . Do the same for the -coordinates and add the two inequalities.
∎
Taxicab geometry has surprises. The set of points at grid distance from the origin — a taxicab “circle” — is not round at all: it is a square standing on one corner, with corners at , , and . Ordinary straight-line distance, the kind a bird would fly, needs the Pythagorean theorem, which comes next.
The coordinate plane in Lean
In Lean a point is a structure holding two rational numbers. Lean then knows that a point is nothing more and nothing less than its two coordinates — and we prove it:
/-- A point of the coordinate plane: its `x`-coordinate (horizontal position) and its
`y`-coordinate (vertical position), measured from the origin `⟨0, 0⟩`. -/
structure Point where
x : Rat
y : Rat
deriving DecidableEq/-- **One point, one ordered pair.** Two points are the same exactly when their
`x`-coordinates agree **and** their `y`-coordinates agree. -/
theorem point_eq_iff (P Q : Point) : P = Q ↔ P.x = Q.x ∧ P.y = Q.y := by
constructor
· intro h
rw [h]
exact ⟨rfl, rfl⟩
· intro ⟨hx, hy⟩
cases P
cases Q
simp only at hx hy
rw [hx, hy]/-- The order of the coordinates matters: `(3, 2)` and `(2, 3)` are different points. -/
theorem order_matters : (⟨3, 2⟩ : Point) ≠ ⟨2, 3⟩ := by decide +kernelQuadrants, with a point that has a fraction coordinate:
/-- The quadrant of a point: 1 (`x > 0, y > 0`), 2 (`x < 0, y > 0`), 3 (`x < 0, y < 0`),
4 (`x > 0, y < 0`), and `0` for points on an axis, which lie in no quadrant. -/
def quadrant (P : Point) : Nat :=
if 0 < P.x ∧ 0 < P.y then 1
else if P.x < 0 ∧ 0 < P.y then 2
else if P.x < 0 ∧ P.y < 0 then 3
else if 0 < P.x ∧ P.y < 0 then 4
else 0/-- The point `(-1/2, 3)` lies in the second quadrant, and `(0, -2)` on an axis. -/
theorem example_quadrant : quadrant ⟨-1/2, 3⟩ = 2 ∧ quadrant ⟨0, -2⟩ = 0 := by decide +kernelReflections, and Theorems 3 and 4:
/-- Reflection in the `x`-axis: `(a, b) ↦ (a, -b)`. -/
def reflectX (P : Point) : Point := ⟨P.x, -P.y⟩/-- Reflection in the `y`-axis: `(a, b) ↦ (-a, b)`. -/
def reflectY (P : Point) : Point := ⟨-P.x, P.y⟩/-- Reflecting `(3, 2)` in the `x`-axis gives `(3, -2)`; in the `y`-axis, `(-3, 2)`. -/
theorem example_reflections : reflectX ⟨3, 2⟩ = ⟨3, -2⟩ ∧ reflectY ⟨3, 2⟩ = ⟨-3, 2⟩ := by
decide +kernel/-- Reflecting twice in the same axis brings every point back: `-(-b) = b`. -/
theorem reflectX_twice (P : Point) : reflectX (reflectX P) = P := by
rw [point_eq_iff]
exact ⟨rfl, Rat.neg_neg P.y⟩/-- Reflecting twice in the `y`-axis brings every point back. -/
theorem reflectY_twice (P : Point) : reflectY (reflectY P) = P := by
rw [point_eq_iff]
exact ⟨Rat.neg_neg P.x, rfl⟩/-- Reflecting in the `y`-axis and then in the `x`-axis sends `(a, b)` to `(-a, -b)`: a half
turn about the origin. -/
theorem reflectX_reflectY (P : Point) : reflectX (reflectY P) = ⟨-P.x, -P.y⟩ := rfl/-- The two reflections can be done in either order: both orders give `(-a, -b)`. -/
theorem reflections_commute (P : Point) : reflectX (reflectY P) = reflectY (reflectX P) := rfl/-- The points that reflection in the `x`-axis leaves where they are are exactly the points
**on** the `x`-axis: `(a, -b) = (a, b)` exactly when `b = 0`. -/
theorem reflectX_fixed_iff (P : Point) : reflectX P = P ↔ P.y = 0 := by
rw [point_eq_iff]
constructor
· intro ⟨_, h⟩
-- `h` says `-b = b`, which forces `b = 0`.
simp only [reflectX] at h
grind
· intro h
exact ⟨rfl, by simp only [reflectX]; rw [h]; rfl⟩/-- How reflection in the `x`-axis relabels quadrants: `1 ↔ 4` and `2 ↔ 3` (and the axes,
labelled `0`, stay on the axes). -/
def mirrorQuadrant : Nat → Nat
| 1 => 4
| 2 => 3
| 3 => 2
| 4 => 1
| _ => 0/-- **Reflection in the `x`-axis swaps quadrants 1 and 4, and 2 and 3.** The sign of `x` is
kept and the sign of `y` is reversed. Proof: try every combination of signs. -/
theorem quadrant_reflectX (P : Point) : quadrant (reflectX P) = mirrorQuadrant (quadrant P) := by
unfold quadrant reflectX
simp only
by_cases h1 : 0 < P.x <;> by_cases h2 : 0 < P.y <;> by_cases h3 : P.x < 0 <;>
by_cases h4 : P.y < 0 <;> simp_all [mirrorQuadrant] <;> grindDistances: absolute value, Theorem 2, the example that crosses an axis, the grid distance, Theorems 5 and 6, and the count of grid lines.
/-- Absolute value: the distance of a number from `0` on the number line. -/
def absQ (q : Rat) : Rat := if 0 ≤ q then q else -q/-- The distance between `a` and `c` on a number line does not depend on the order:
`|a - c| = |c - a|`. -/
theorem abs_sub_comm (a c : Rat) : absQ (a - c) = absQ (c - a) := by
unfold absQ
split <;> split <;> grind/-- From `(-3, 2)` to `(4, 2)` is `|-3 - 4| = 7` units — **not** `4 - 3 = 1`: the path
crosses the `y`-axis, 3 units on one side and 4 on the other. -/
theorem horizontal_distance_example : absQ (-3 - 4) = 7 := by decide +kernel/-- The distance between two points when you may only travel along grid lines (horizontal
and vertical steps, like a taxi in a city of square blocks): `|a - c| + |b - d|`. -/
def gridDist (P Q : Point) : Rat := absQ (P.x - Q.x) + absQ (P.y - Q.y)/-- For two points on the same horizontal line, `(a, b)` and `(c, b)`, the distance is
`|a - c|`. -/
theorem gridDist_horizontal (P Q : Point) (h : P.y = Q.y) :
gridDist P Q = absQ (P.x - Q.x) := by
unfold gridDist
rw [h, Rat.sub_self]
unfold absQ
grind/-- **Reflections keep distances.** Reflecting two points in the `x`-axis does not change the
grid distance between them, because `|(-b) - (-d)| = |d - b| = |b - d|`. -/
theorem gridDist_reflectX (P Q : Point) : gridDist (reflectX P) (reflectX Q) = gridDist P Q := by
unfold gridDist reflectX
simp only
rw [show -P.y - -Q.y = Q.y - P.y by grind, abs_sub_comm Q.y P.y]/-- The triangle inequality on the number line: `|a + b| ≤ |a| + |b|`. Proof: check every
combination of signs of `a`, `b` and `a + b`. -/
theorem abs_add_le (a b : Rat) : absQ (a + b) ≤ absQ a + absQ b := by
unfold absQ
split <;> split <;> split <;> grind/-- **A detour never helps:** going from `P` to `R` along grid lines is never longer than going
from `P` to `Q` and then from `Q` to `R`. Apply `abs_add_le` to the horizontal and the vertical
parts separately. -/
theorem gridDist_triangle (P Q R : Point) : gridDist P R ≤ gridDist P Q + gridDist Q R := by
unfold gridDist
have h1 := abs_add_le (P.x - Q.x) (Q.x - R.x)
have h2 := abs_add_le (P.y - Q.y) (Q.y - R.y)
rw [show P.x - Q.x + (Q.x - R.x) = P.x - R.x by grind] at h1
rw [show P.y - Q.y + (Q.y - R.y) = P.y - R.y by grind] at h2
grind/-- **Count the gaps, not the lines.** Walking `n` unit steps from `a` passes the `n + 1` grid
lines `a, a + 1, …, a + n`: one more line than the distance. This applies core Lean's
`List.length_range'`. -/
theorem grid_lines_vs_steps (a n : Nat) : (List.range' a (n + 1)).length = n + 1 :=
List.length_range'Everything except the last is proved here from the rules of arithmetic for rational numbers; the last applies a library fact about lists. What is not formalised: the geometric half of Theorem 1 (that perpendicular lines through the axes meet in exactly one point). In Lean we define a point to be a pair of numbers, which builds Theorem 1 in from the start; that is exactly how coordinate geometry turns pictures into algebra. Mathlib works with the real plane ℝ × ℝ, where |x| is abs x.
Checking every point of a grid
"""Reflections and grid distances on every point of a small grid.
The experiment takes all 121 points (a, b) with whole-number coordinates from
-5 to 5, plus a few points with fraction coordinates, and checks: reflecting
twice returns each point; reflection in the x-axis swaps quadrants 1 and 4 and
2 and 3; the points it leaves fixed are exactly those on the x-axis; and the
reflections, the half turn and the coordinate swap (a, b) -> (b, a) keep the
grid ("taxicab") distance |a - c| + |b - d| between every pair of points. It
also counts grid lines against unit steps. Exact arithmetic over a finite
grid: exhaustive evidence for these points, not a proof for all points.
"""
from fractions import Fraction
from itertools import product
def reflect_x(p):
"""Reflection in the x-axis: (a, b) -> (a, -b)."""
return (p[0], -p[1])
def reflect_y(p):
"""Reflection in the y-axis: (a, b) -> (-a, b)."""
return (-p[0], p[1])
def half_turn(p):
"""Half turn about the origin: (a, b) -> (-a, -b)."""
return (-p[0], -p[1])
def swap(p):
"""Swap the coordinates: (a, b) -> (b, a), reflection in y = x."""
return (p[1], p[0])
def stretch_x(p):
"""A non-example: stretch horizontally, (a, b) -> (2a, b)."""
return (2 * p[0], p[1])
def quadrant(p):
"""1, 2, 3 or 4, or 0 for a point on an axis."""
a, b = p
if a > 0 and b > 0:
return 1
if a < 0 < b:
return 2
if a < 0 and b < 0:
return 3
if a > 0 > b:
return 4
return 0
def grid_distance(p, q):
"""Distance along grid lines: |a - c| + |b - d|."""
return abs(p[0] - q[0]) + abs(p[1] - q[1])
def grid_points(radius):
"""All points with whole-number coordinates from -radius to radius."""
r = range(-radius, radius + 1)
return [(a, b) for a, b in product(r, r)]
def keeps_distance(move, points):
"""Number of pairs (p, q) whose grid distance changes under ``move``."""
return sum(grid_distance(move(p), move(q)) != grid_distance(p, q)
for p in points for q in points)
def lines_and_steps(a, c):
"""(unit steps, grid lines crossed) walking from a to c on a number line."""
lo, hi = min(a, c), max(a, c)
return hi - lo, len(range(lo, hi + 1))
def main():
pts = grid_points(5)
fracs = [(Fraction(1, 2), Fraction(-7, 3)), (Fraction(-5, 4), Fraction(2))]
every = pts + fracs
print(f"Points checked: {len(pts)} whole-number points and {len(fracs)} "
"fraction points")
twice = all(reflect_x(reflect_x(p)) == p and reflect_y(reflect_y(p)) == p
for p in every)
print(f"Reflecting twice returns every point: {twice}")
moves = {}
for p in every:
key = (quadrant(p), quadrant(reflect_x(p)))
moves[key] = moves.get(key, 0) + 1
print("Quadrant before -> after reflecting in the x-axis (number of points):")
print(" " + ", ".join(f"{a}->{b}: {n}" for (a, b), n in sorted(moves.items())))
fixed = [p for p in pts if reflect_x(p) == p]
print(f"Points fixed by the x-axis reflection: {len(fixed)}, all with y = 0:"
f" {all(b == 0 for _, b in fixed)}")
same = [p for p in pts if swap(p) == p]
print(f"Points with (a, b) = (b, a): {len(same)}, all on the line y = x")
print()
print(f"Grid distance changes among all {len(pts) ** 2} pairs of points:")
for name, move in [("reflect in x-axis", reflect_x),
("reflect in y-axis", reflect_y),
("half turn", half_turn), ("swap (a, b)", swap)]:
print(f" {name:<18} {keeps_distance(move, pts)} pairs changed")
print(f" {'stretch x by 2':<18} {keeps_distance(stretch_x, pts)} pairs"
" changed (a non-example)")
print()
steps, lines = lines_and_steps(-3, 4)
print(f"From x = -3 to x = 4: {steps} unit steps, but {lines} grid lines.")
print()
print("Epistemic status: exact, exhaustive checks on the points listed. They")
print("cannot cover every point of the plane; the lesson's proofs (and the")
print("Lean proofs) show the same facts for all points with any rational")
print("coordinates.")
if __name__ == "__main__":
main()Every check passes, and the horizontal stretch shows that the distance check is not trivially true: a move that is not a rigid motion fails it for most pairs. Still, points are not the whole plane — the checks are exhaustive only for the points listed. The proofs above, and their Lean versions, cover every point with rational coordinates.
Explore: reflections in the axes
Move the sliders for and to move the point . is its reflection in the -axis, its reflection in the -axis, and its image under a half turn about the origin. The coloured segments join to each image.
Things to try: put in each quadrant in turn and say which quadrants the images land in. Make : what happens to ? Check that each axis cuts the segment joining to its mirror image exactly in half, at a right angle.
Reflecting a point in the axes
A point moves along the curve as t changes: x and y are both functions of t.
- P to P′ (reflect in the x-axis)
- P to P″ (reflect in the y-axis)
- P to P‴ (half turn)
- (3, 1.5)
- (2.25, 2)
- (2.25, 1.5)
Exercises
1. The coordinate plane
Warm-upHumanIn which quadrant is the point ?
2. The coordinate plane
Warm-upHumanReflect the point in the -axis. Where does it land?
3. The coordinate plane
Warm-upHumanWhat is the distance between and ?
4. The coordinate plane
CoreHumanA cyclist in a city of square blocks rides from to along the streets, never doubling back. How many blocks does she ride?
5. The coordinate plane
CoreHumanA point is reflected in the -axis and then the result is reflected in the -axis. It ends up at . Where was ?
6. The coordinate plane
Warm-upHumanKofi was asked to plot . He started at the origin, went up 3 and then right 2. Which point did he actually plot?
7. The coordinate plane
CoreHumanWhich point is exactly halfway between and ?
8. The coordinate plane
StretchHumanWhich statements are true for every point ? (Choose all that apply.)
9. The coordinate plane
CoreFormalIn the Lean file, reflectX P is the reflection of the point P in the -axis. Which statement says that reflecting twice in the -axis brings every point back?
10. The coordinate plane
StretchComputationalWrite a function quadrant(x, y) that returns 1, 2, 3 or 4 for a point in quadrant I, II, III or IV, and 0 for a point on an axis. It should work for fractions too.
Common misconceptions
Misconception
Swapping the coordinates: plotting at . The first number is always the horizontal () position, the second the vertical () position — “along the corridor, then up the stairs”. Swapping them moves the point to its mirror image in the line , which is a different point unless the two coordinates are equal.
Misconception
Counting grid lines instead of unit intervals. From to you pass grid lines () but take only unit steps. Distance counts the gaps between grid lines, not the lines themselves — like fence panels and fence posts.
Misconception
“The distance from to is .” Ignoring the sign gives the wrong answer when the points lie on opposite sides of an axis. Subtract the coordinates themselves and take the absolute value: .
Misconception
“Reflecting in the -axis changes the -coordinate.” It is the other way round: reflecting in the -axis flips the point across the -axis, so it changes the sign of and keeps . Picture the axis as a mirror lying along the -direction.
Other ways of seeing
Algebra— Points you can add
Once points are pairs of numbers, we can calculate with them. Adding means “do one journey, then the other”; multiplying by a number, , stretches a journey. With these operations the plane becomes the vector space , and reflections become simple formulas: the reflection in the -axis is the rule . This is the doorway to vectors and linear algebra, where whole geometric transformations are written as tables of numbers called matrices.
Geometry— Which distance?
Grid distance and straight-line distance are two different ways to measure the same plane, and they give two different geometries. Reflections in the axes, half turns and swapping the coordinates keep both kinds of distance. But a turn through keeps straight-line distance and changes grid distance: the point , at grid distance 1 from the origin, turns into a point at grid distance . Felix Klein's insight (1872) was that a geometry is described by the transformations that keep its measurements — see transformation geometry.
The plane as a set of pairs
For any two sets and , the Cartesian product is the set of all ordered pairs with and . The coordinate plane is the Cartesian product of the real number line with itself, and the grid of points with whole-number coordinates is . Theorem 1 says that the points of the geometric plane and the elements of match up exactly. The name “Cartesian” honours Descartes (in Latin, Cartesius). See sets.
Wonder Trails
Optional, and never graded: a question that leads somewhere further.
Wonder Trail · Optional · never gradedLife on a torusIn some video games, walking off the right edge of the screen brings you back on the left, and walking off the top brings you back at the bottom. If that world were a real surface, what shape would it be?Follow the trailHistory and global context
- Maps. Claudius Ptolemy's Geography (Alexandria, 2nd century CE) located about 8000 places by latitude and longitude — two numbers per place. In China, the cartographer Pei Xiu (3rd century CE) is credited with principles of map-making that included a rectangular grid for measuring distances.
- Graphs. In the 14th century, Nicole Oresme in France drew pictures of how a quantity, such as speed, changes over time, using horizontal and vertical lengths — an early form of a graph.
- Coordinate geometry. In the 1630s René Descartes (La Géométrie, 1637) and Pierre de Fermat (whose Introduction to Plane and Solid Loci circulated in manuscript around the same time) independently showed how to describe curves by equations relating two coordinates, uniting algebra and geometry. Neither used our modern picture with two perpendicular axes and negative coordinates on both; that settled into its familiar form over the following century.
- Distances. Around 1900 Hermann Minkowski studied geometries with unusual distances, including the grid distance; the name “taxicab geometry” came later.
Further reading
- Eugene F. Krause, Taxicab Geometry: An Adventure in Non-Euclidean Geometry (1975) — short, playful and suitable for secondary school.
- Richard Courant and Herbert Robbins, What Is Mathematics? (1941), chapter on analytic geometry.
- René Descartes, La Géométrie (1637); English translation by David Eugene Smith and Marcia L. Latham, The Geometry of René Descartes (1925).