First PrinciplesStart anywhere. Prove it, then move on.

Rung 4

Function as a black box

One input in, one output out, and the same answer every time.

Best attempted after 1. Instructions a machine could follow. Nothing stops you trying this now — the gate will tell you if you were right.

The gate

Given a function described only by a table of its inputs and outputs, state its rule, predict an output you have not been shown, and then produce an input-output table for a rule of your own that a reader can crack the same way.

Nobody checks this but you. Do it honestly and the rungs above hold; do it loosely and they will not, somewhere further up where the cause is much harder to find.

A function is a machine with one slot and one chute. You put a thing in the slot, one thing comes out of the chute, and putting the same thing in always gives the same thing out. That last part is the rule that makes it a function rather than just a process.

Nothing here is about algebra yet. x is coming, but the idea is older than the notation and easier without it.

Why this is on the ladder

Because "input goes in, output comes out, same every time" is the shape of essentially everything ahead. A Python function. A layer of a neural network. A loss. A whole trained model — a function from an image to a word.

And because the black box framing is what lets you reason about something whose insides you have not learned yet. You will use a lot of boxes on this ladder before you open them.

Do this

Here is a function given only by its behaviour:

inout
14
27
310
516

State the rule in words. Then predict the output for 10, and for 0. Check that your rule explains every row — not most of them.

Now build your own. Choose a rule, make a table of five or six pairs, hide the rule, and hand the table to someone. Watch what they guess. If two different rules explain your table, your table is too small — a fact that will matter enormously at rung 45, where a model that fits your examples and nothing else is the central failure of the field.

Where people get stuck

People find a rule and stop. Check it against every row; a rule that works for three of four rows is not the rule.

The other trap is a table where the same input appears twice with two different outputs. That is not a function at all, and spotting why is worth more than memorising the definition.

Reading