Precalculus
Overview
Section titled “Overview”- Primary reference: OpenStax, Precalculus 2e (free, CC BY)
- Supplementary: OpenStax, College Algebra 2e (free) for the algebra review; Paul’s Online Notes, Algebra and Trig Review (free); 3Blue1Brown, Euler’s formula with introductory group theory (free)
- Prerequisites: high-school algebra (solving linear equations, manipulating fractions and powers)
- Estimated time: 2 to 3 weeks at 10 to 12 h/week; in the course, the first stages of Pass 2
Key Takeaways
Section titled “Key Takeaways”- Logarithms turn products into sums and change the unit of information. A model’s loss in nats becomes bits by dividing by ; bits per byte is the comparison every tokenizer and model in the course is judged by.
- A rotation is a multiplication by a unit complex number. Rotating a 2D pair by is multiplying by ; RoPE applies that to every pair of a query and a key.
- Geometric sequences are frequency ladders. RoPE’s inverse frequencies and ALiBi’s head slopes are geometric sequences; their sums and ratios decide how far a position signal reaches.
- How you evaluate a formula matters as much as the formula. Horner’s rule is the cheapest and most stable way to evaluate a polynomial, and the textbook quadratic formula can lose most of its digits for the small root when .
How to Study
Section titled “How to Study”Read each OpenStax chapter with a notebook open and check every identity numerically before you trust it (math.log, cmath.exp, numpy). In the course, take the solve set S-M00 first: it is the pen-and-paper check of the four build modules, then build M00.1 to M00.4 in order with ol start <ID> and ol check <ID>.
Concepts & Techniques
Section titled “Concepts & Techniques”Core Insight
Section titled “Core Insight”Precalculus is the toolbox the rest of the math is written in: exponents and logarithms, trigonometry and complex numbers, sequences and series, and polynomials. Each one has a call site in an LLM system: logarithms measure information, rotations encode position, geometric ladders set frequencies, and polynomials approximate the functions a C kernel cannot call.
1. Exponents, logarithms, and units of information
Section titled “1. Exponents, logarithms, and units of information”Key ideas:
- Laws: , , change of base .
- Units: a negative log-likelihood summed in nats over a text of bytes is bits per byte, a number comparable across tokenizers.
- Call sites:
M11.2perplexity and bits per byte,L1.6tokenizer metrics,L6.7the model-zoo table,C1.
2. Trigonometry, rotations, and complex numbers
Section titled “2. Trigonometry, rotations, and complex numbers”Key ideas:
- Unit circle: ; a 2D rotation is the matrix , which preserves length and composes by adding angles: .
- Euler’s formula: , so the same rotation is one complex multiplication.
- Call sites:
L5.4sinusoidal positional encoding,L7.3RoPE.
3. Sequences, series, and frequency ladders
Section titled “3. Sequences, series, and frequency ladders”Key ideas:
- Geometric sequence: with sum for .
- Ladders: RoPE
inv_freqis for ; ALiBi slopes are a geometric sequence per head, with a rule for head counts that are not powers of two. - Call sites:
L7.3RoPE,L7.4ALiBi and YaRN,M02.2,M10.4schedules.
4. Polynomials, Horner’s rule, and stable roots
Section titled “4. Polynomials, Horner’s rule, and stable roots”Key ideas:
- Horner: uses multiplications and additions and is the form every polynomial kernel uses.
- Cancellation: when one root of subtracts two nearly equal numbers; compute the large-magnitude root first and get the other from .
- Call sites:
M02.1Taylor polynomials,M09.6the polynomial core oftl_expf.
Course modules
Section titled “Course modules”| Module | Topic | Kind | Pass |
|---|---|---|---|
S-M00 | Precalculus problem set (checked by SymPy) | solve | 2 |
M00.1 | Exponents, logs, change of base, units of information | build | 2 |
M00.2 | Trig, unit circle, 2D rotations, complex numbers, Euler’s formula | build | 2 |
M00.3 | Sequences, geometric series, frequency ladders | build | 2 |
M00.4 | Polynomials, Horner, stable quadratic roots | build | 2 |
M00.5 | Functions, inverses, monotonicity, inequalities | solve | solve set |
M00.5 (functions, inverses, monotonicity, inequalities) is solve-only: it appears as items of S-M00 and is used by M01.1 and M05.2.
Chapters
Section titled “Chapters”| # | Module | Chapter | Kind | Pass |
|---|---|---|---|---|
| 1 | S-M00 | Solve set: functions, exp/log, trig and Euler, series, polynomials, inequalities | solve | 2 |
| 2 | M00.1 | Exponents, logs, change of base, units of information | build | 2 |
| 3 | M00.2 | Trig, unit circle, 2D rotations, complex numbers, Euler’s formula | build | 2 |
| 4 | M00.3 | Sequences, geometric series, frequency ladders | build | 2 |
| 5 | M00.4 | Polynomials, Horner, stable quadratic roots | build | 2 |
Connections to Other Tracks
Section titled “Connections to Other Tracks”| Track | Connection |
|---|---|
| Calculus 1 | limits and derivatives build on functions, exponentials, and logarithms |
| Numerical Methods and Floating Point | range reduction and polynomial approximation of exp (M09.6) start from Horner’s rule |
| Information Theory | entropy and perplexity are logarithms with a unit |
| tinyllm | RoPE, ALiBi, and bits per byte are the first places this math runs |