// learn.shawon.ch / math-for-ai / addition-and-subtraction STUDY GUIDE
← Mathematics for AI

Mathematics · Arithmetic

Addition is counting on; subtraction is that walk reversed

Try this first

You have 7 unread emails. Four more arrive. You know instantly there are 11 — but slow down: what did your mind actually do to get from 7 to 11?

Almost certainly you didn't recount from one. You started at 7 and went on — eight, nine, ten, eleven — taking four steps forward. That's the whole of addition: counting on. To add 4 to 7 is to begin at 7 and step forward 4 places along the counting sequence you met in the last lesson.

Lay that sequence out as a line, evenly spaced, and addition becomes motion: 7 + 4 means "stand on 7 and hop right 4 times." Subtraction is the very same line walked the other way. 11 − 4 means "stand on 11 and hop left 4 times," landing back on 7. Add then subtract the same amount and you're exactly where you started — which is the precise sense in which subtraction undoes addition.

024 6810 12 7 11 + 4
Stand on 7, hop right four times, land on 11. Subtraction walks the same line the other way.

The one idea

Addition combines two counts into one — equivalently, it steps forward along the number line. Subtraction is its inverse: a − b asks "what do I add to b to reach a?"

The rules that fall out for free

Because adding is just merging two piles, a few facts are true no matter the numbers — and they're worth naming, because they come back constantly.

Facts that hold for all numbers
RuleWhat it saysCatch
Order (commutative)3 + 5 = 5 + 3Fails for subtraction: 5 − 3 ≠ 3 − 5
Grouping (associative)(2+3)+4 = 2+(3+4)Also fails for subtraction
Identityn + 0 = nAdding zero changes nothing

That last one looks trivial, but "add something that changes nothing" turns out to be a load-bearing idea: it's why a bias of zero or a residual connection can pass a value through untouched. And notice the gap the table hints at — if you try 3 − 5, you walk left off the end of zero. The number line doesn't stop there; it continues into negative numbers, which is exactly the next lesson.

Work one, then finish one

Worked: 13 − 8. Instead of "taking away," ask the inverse question: "8 plus what makes 13?" Count on from 8 — nine, ten, eleven, twelve, thirteen — that's 5 steps. So 13 − 8 = 5. Reading subtraction as a missing-addend question is usually faster and far less error-prone.

Your turn: A model's accuracy climbs from 71% to 86%. How many percentage points did it gain? Phrase it as the inverse: "71 plus what makes 86?" (Answer: 15, because 71 + 15 = 86.)

Why this earns a place in your toolkit

Addition is, by sheer volume, the most-executed operation in all of machine learning. A single artificial neuron computes a weighted sum — multiply each input by a weight, then add them all up. Training sums a loss across thousands of examples and accumulates gradients by adding contributions together. Subtraction carries its own starring role: a model's error is literally prediction − target, and "how much did the loss change this step?" is a subtraction. When you later watch a GPU multiply giant grids of numbers, the second half of every one of those operations is this: add the pieces up.

Recall check · no peeking

  1. Rewrite 15 − 9 as an addition (missing-addend) question.
  2. Why does 4 + 9 = 9 + 4 while 4 − 9 ≠ 9 − 4?
  3. On the number line, which direction is subtraction, and what undoes a hop of +6?
  4. What does adding 0 do, and where in a neural network does "add something that changes nothing" show up?

Explain it back

In one sentence, explain why subtraction is just "addition asked backwards."

Learn · Shawon Chowdhury · a study guide, kept rough on purpose