First PrinciplesStart anywhere. Prove it, then move on.

Forty-eight rungs to building AI from scratch.

Mathematics and computer science are one subject. This is that subject in order — from writing instructions a machine could follow, to coding a transformer with no framework underneath it.

There are no grade levels here, and no ages. Rungs are numbered, and that is the only ordering. Some people take a week over a rung and some take an afternoon; both are fine, and neither tells you anything about whether to move on.

What tells you is the gate. Every rung ends with one thing you must build, derive, or compute by hand. Nothing is tracked and nothing is graded — there is no account to make and no score to keep. The only person who can decide you have passed is you, and the only person you could fool is you.

Start where you honestly are, not where you would like to be. If you cannot pass a rung’s gate, the rung above it will not hold your weight. Print a rung to get its gate on paper.

48 of 48 rungs are written so far. The rest are mapped, in order, so you can see where this goes before you start.

In grades 9–12, the same rungs sit inside a four-year college-track project — mechanical engineering, electrical engineering, computer science, marine biology, pre-med, pre-law, or a doctoral on-ramp. Pick a track and do this week’s work.

Phase 1 — Logic, functions, symbols

  1. 1Instructions a machine could followTurn something you can already do into steps that leave nothing to judgement.
  2. 2Loops and branchesTwo shapes that let a short procedure do a long job.
  3. 3Variables and stateA box with a name, whose contents change while the procedure runs.
  4. 4Function as a black boxOne input in, one output out, and the same answer every time.
  5. 5Balancing equationsThe equals sign is a constraint, not an instruction to compute.
  6. 6The coordinate planeWhere a function stops being a table and becomes a shape.
  7. 7Python: syntax and typesYour first real language, and the discipline of saying what kind of thing you mean.
  8. 8Python: files and automationMake the machine do something tedious that you actually have to do.

Phase 2 — Structure, proof, discrete systems

  1. 9Exponents and their inverseRepeated multiplication, and the question that forces you to invent logarithms.
  2. 10Logarithmic scaleWhy a straight line on a log axis means something is multiplying.
  3. 11Polynomials and rootsCurves whose shape you can predict before you plot a single point.
  4. 12Complex numbersRotation, not imagination.
  5. 13DeductionEvery step justified by a step already earned.
  6. 14Proof techniqueContradiction and induction, the two workhorses.
  7. 15Boolean algebraTruth tables and gates — the arithmetic underneath the hardware.
  8. 16CountingPermutations, combinations, and why confusing them changes the answer.
  9. 17SetsUnion, intersection, complement — and the language everything else is written in.
  10. 18Arrays, lists, dicts, and Big OHow data sits in memory, and how to say what it costs.

Phase 3 — Calculus and complexity

  1. 19LimitsWhat a value approaches, including where it never arrives.
  2. 20The derivativeThe slope of a curve at a single point.
  3. 21Rules of differentiationThe handful of patterns that cover almost everything.
  4. 22The chain ruleThe one rule every neural network is built out of.
  5. 23Integration and the fundamental theoremAccumulation, and its startling link back to slope.
  6. 24Series and convergenceInfinitely many terms that add to a finite number — sometimes.
  7. 25RecursionA procedure that calls itself and terminates anyway.
  8. 26Trees and heapsStructures that are fast because of their shape.
  9. 27Sorting and searching under constraintReal problems, with a time and space budget.

Phase 4 — Many dimensions

  1. 28VectorsA list of numbers that also has a direction and a length.
  2. 29Matrices as transformationsA matrix is not a grid of numbers. It is something that happens to space.
  3. 30Systems, determinants, rankWhen a system has one solution, none, or infinitely many — and why.
  4. 31Basis and change of basisThe same vector, described from a different point of view.
  5. 32Partial derivativesSlope in one direction, while everything else holds still.
  6. 33The gradientThe arrow that points straight uphill — and therefore, straight downhill.
  7. 34Jacobians and vector fieldsDerivatives when both the input and the output have many dimensions.
  8. 35Graphs, DAGs, tensorsThe structures a modern model is actually made of.

Phase 5 — Spectra, probability, optimization

  1. 36Eigenvalues and eigenvectorsThe directions a transformation leaves alone.
  2. 37SVD and dimensionality reductionThrow away most of the numbers and keep almost all of the meaning.
  3. 38Continuous distributions and PDFsProbability when the outcomes cannot be counted.
  4. 39Expectation, variance, covarianceThe centre, the spread, and whether two quantities move together.
  5. 40Bayes' theoremUpdating a belief when the evidence arrives.
  6. 41Convexity and gradient descentRolling downhill, and when you can trust where you land.
  7. 42Lagrange multipliersOptimising when you are not free to go anywhere.
  8. 43Entropy, cross-entropy, KL divergenceMeasuring surprise, and the price of being wrong about it.

Phase 6 — Build it

  1. 44Forward pass from scratchA network is a stack of matrix multiplies with a nonlinearity between them.
  2. 45Backpropagation from scratchThe chain rule, applied at scale, in your own code.
  3. 46Attention from scratchA dot product decides what to look at, and everything follows from that.
  4. 47DiffusionAdding noise on purpose, then learning to remove it.
  5. 48Reinforcement learningLearning from consequences instead of answers.