Pre-Calculus Intro
Pre-calculus is the toolbox you need before calculus: shapes and measurements, angles and trigonometry, functions, sequences and series, and a first idea of limits. This course covers all of it, checks every idea in Python, and shows where programmers meet each topic in games, graphics, maps and data.
Where this course sits
The Mathematics track is a ladder. Each course assumes the one before it:
| Step | Course | What it gives you |
|---|---|---|
| 1 | Basic Math & Pre-Algebra | numbers, fractions, percents, exponents, the coordinate plane |
| 2 | Algebra | equations, polynomials, factoring, systems, graphing lines and parabolas |
| 3 | Pre-Calculus, Geometry & Trigonometry (this course) | shapes, proofs, trig, function families, series, conics, first limits |
| 4 | Calculus Essentials | derivatives and integrals, a gentle survey |
| 5 | Calculus in Depth and Linear Algebra | the full university treatment |
If you can solve a linear equation, factor a simple quadratic and plot a point , you are ready.
What is in the course
The topic order follows Debra Anne Ross, Master Math: Pre-Calculus and Geometry, used only as a reference for the order of topics. All text, examples and exercises here are original. The book's chapters map onto the course like this, with a few extra parts added to fill common gaps:
| Part | Topics | Source of the order |
|---|---|---|
| Geometry | lines, angles, polygons, triangles, circles, area, volume, vectors | book chapter 1 |
| Geometry extras | congruence, two-column proofs, transformations, coordinate geometry | added |
| Trigonometry | radians, the six functions, the unit circle, identities, laws of sines and cosines, graphs, inverses | book chapter 2 |
| Sets and Functions | sets, functions, composition and inverses, polynomial, rational, exponential and piecewise functions | book chapter 3 |
| Sequences, Progressions and Series | arithmetic and geometric progressions, series, convergence, power series, binomial expansion, induction | book chapter 4 |
| Conics, Polar and Complex | conic sections, polar and parametric forms, complex numbers in polar form | added |
| Limits and a First Look at Calculus | limits, continuity, a preview of the derivative and the integral | book chapters 5 to 7 |
| Geometry and Trig in Computing | collision tests, aiming, procedural meshes, waves, map distances, convex hulls | added |
A first taste: distance and direction
A game character stands at and an enemy at . How far away is the enemy, and in which direction should the character turn? The distance comes from the Pythagorean theorem and the direction from trigonometry:
import math
px, py = 1, 2 # player
ex, ey = 7, 10 # enemy
dx, dy = ex - px, ey - py
distance = math.hypot(dx, dy) # √(dx² + dy²)
heading = math.degrees(math.atan2(dy, dx)) # angle from the +x axis
print("offset:", (dx, dy))
print("distance:", distance)
print(f"heading: {heading:.2f}°")offset: (6, 8)
distance: 10.0
heading: 53.13°
The offset is the hypotenuse of a 6-8-10 right triangle, so the distance is exactly 10. The heading uses atan2, which you will meet in Geometry and Trig with Python and again in Inverse Trigonometric Functions.
A first taste: area from corners
Given only the corners of a shape, you can find its area with a short formula that walks around the outline. Here it is on a right triangle whose area you can check by hand ():
def shoelace(points):
s = 0
n = len(points)
for i in range(n):
x1, y1 = points[i]
x2, y2 = points[(i + 1) % n]
s += x1 * y2 - x2 * y1
return abs(s) / 2
print(shoelace([(0, 0), (4, 0), (4, 3)]))
print(shoelace([(0, 0), (5, 0), (5, 2), (2, 2), (2, 4), (0, 4)])) # an L shape6.0
14.0
The L shape is a rectangle plus a square, . Games, map software and CAD programs use this shoelace formula all the time. It is explained in Polygons.
Why programmers need this
| Topic | Where it shows up in code |
|---|---|
| Distance, midpoint, slope | movement, AI ranges, camera framing, snapping in drawing tools |
| Polygons and areas | hit testing, map regions, layout engines, CAD |
| Similar triangles | perspective cameras and 3D rendering |
| Transformations | every sprite or model is translated, rotated and scaled by a matrix |
| Trigonometry | aiming, circular motion, rotation, sound and signal waves |
| Series | how sin, exp and log are actually computed in a math library |
| Limits | the idea behind derivatives, gradients and machine-learning training |
Learning paths
| Your goal | Suggested route |
|---|---|
| Full high-school course | every lesson in order, then Exercises and the Mini Project |
| Game and graphics developer | Geometry part, then Translations, Reflections and Rotations, the Trigonometry part, then Geometry and Trig in Computing; continue with Game Math |
| Heading to calculus quickly | Trigonometry, Sets and Functions, Sequences and Series, then Limits; continue with Calculus Essentials |
| Data and machine learning | coordinate geometry, vectors, functions, exponential and log functions, series; continue with Linear Algebra |
Tip: Run every example, then change a number and predict the new output before you run it again. That habit is the fastest way to build intuition.
How each lesson works
Each lesson explains one idea, gives runnable Python examples, and ends with exercises (answers and full solutions are hidden until you open them) and a short quiz. Formulas are typeset in math notation, such as and ; the Python examples write the same formulas as code (math.pi * r**2).
Exercises
Exercise 1: Distance by hand
How far apart are the points and ?
Answer
13
Solution
Exercise 2: A rectangle by shoelace
Use the shoelace function above (or work it by hand) on the rectangle with corners , , , . Check that it matches .
Answer
, which equals .
Solution
def shoelace(points):
s = 0
for i in range(len(points)):
x1, y1 = points[i]
x2, y2 = points[(i + 1) % len(points)]
s += x1 * y2 - x2 * y1
return abs(s) / 2
print(shoelace([(1, 1), (6, 1), (6, 4), (1, 4)]))15.0
Exercise 3: Which heading?
Without running code, in which direction (in degrees from the +x axis) does the offset point? Then check with math.degrees(math.atan2(-5, 0)).
Answer
(straight down; the same direction as 270°).
Solution
The offset has no x part and a negative y part, so it points along the negative y axis. atan2 returns angles between −180° and 180°, so it reports −90°, which is the same direction as 270°.
import math
print(math.degrees(math.atan2(-5, 0)))-90.0
Test yourself
Which course comes directly before Pre-Calculus on the Mathematics ladder?
- Calculus Essentials
- Algebra
- Linear Algebra
- Statistics
What is the distance from to ?
- 14
- 10
- 8
What does the shoelace formula compute?
- The area of a polygon from its corner coordinates
- The perimeter of a circle
- The angle between two lines
- The length of a diagonal