Module 3's slips are small and quiet. A distance missing its square root, an angle in degrees handed to a function that wants radians, a point with its x and y swapped: each still gives a number, just the wrong one. This review gathers them, shows the one quick check that catches each, mixes problems from all four lessons, and collects the module's formulas on one sheet, ready for vectors in Module 4. The habit to take away is the quick check: a known case you can work in your head, like the 3-4-5 triangle or sin 90° = 1, run before you trust any new answer. Last, a map of a model that learns shows where the module's formulas do their work.
What you'll be able to do
Spot the common slips of Module 3: degrees passed as radians, *2 for **2, x and y swapped, and a distance missing its root
Find and fix slips in code that runs but gives a wrong answer
Mix problems from every lesson of the module
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 works out the distance from (0, 0) to (3, 4) and gets 25. What did they forget?
To subtract the points
Nothing: 25 is right
To square the differences
The square root: √25 = 5
Show the answer
The square root: √25 = 5
3² + 4² = 25 is the squared distance. The distance itself is its square root, 5. A 3-4-5 triangle is the quickest check.
Find the slip
Purpose. Four slips cover most of Module 3's mistakes, and each has a quick check:
A missing root. A distance that comes out as a big round square, like 25 for a 3-4-5 triangle, forgot the square root. Check with 3-4-5: the answer must be 5.
Degrees as radians. Check with a known value: sin of 90° must be 1. math.sin(90) gives about 0.894.
*2 for **2. Doubling instead of squaring. Check with a difference of 3: squared is 9, doubled is 6.
x and y swapped. (3, 5) and (5, 3) are different points. Read a point aloud: over 3, up 5.
Below are ten worked lines in Python, with a comment saying what each should give. Four have a slip.
Try it now
How the checks catch them. Each slip fails a one-line test. The missing root gives 25 where a 3-4-5 triangle must give 5. math.sin(30) gives about −0.988, nowhere near 0.5, and a sine of 30° must be positive. The swapped point reads "over 5, up 3" aloud, which isn't (3, 5). And (7 − 2) * 2 is 10, while 5 squared is 25. Predict the next one before you run it.
Quick check
What does this print?
import math
print(round(math.sin(90), 3), round(math.sin(math.radians(90)), 3))
0.894 0.894
1.0 1.0
0.894 1.0
1.0 0.894
Show the answer
0.894 1.0
math.sin(90) reads 90 as radians and gives about 0.894. Converted first, sin 90° is exactly 1.0.
Slips that hide in code. Like Module 2's, these slips run without an error. A function that returns the squared distance looks fine until you check it on 3-4-5. A height worked out with math.sin(deg) gives a plausible-looking number that's simply wrong, sometimes even negative. The two drills below are slips of exactly this kind: each runs, each gives a confident wrong answer, and one known case exposes each.
Quick check
A point should be over 1, up 4. Someone writes it as (4, 1). Where does it land?
At the origin
Over 1, up 4: order doesn't matter
Nowhere: it's an error
Over 4, up 1: a different point
Show the answer
Over 4, up 1: a different point
The first number is always across and the second up, so (4, 1) is 4 across and 1 up: not the same point.
Drill
A distance that's too big
This dist runs, but dist((0, 0), (3, 4)) gives 25 instead of 5. Find the one slip and fix it.
import math
defdist(p, q):
total = 0for i inrange(len(p)):
total = total + (q[i] - p[i]) ** 2return total
print(dist((0, 0), (3, 4)), dist((2, -1), (5, 3)))
In the lesson, your code is checked as you write it.
In your own words
Which known case would you use to check a distance function, and why that one?
Write a sentence or two, then compare it with a good answer in the lesson.
Mixed practice
Purpose. Problems from all four lessons of Module 3, mixed. Name each one's lesson before you start: distance, angles, sine and cosine, or waves. 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: a height with the right units
A 10 m ladder leans at 30° from the ground. Compute its height the wrong way and the right way, and check with a known value.
math.sin(30) treats 30 as radians and gives −0.988, so 10 * math.sin(30) gives −9.88: a ladder reaching below the ground, which is a strong hint something's wrong. Converting first gives 5.0, half the ladder, as sin 30° = 0.5 says. The last line is the known-value check: at 90° the ladder stands straight up, so its height must be its full length, 10.0.
Play computer. The lines below run the module in small: a point (5, 12), the length of the arm from the origin to it, and that arm's height when it leans at 30°, worked out once the right way and once with the ladder's radians slip. They hide four traps the module warned about: a tuple unpacks in order, a square root always gives a decimal, math.sin wants radians, and an angle passed in degrees still gives a number. Work out every value in your head before you type it, the way Python would print it. For the slip, use the sine the worked example printed: math.sin(30) is about −0.988.
Quick check
What does this print?
print((5 - 2) * 2, (5 - 2) ** 2)
9 6
9 9
6 9
6 6
Show the answer
6 9
(5 − 2) * 2 doubles 3 to 6. (5 − 2) ** 2 squares 3 to 9. Only the second belongs in a distance.
Quick check
Which line finds the period of y = sin(5x)?
2 * math.pi / 5
5 / (2 * math.pi)
math.pi / 5
2 * math.pi * 5
Show the answer
2 * math.pi / 5
The period is 2π/k, and k = 5 here: about 1.2566. A bigger k packs the cycles closer.
Drill
A ladder below the ground
This height function runs, but a 10 m ladder at 30° comes out at −9.88 m. Find the one slip and fix it.
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 3 in one place, with what it says and its Python line.
lesson
formula
in plain words
in Python
41
d = √((x₂ − x₁)² + (y₂ − y₁)²)
square the differences, add, root
math.sqrt(dx ** 2 + dy ** 2)
42
radians = degrees × π/180
a full turn is 2π
math.radians(deg)
42
s = rθ
arc = radius × angle in radians
r * theta
43
(cos θ, sin θ), with sin² + cos² = 1
across and up on the unit circle
math.cos(t), math.sin(t)
44
y = A sin(kx + φ), period 2π/k
height, speed and shift
A * math.sin(k * x + phase)
Each row is also a check: if an answer breaks a row, the slip is in that step.
Using the sheet. Read each row in three ways. The formula says what to compute. The plain words say why, which is what lets you rebuild the formula if you forget it: "square the differences, add, root" is just Pythagoras on the gaps between two points. And the Python line is what you'll actually type. When a result looks odd, go down the rows that the calculation used and test each with a known case: the distance from (0, 0) to (3, 4) must be 5, 180° must be π radians, sin² + cos² must be 1, and sin(kx) must repeat every 2π/k. The row that fails is where to look.
Quick check
Which row of the sheet gives the input math.cos needs for 45°?
Lesson 41: the distance formula
Lesson 43: sin² + cos² = 1
Lesson 44: the wave formula
Lesson 42: radians = degrees × π/180
Show the answer
Lesson 42: radians = degrees × π/180
math.cos takes radians, so 45° must be converted first: math.cos(math.radians(45)).
Where Module 3 lives in a model. Every row of this sheet works on lists of numbers that point somewhere, which is how a model holds each word: as a vector. The distance formula says how far apart two word vectors are, and the nearest ones tend to mean similar things. The angle between two vectors, through its cosine, says whether two meanings point the same way. (cos θ, sin θ) is a direction with length 1. And the waves give each position in a sentence its own code, added to its word's vector. So the map below lights one place, the vectors, where all four lessons do their work. The arm you traced, from (0, 0) to (5, 12), is a vector already: two numbers, a length and a direction.
Coming up next. First, lesson 46 runs this module's formulas backward: finding an angle from two sides, and when a wave reaches a height. Then Module 4, where vectors take this module's ideas into any number of dimensions. A point like (3, 4) becomes an arrow; the distance formula becomes the arrow's length, its norm; and (cos θ, sin θ) is the first example of a unit vector, all direction and no size. The angle between two arrows from lesson 42 gets computed from their numbers, using the cosine, in lesson 51: how models measure that two meanings point the same way. The quick checks come along too. A length must never be negative, a unit vector must have length 1, and two arrows at right angles must give a cosine of 0. Module 4 adds a check of its own: the shapes of two grids must fit before they can be multiplied.
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.
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