Numbers & Functions

3 Functions as Machines

CHAPTER 3 Functions as Machines At the end of the last chapter I let something slip in, almost casually, and I want to come back to it because it’s the most important idea in this whole book. We kept talking about doing things to numbers. Squaring. Rooting. Doubling. Each one takes a number, does something to it, and hands you back another number. Put in 5, squaring gives back 25. Put in 2, square-rooting gives back about 1.414.

That pattern — feed in a number, get a number out — is so ordinary that you’ve been doing it your whole life without naming it. But it deserves a name, because once you see it everywhere, mathematics stops being a pile of separate tricks and starts being one connected thing.

The name is function. And the best way to picture a function, at least at first, is as a machine.

3.1 The machine picture

Imagine a little box with a funnel on top and a spout on the bottom. You drop a number in the top. The box does something to it. A number comes out the bottom.

That’s a function. This particular one we’d call the squaring machine. Drop in 5, out comes 25. Drop in 3, out comes 9. Drop in −4, out comes 16 (because −4 times −4 is 16).

Mathematicians have a shorthand for this machine: f(x) = x2 Don’t let the symbols scare you — they’re just labels for the picture you already understand. Let me translate every piece: • f is the name of the machine. (We could’ve called it Bob.)

SQUARE 25 you drop a number in, the machine does its thing, a number comes out Figure 3.1. A function is a machine: input →rule →output. Drop 5 into the squaring machine and 25 comes out the spout. This box is a motif we’ll reuse all the way to neural networks.

• x is whatever number you drop in — a stand-in, a blank box waiting to be filled.

• f(x) — read “f of x” — means “what the machine f gives back when you feed it x.”

• x2 is the rule for what this particular machine does.

So f(x) = x2 is just a compact way of writing “the machine that squares whatever you give it.” When we want to know what it does to 5, we write f(5) and work it out: f(5) = 52 = 25. Once that clicks, a huge amount of mathematics suddenly becomes readable, because this notation is everywhere.

All 8 chapters of Numbers & Functions · Foundations · All courses