Naming a rule
Before thisread these first
After thiswhat you will be able to doApply a named rule from f(x), compose two rules in the written order, and check whether reversing that order changes the output.
Questionwhat this lesson answersA rule you use over and over needs a shorter name than a sentence. What do the brackets in f(x) actually say, and what changes when one rule takes another rule's output?
Not coveredwhat this lesson leaves outWe name a rule, apply it, and feed one into another. We do not ask which inputs a rule accepts or what it can produce, which is where the words domain and range belong. We do not ask whether a rule can be run backwards. We do not treat rules that take more than one input.
You keep doing the same thing to different numbers. Double it, then add three.
Writing that sentence out every time is fine once. It is not fine when the same instruction turns up forty times on a page, or when you want to say something about the instruction itself rather than about any one number.
Give the rule a letter
Call the rule . Now write
which says: apply rule to 4, and 11 comes out.
The brackets are the part to be careful with. They do not mean multiply. is not times 4. The brackets say “apply this rule to what is inside”, and the letter in front names which rule.
A letter can name a number, as in , and a letter can name a rule, as in . Which one it is doing is told by whether brackets follow it. That is the whole convention.
To talk about the rule working on any number rather than on 4, put a letter inside:
Read left to right: rule , applied to , gives .
The same input always gives the same output
A rule has to answer the same way every time it meets the same input.
That is not a discovery about rules found in nature. It is built into what the notation means. If could be 9 today and 12 tomorrow, then writing would not name a number, and nothing could be done with it.
Feeding one rule into another
Now take a second rule. Call it , and let it add three.
Apply first, then to whatever came out. Written down:
Work outward from the innermost brackets. is inside, so goes first. Then acts on its result.
The island shows the two orders that matter. The picture runs left to right: the value enters, hits the first box, then the next. The written form grows outward from the middle: the rule applied first ends up buried innermost, and the rule applied last sits on the outside.
Those two directions are opposite, and that mismatch is the single most common way to misread this notation. There is no trick to it. The innermost brackets happen first.
Order changes the answer
Take as double it and as add three, and start from 5.
Apply then : doubling gives 10, adding three gives 13.
Apply then : adding three gives 8, doubling gives 16.
Different answers, from the same two rules and the same starting number. So and name different things, and the brackets change the meaning rather than decorating it.
For this particular pair the answers differ by exactly 3 at every starting number, and they never agree anywhere. Other pairs of rules behave differently, and some do give the same answer either way. Whether a particular pair can be swapped is a question about those two rules, and it has to be checked rather than assumed.
What a rule is allowed to be
Nothing so far said the rule has to be arithmetic.
A rule can be a lookup in a table. It can be a procedure with several steps. It can take a whole list of numbers and hand back another list, which is how the notation gets used once vectors arrive: a name, some brackets, a list going in and a list coming out.
The notation does not care. It says one thing only: there is a rule, here is what it was given, and here is what it returned.
Doorswhat to read next, and why
- A slope is a local statementA slope measures how one rule's output responds when its input is nudged, so it needs a rule to have been named first.
- Chaining two responsesnot written yetWhen rules are fed into each other, the responses multiply along the chain. That rule is not built here.
- Two rules fix the whole transformA rule can take a whole list of numbers and return another list, and the ones that preserve addition and scaling are a particular kind worth their own lesson.
- The transformer blocknot written yetThis lesson explains notation for a single rule, but it does not trace the sequence of attention, feedforward, residual, and normalisation operations inside a transformer block.
Symbolswhat each one means, and whether we defined it, measured it, or just started there
- fStatus: defined
- A letter naming a rule rather than a number. The letter is a label chosen for convenience, and picking a different letter changes nothing.
- f(x)Status: defined
- The result of applying rule f to the value x. The brackets say apply, and they are not a multiplication sign.
- one input, one outputStatus: defined
- A rule gives the same output every time it meets the same input. This is defined into what a rule is, because without it f(3) would not name any particular number.
- g(f(x))Status: defined
- Apply f to x first, then apply g to what came out. Defined to work outward from the innermost brackets, so the rule written last is applied first.
- whether the order can be swappedStatus: empirical
- Applying two rules in the other order usually gives a different answer. That is a fact about the particular rules, not about the notation, so it has to be checked case by case.
What these classifications mean
- defined
- circular by construction, true because we chose it
- empirical
- a measured claim about the world that could have come out otherwise
- bottoms out
- a primitive of the model, with nothing under it here
- door
- used here, explained elsewhere