Algebra slips are small and quiet: a minus sign that goes missing when a term moves across, an inequality that should have flipped, a single = where a == belonged. Most of them still produce an answer, which is what makes them dangerous. This review gathers the slips Module 2 warned about, shows the quick check that catches each one, mixes problems from across the module, and collects the module's formulas on one sheet, ready for Module 3. Last, a map of a model that learns shows where each formula does its work.
What you'll be able to do
Spot the common slips of Module 2: lost signs, unflipped inequalities, = for ==, positions used as values, and split logs
Find and fix slips in code that runs but gives a wrong answer
Mix problems from every lesson of the module, choosing the right method for each
Use the module's formula sheet: each formula, what it says, and its Python line
Quick check
Have a guess before you start. A learner solves 5 − x = 2 and writes x = −3. What went wrong?
It has no solution
Nothing: x = −3 is right
They should have divided by 5
A sign was lost: x = 3
Show the answer
A sign was lost: x = 3
Take 5 from both sides: −x = −3, so x = 3. Putting −3 back gives 5 − (−3) = 8, not 2. Checking catches it at once.
Find the slip
Purpose. Most Module 2 slips fall into a few kinds, each with a quick check:
Put it back. Any solved equation can be checked by substituting the answer. A lost sign shows at once.
Try a number. For an inequality, try one value on each side of your answer. If the wrong side passes, the sign should have flipped.
Test both directions. A rearranged formula or an inverse must round-trip back to the start.
Read the code aloud.= stores and == asks; xs[2] is the third item, not the value 2.
Check a law with numbers. If you're unsure a rewrite is allowed, like splitting a log, one line of Python with easy numbers settles it.
Below are ten worked lines, written as Python with a comment saying what each should give. Five have a slip.
Try it now
How the checks catch them. Each slip breaks one quick check. Put y = 20 back into 2x + y = 14 with x = 3: 26, not 14. Try x = 0 in −3x < 12: it passes, but 0 isn't below −4, so the sign had to flip. One Python line shows log₁₀(10) isn't log₁₀ 16. Reading if score = 0.5 aloud as "if score stores 0.5" sounds wrong at once. And x₂ in math is the second term, which is xs[1] in code. The next check is one you can run in your head.
Quick check
What does this print?
import math
print(math.log10(2 + 8), math.log10(2) + math.log10(8))
1.0 1.0
1.2041199826559248 1.2041199826559248
1.0 1.2041199826559248
0.3010299956639812 1.0
Show the answer
1.0 1.2041199826559248
log₁₀(10) is 1.0, but log₁₀ 2 + log₁₀ 8 is log₁₀ 16 ≈ 1.204. A sum inside a log doesn't split.
Slips that hide in code. The worst algebra slips in code raise no error. A missing pair of brackets in c - b / a quietly divides only b. An elif chain with its lowest bar first gives every high score the lowest grade. A range(1, n) silently skips the first item or the last. Each one runs and prints a confident wrong number. The two drills below are slips of exactly this kind.
Quick check
A learner expands (x + 3)² as x² + 9. Which check shows it's wrong?
Try x = 0: 9 against 9
Count the terms: there are two
Square 3: 9 is right
Try x = 1: 16 against 10
Show the answer
Try x = 1: 16 against 10
(1 + 3)² = 16, but 1 + 9 = 10. The middle term, 6x, is missing: (x + 3)² = x² + 6x + 9.
Drill
Every A comes out as a C
This grade function runs without an error, but a score of 95 gets a C. Find the one slip and fix it.
In the lesson, your code is checked as you write it.
In your own words
Which of the quick checks would have caught the most slips in this part, and why?
Write a sentence or two, then compare it with a good answer in the lesson.
Mixed practice
Purpose. Each problem below comes from a different lesson of Module 2, in mixed order. Deciding which tool a problem needs is half the skill, so name the lesson before you start each one. If one stops you, the steps show the way, and the formula sheet in the last part has every rule in one place.
Worked example
Worked example: check a solution three ways
Solve 3x + 5 = 20, then check the answer by putting it back, by a round trip, and by trying a neighbor.
It runs right here in your browser, with nothing to install.
The answer is 5.0, and putting it back gives True. The round trip builds an equation from a known answer, 7, and solves it: back comes 7.0, so the solver itself is right. The last line tries the neighbors 6 and 4: they give 23 and 17, on either side of 20, which is what a correct answer should sit between. Three cheap checks, three kinds of slip ruled out.
Play computer. The five lines below run the module in small: the line through (1, 5) and (3, 9), that line solved backward for the x where it reaches 11, and the answer put back. The lines hide four traps the module warned about: / always gives a decimal, × runs before −, solving undoes the steps in reverse order, and == asks where = stores. Work out every value in your head before you type it, the way Python would print it.
Quick check
What does this print?
xs = [4, 7, 1, 8]
t = 0for i inrange(1, len(xs)):
t = t + xs[i]
print(t, sum(xs))
16 16
12 20
16 20
20 20
Show the answer
16 20
range(1, 4) gives 1, 2, 3, so the loop skips xs[0] = 4: 7 + 1 + 8 = 16. sum adds all four: 20. An off-by-one slip.
Drill
The loss leaves one example out
mse should be the mean squared error over all of preds and ys, but it comes out too small. Find the one slip and fix it.
preds = [3, 5, 9, 4]
ys = [2, 5, 7, 6]
defmse():
total = 0for i inrange(1, len(ys)):
total = total + (preds[i] - ys[i]) ** 2return total / len(ys)
print(mse())
In the lesson, your code is checked as you write it.
In your own words
Which kind of problem in the mixed ladder did you have to stop and think about most? What told you which method to use?
Write a sentence or two, then compare it with a good answer in the lesson.
The formula sheet
Purpose. Every formula of Module 2 in one place, with what it says and its Python line. Lessons 14 to 20:
lesson
formula
in plain words
in Python
14
ŷ = w·x + b
a weight times the input, plus a bias
w * x + b
15
(a + b)² = a² + 2ab + b²
every part times every part
(a + b) ** 2
16
ax + b = c, so x = (c − b)/a
undo in reverse, both sides
(c - b) / a
17
y = mx + b, so x = (y − b)/m
make any letter the subject
(y - b) / m
18
ReLU(x) = 0 if x ≤ 0, else x
a decision by an inequality
if x <= 0:
19
f(x): one output per input
a rule with a name
def f(x):
20
f⁻¹(f(x)) = x
the inverse undoes
f_inv(f(x)) == x
Quick check
Which row of the sheet fixes the slip y = 14 + 2 × 3 for 2x + y = 14 with x = 3?
Lesson 20: the inverse undoes
Lesson 16: undo in reverse, both sides
Lesson 18: a decision by an inequality
Lesson 15: every part times every part
Show the answer
Lesson 16: undo in reverse, both sides
Taking 2x from both sides gives y = 14 − 2x. Doing the same to both sides keeps the sign right.
Lessons 21 to 28:
lesson
formula
in plain words
in Python
21
m = (y₂ − y₁)/(x₂ − x₁)
rise over run
(y2 - y1) / (x2 - x1)
22
add or take away equations
make a letter cancel
(c1 - c2) / (a1 - a2)
23
x = (−b ± √(b² − 4ac))/2a
roots, and the vertex at −b/2a
-b / (2 * a)
24
y = a·rᵗ
the same factor each step
a * r ** t
25
log(ab) = log a + log b
a product's log is a sum
math.log(a) + math.log(b)
26
(1/n) Σ (ŷᵢ − yᵢ)²
the mean squared error
a loop, then / len(ys)
27
m ← β·m + (1 − β)·x
blend each new value into the running one
m = beta * m + (1 - beta) * x
28
f : ℝⁿ → ℝᵐ
n numbers in, m out
len(x) is n
Each row is also a check: if an answer breaks a row, the slip is in that step.
Quick check
Which row of the sheet finds the lowest point of 2x² − 12x + 1, and where is it?
Lesson 21, at x = 6
Lesson 23, at x = 3
Lesson 23, at x = 6
Lesson 24, at x = 3
Show the answer
Lesson 23, at x = 3
A quadratic's lowest point is its vertex, at −b/(2a) = 12 ÷ 4 = 3.
Where Module 2 lives in a model. Most rows of this sheet have a job inside a model that learns. A layer is ŷ = w·x + b, the first row, with many inputs at once. The bend after it, the activation, is an inequality: relu keeps z only when z > 0. A threshold, p > 0.5, turns a chance into a yes or a no, and counting those gives the accuracy. The loss is a squared error averaged with Σ, and its bowl is a quadratic with a vertex. Exponentials make scores positive, and logs turn chances into a loss. Solving and rearranging size a training run: how many steps, epochs or examples per batch. Moving averages smooth a noisy loss and steady each update. And ℝⁿ names the numbers a model takes in. The map below lights Modules 1 and 2 together. The line you traced, y = 2x + 3, is its layer in small: one weight and one bias.
Coming up next. First, six lessons on transposing formulas, starting with lesson 30, take the rearranging from lesson 17 further: fractions, a letter that appears twice, powers and roots, quadratics, and logs. Then Module 3, shapes, angles and waves, uses this sheet constantly. The distance between two points is a square root of squares (lessons 10 and 23). Angles and the sine and cosine functions are functions in lesson 19's sense, and waves are what you get when a function repeats. Module 4 then turns ℝⁿ from lesson 28 into vectors you can add, scale and measure, the core of how models see their data.
In your own words
Pick the formula on the sheet you're most likely to slip on. What check would you use to catch the slip?
Write a sentence or two, then compare it with a good answer in the lesson.
Goes deeper in
Formulas: rewriting and checking formulas in more Python.
31Formulas with fractions: clear them firstFreeClearing denominators, cross-multiplying, a letter in the bottom, and reciprocal formulas like 1/R = 1/R₁ + 1/R₂.35 min
37Inverse functions, lines and scalingFreeUndoing a function by making x the subject, domains that allow it, line forms, and unscaling predictions.40 min
38Sequences and sums: find n, a, d and rFreeEvery letter of the arithmetic and geometric formulas as the subject, and an average's window from its decay.40 min
40Review: rearrange anything (algebra)FreeBroken rearrangements to fix, mixed practice from the whole algebra block, a strategy chart, and its formula sheet.35 min
41Coordinates and distanceFreePoints as (x, y), Pythagoras, distance in any number of coordinates, and nearest neighbors.42 min
42Angles, degrees and radiansFreeMeasuring a turn, converting units, arcs, and the angle between two arrows.36 min
43Sine and cosineFreeAcross and up: right triangles, the unit circle, and directions and rotations.42 min
44Waves: height, speed and shiftFreeAmplitude, period and phase, sampling a wave, and position codes in transformers.37 min
68Vector equations: rearranging with arrowsFreeSolving for a vector or a scale, recovering a gradient from two weight snapshots, and an angle from a dot product.40 min
87Counting: choices, orders and groupsFreeThe counting principle, factorials, ordered picks and groups, and why attention's cost grows with the square of the length.43 min
88Probability: from counts to chancesFreeEqually likely outcomes, the complement, distributions, seeded simulation, and a next-word model.43 min
89Combining events: and, or, independentFreeThe or rule, independence, probability trees, drawing with and without replacement, and chains of steps.42 min
100Maximum likelihoodFreeLikelihoods as products, log-likelihoods as sums, grid search, underflow, and the negative log-likelihood loss.45 min
101Linear regression: the best lineFreeResiduals, least squares by formula, three roads to one line, the matrix form, and train versus test error.45 min
109One neuron, start to finishFreeWeighted sum, activation, loss, slopes and update, by hand and in code, and what one straight line can and can't split.45 min
111Training a small networkFreeThe backward pass in matrix form, gradient checks, a full training loop, and reading loss curves.45 min
112The same network in PyTorchFreenn.Sequential with the NumPy weights loaded, the same loss and slopes, then SGD and mini-batches.45 min
113Attention as matrix mathFreeScaled dot-product scores, the causal mask, a row-by-row softmax, and blending value vectors.45 min
114Residual connections and layer normFreeAdding the input back and why its slope keeps learning alive, layer norm by hand, and add and norm.40 min
115A transformer block, start to finishFreeA sentence through embeddings, attention, add and norm, a small network and next-word scores, every shape named.45 min
117Final test: transpose any formulaFreeSlips to fix from every topic, mixed practice of every kind of rearranging, the strategy chart and the full sheet.45 min
Learn the math behind AI from arithmetic up: numbers, algebra, vectors and matrices, calculus, probability and statistics, each shown as numbers moving and checked in Python, ending with a network you build and train from the formulas.
See the course →
Never trained an AI? Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account. Teach it to write