Descartes married algebra to geometry. Every point is a pair of numbers. Every curve is an equation. Every geometric proof becomes a calculation. The Cartesian plane is the bridge between shape and formula.
The Cartesian plane
Two perpendicular number lines crossing at the origin (0, 0). The horizontal axis is x, the vertical is y. Every point in the plane has coordinates (x, y). This is the idea that turned geometry into algebra.
Distance and midpoint
The distance formula is the Pythagorean theorem in coordinates: d = sqrt((x2-x1)² + (y2-y1)²). The midpoint is the average of the coordinates: ((x1+x2)/2, (y1+y2)/2).
Slope measures steepness: m = (y2-y1)/(x2-x1). A line through (x1, y1) with slope m satisfies y - y1 = m(x - x1). Two lines are parallel when their slopes are equal. Two lines are perpendicular when m1 * m2 = -1.
Scheme
; Slope between two points
(define (slope x1 y1 x2 y2)
(/ (- y2 y1) (- x2 x1)))
(display "Slope from (1,1) to (3,5): ")
(display (slope 1135))
(newline)
; Line equation: y = mx + b; Given slope m and point (x1,y1), find b
(define (y-intercept m x1 y1)
(- y1 (* m x1)))
(let ((m (slope 1135)))
(display "Line: y = ")
(display m)
(display "x + ")
(display (y-intercept m 11))
(newline))
; Parallel check: equal slopes
(display "Parallel? slopes 2 and 2: ")
(display (= 22))
(newline)
; Perpendicular check: product of slopes = -1
(display "Perpendicular? slopes 2 and -1/2: ")
(display (= (* 2-1/2) -1))
Python
def slope(x1, y1, x2, y2):
return (y2 - y1) / (x2 - x1)
def y_intercept(m, x1, y1):
return y1 - m * x1
m = slope(1, 1, 3, 5)
b = y_intercept(m, 1, 1)
print(f"Slope from (1,1) to (3,5): {m}")
print(f"Line: y = {m}x + {b}")
print(f"Parallel? slopes 2 and 2: {2 == 2}")
print(f"Perpendicular? slopes 2 and -0.5: {2 * -0.5 == -1}")
Conic sections
Slice a cone at different angles and you get circles, ellipses, parabolas, and hyperbolas. Each has a standard equation in the coordinate plane:
Circle: x² + y² = r²
Ellipse: x²/a² + y²/b² = 1
Parabola: y = ax²
Hyperbola: x²/a² - y²/b² = 1
Scheme
; Conic sections as predicates; Does a point lie on the curve?; Circle: x^2 + y^2 = r^2
(define (on-circle? x y r)
(= (+ (* x x) (* y y)) (* r r)))
(display "Is (3,4) on circle r=5? ")
(display (on-circle? 345))
(newline)
; Parabola: y = a*x^2
(define (on-parabola? x y a)
(= y (* a x x)))
(display "Is (2,12) on y=3x^2? ")
(display (on-parabola? 2123))
(newline)
; Ellipse: x^2/a^2 + y^2/b^2 = 1
(define (on-ellipse? x y a b)
(= (+ (/ (* x x) (* a a))
(/ (* y y) (* b b)))
1))
(display "Is (3,0) on ellipse a=3,b=2? ")
(display (on-ellipse? 3032))
Neighbors
Cross-references
∫ Calculus Ch.1 — functions and graphs: coordinate geometry is the prerequisite