Lenses, circuits, shared jobs and a model's precision all have formulas full of fractions, and the letter you want is often in a denominator. The reverse-order method from the last lesson still works, but one first move makes these much easier: multiply every term by the denominators, and the fractions disappear. Then transposing it is an ordinary rearrangement. You'll also meet the one mistake people make most with fractions, and see why it fails.
What you'll be able to do
Clear the fractions from a formula by multiplying every term by the denominators
Cross-multiply when each side is a single fraction
Free a letter from a denominator, including a denominator that is a sum, and state the conditions
Rearrange reciprocal formulas such as 1/R = 1/R₁ + 1/R₂ and the lens formula for each letter
Use rearranged fraction formulas to plan shared work between two machines and to read a model's precision
Quick check
Have a guess before you start. One pump fills a tank in 3 hours, another in 6 hours. Working together, how long do they take?
3 hours
2 hours
9 hours
4.5 hours
Show the answer
2 hours
Rates add, times don't. The first fills 1/3 of the tank an hour and the second 1/6, so together 1/3 + 1/6 = 1/2 a tank an hour: the whole tank in 2 hours.
The math: clear the fractions first
Purpose. One move that gets a letter out of a denominator and removes every fraction at once.
Multiply every term by the denominators. In x/3 + x/6 = 2, the lowest number that 3 and 6 both divide into is 6 (the lowest common denominator). Multiply every term on both sides by 6: 2x + x = 12, so 3x = 12 and x = 4. Every term means every one: multiply only some, and the two sides stop being equal.
Cross-multiplying. When each side is one fraction, a/b = c/d, multiply both sides by b and by d to get ad = bc. In 3/x = 12/20, that gives 3 × 20 = 12x, so x = 5.
A letter in a denominator that's a sum. In y = 12/(2 + x), multiply both sides by (2 + x) to bring the letter up: y(2 + x) = 12. Divide by y: 2 + x = 12/y. Take 2 away: x = 12/y − 2. The conditions: y can't be 0, and 2 + x can't be 0.
Quick check
From an earlier lesson: what is 1/3 + 1/6?
1/2
2/9
1/9
2/3
Show the answer
1/2
Re-cut both into sixths: 2/6 + 1/6 = 3/6 = 1/2. Fractions add over a common denominator, never top plus top over bottom plus bottom.
Watch the machine for y = 12/(2 + x), with x = 4. "12 ÷ it" divides 12 by whatever comes in. Its opposite is itself: dividing 12 by the answer gives back what went in, because 12 ÷ (12 ÷ 6) = 6.
Try it now
Try other inputs, or change 12: the "12 ÷ it" step always undoes itself.
Symbols and formula. Reciprocal formulas add up "one over" things. Two resistors side by side, or two workers sharing one job, follow
R1=R11+R21⇒R=R1+R2R1R2,R2=R1−RRR1
In plain words: to free a letter from a denominator, multiply it up; to clear several fractions, multiply every term by all the denominators. Here that's R R₁ R₂, which turns the formula into R₁R₂ = RR₂ + RR₁.
A named mistake: splitting a fraction's bottom. 1/(a + b) is not 1/a + 1/b. Try a = b = 2: 1/4 against 1/2 + 1/2 = 1. A sum on top splits (the earlier lesson's (a + b)/c = a/c + b/c), but a sum on the bottom never does. To undo 1/R, flip both sides only when each side is one fraction.
Quick check
The lens formula is 1/f = 1/u + 1/v. Make v the subject.
v = uf/(f − u)
v = f − u
v = 1/f − 1/u
v = uf/(u − f)
Show the answer
v = uf/(u − f)
1/v = 1/f − 1/u. Over a common denominator, that's (u − f)/(uf). Flip both sides: v = uf/(u − f). With f = 10 and u = 30, v = 300/20 = 15.
Which first move? If each side is a single fraction, cross-multiply. If several fractions are added together, multiply every term by the lowest common denominator. If the letter sits under a sum, like 12/(2 + x), multiply both sides by that whole sum, kept in brackets. All three do the same job: they move the letter from the bottom of a fraction up to the main line, where the reverse-order method from the last lesson can reach it. Write the conditions as you go: anything you multiplied both sides by can't be 0.
In your own words
Why does multiplying every term by the denominators make a fraction formula easier to rearrange?
Write a sentence or two, then compare it with a good answer in the lesson.
In Python: exact fractions as a check
Purpose. Python's Fraction keeps answers exact, so a reciprocal formula can be checked without decimal noise.
It runs right here in your browser, with nothing to install.
The first line uses decimals: 6 and 3 side by side make 2.0, and other undoes it, giving 3.0. The second line uses Fraction: 6 and 4 make exactly 12/5, and other brings back exactly 4. With decimals, 12/5 would be 2.4, which happens to be exact, but a value like 1/3 can't be written exactly in decimals at all.
Worked example
Worked example: the lens formula, both ways
1/f = 1/u + 1/v, rearranged for v and for f, with the condition u ≠ f in code.
defimage_distance(f, u):
if u == f:
returnNonereturn u * f / (u - f)
deffocal_length(u, v):
return u * v / (u + v)
print(image_distance(10, 30), focal_length(30, 15))
print(focal_length(30, image_distance(10, 30)), image_distance(10, 10))
In the lesson you can change this and run it.
A lens with focal length 10 cm and an object 30 cm away makes an image 15.0 cm behind it, and focal_length turns 30 and 15 back into 10.0. The round trip gives 10.0 too. With the object exactly at the focal point (u = f), the formula would divide by 0: the light comes out parallel and no image forms. The function says so by returning None.
wrong flips the sum, 1/9 ≈ 0.111: the split-the-bottom mistake in reverse. right adds the reciprocals first, 1/6 + 1/3 = 1/2, then flips: 2.0.
Quick check
Which call makes image_distance return None?
image_distance(10, 0)
image_distance(10, 30)
image_distance(10, 10)
image_distance(30, 10)
Show the answer
image_distance(10, 10)
u equals f, so u − f is 0 and the formula would divide by 0. The others all have u − f not 0 (some give odd answers, like a negative image distance, but they don't divide by 0).
Drill
Fix the reciprocals
parallel(r1, r2) forgets to flip the sum, and other(r, r1), which finds R₂ from R and R₁, has its subtraction backward. Fix both.
In the lesson, your code is checked as you write it.
In your own words
Why can Fraction confirm a reciprocal formula more firmly than decimals can?
Write a sentence or two, then compare it with a good answer in the lesson.
In AI and ML: shared work and precision
Purpose. Shared jobs and a model's precision are both fraction formulas, and the planning question usually asks for a letter in a denominator.
Two machines, one job. A dataset takes 6 hours to process on one GPU (a graphics chip that does the arithmetic of training) and 3 hours on a faster one. Rates add, like the pumps: 1/T = 1/6 + 1/3, so together they take T = 18/9 = 2 hours. Rearranged, the same formula answers "how fast must a second GPU be to finish in 4 hours?": T₂ = T·T₁/(T₁ − T) = 4 × 6 ÷ 2 = 12 hours. The condition T < T₁ matters: no helper can make the job slower.
Precision. A model's precision is the share of its "yes" answers that were right: P = TP/(TP + FP), with TP the true positives (right yeses) and FP the false positives (false alarms). Given P and TP, clear the fraction: P(TP + FP) = TP, so FP = TP/P − TP.
Average speeds are reciprocal formulas too. A training run does half its steps at 20 steps a second and half at 5. Its average isn't 12.5 steps a second, because the slow half takes far longer. The times add: each step takes 1/20 or 1/5 of a second, so the average speed is 2/(1/20 + 1/5) = 8 steps a second. Rearranging that kind of formula, for the speed one half must reach to hit a target average, is the shared-work rearrangement again.
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.
Learn to make any letter of any formula the subject: layers undone in reverse order, fractions, a letter that appears twice, powers, roots, quadratics, logs, inequalities, trigonometry, vectors, matrices, calculus, probability, statistics and the formulas inside AI models, each checked in Python.
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