Refresher: Numbers, Powers & Algebra
The school maths every later lesson assumes, explained from scratch: the order of operations, negative numbers, fractions, decimals and percentages, powers and roots, scientific notation, and rearranging an equation to find an unknown.
Why start here?
Machine learning maths is built from a small number of school ideas used over and over. If any of them feels shaky, everything after it feels hard, even when the new idea is simple. This lesson rebuilds those foundations quickly, with no assumptions. If you are confident with algebra, skim it and do the practice questions at the end: if you get them right, move on.
The order of operations
When a calculation has several steps, everyone has to do them in the same order or we get different answers. The rule (often remembered as BODMAS or PEMDAS):
- Brackets first.
- Powers (and roots).
- Multiplication and division, left to right.
- Addition and subtraction, left to right.
So , not 20, and . Also (the power happens before the minus), while . Python follows exactly the same rules.
Negative numbers
Subtracting a negative number adds: . When multiplying or dividing, two negatives make a positive and one negative makes a negative: , . The absolute value is the distance from zero, always positive: . Errors in ML are often negative (the prediction was too low), and their absolute values or squares are what we average.
Fractions, decimals and percentages
They are three ways to write the same thing: . "Per cent" means "per hundred", so is .
- To find 15% of 80: .
- To increase 80 by 15%: . To decrease by 15%: .
- Percentage change from old to new: . From 80 to 92 is .
- Fractions multiply straight across: . Dividing by a fraction is multiplying by its flip: .
Model accuracy, error rates and probabilities are all fractions of this kind: an accuracy of 0.92 means 92%.
Powers and roots
A power is repeated multiplication: . The small raised number is the exponent. The rules follow from that meaning:
| Rule | Example |
|---|---|
The square root is the number that, squared, gives : . Square roots appear everywhere in ML: in distances, standard deviations, and scaling inside transformers.
Scientific notation
Very big and very small numbers are written as a number between 1 and 10 times a power of ten: and . Python and most software write these as 3.2e6 and 4.5e-4, so a learning rate of 1e-3 means 0.001, and a model with 7e9 parameters has 7 billion.
Rearranging equations
An equation says two things are equal. To find an unknown, do the same thing to both sides until the unknown is alone. Undo operations in reverse order:
(subtract 5 from both sides, then divide both sides by 3). The same works with letters instead of numbers. The straight line rearranged for is . Checking your answer by putting it back in is always worth the few seconds: ✔.
Why this matters for AI
A trained model is an equation with numbers filled in. Reading a formula in a paper, and rearranging it to see what affects what, uses exactly these steps.
Try it: the order of operations
Pick an expression and step through how it is calculated.
Interactive: this part runs in your browser.
Practice: check yourself
Work each question out (on paper, in your head, or in Python), type the answer and press ✔ Check. Fractions like 1/4 are fine. Hints and a worked answer are there when you need them.
Summary
Key words
- order of operations
- brackets, powers, × ÷, + −
- absolute value
- distance from zero, never negative
- percentage
- a fraction out of 100
- exponent
- the power in : how many times a is multiplied
- square root
- the number that squared gives a
- scientific notation
- , written 4.5e-4 in code
- equation
- a statement that two expressions are equal
Common mistakes
- Adding before multiplying: is 14.
- is −9, not 9: the power comes first.
- Increasing by 15% with instead of .
- : it is .
- Doing something to only one side of an equation.
Quiz
1. What is ?
2. What is ?
3. A price of 200 rises by 10%. What is it now?
4. What does 3e-2 mean?
5. Solve .