Function Notation

Few scraps of mathematics scare people more thoroughly, for less reason, than f(x). It looks like algebra doing something sneaky — a mystery letter multiplied by another mystery letter in brackets. It is nothing of the sort. It is a name tag. We already met the idea of a function — a machine that turns each input into exactly one output. Function notation is simply how we label the machine and talk about what it does, and once you can read it, it never frightens you again.

Instead of the long-winded "the rule that doubles a number and adds one", we give the machine a short name — usually f — and write down its rule beside the name:

f(x) = 2x + 1

Read it out loud as "f of x equals two x plus one", and hear it as: the machine f, fed the input x, produces 2x + 1. The x inside the brackets is whatever you drop into the hopper; the whole expression f(x) stands for what comes out of the chute. That's the entire grammar: name, then input in brackets, equals output.

Why bother, when y = 2x + 1 says the same thing? Because y = \ldots only works while you have one rule in play. The moment a real problem involves several — a rocket's height, its speed, and its fuel, all depending on time — a pile of anonymous y's becomes chaos. Named machines keep everything straight: h(t) is the height at time t, v(t) the speed, m(t) the fuel mass. Better still, the notation lets you say things y never could: h(3) is "the height at three seconds" in five characters, and v(t) > v(0) is "it's moving faster than it started" in one tidy line. The notation isn't decoration — it's a compact language for asking questions.

The brackets are a slot, not a multiplication

Everywhere else in algebra, brackets next to a letter mean "multiply" — 3(x+2) is three times (x+2). Function notation borrows the same brackets and gives them a completely different job, and that collision is the source of nearly every mistake with f(x). Here the brackets are a slot: whatever sits inside them is what gets fed into the machine.

So f(3) doesn't mean "f times 3" — it means "run the machine f with the input 3". Take the formula, replace every x with 3, and simplify:

f(3) = 2(3) + 1 = 6 + 1 = 7

Try it yourself on the machine below. Pick an input on the slider and watch the rule f(x) = 2x + 1 swallow it: the number appears in the slot, the formula substitutes it in for x, and the output drops out on the right. Slide it to a negative input too — the machine doesn't care; it substitutes and computes exactly the same way.

Notice what stays fixed and what changes as you slide: the rule never moves — only the number in the slot does. That's the mental picture to keep: f is the machine, x is a placeholder for whatever you'll feed it, and f(\text{something}) is the result of feeding it that something.

Worked examples: substitute everywhere

The single skill this page trains is honest substitution: whatever is in the brackets replaces the input variable every time it appears, wrapped in brackets of its own. Let's run one machine through four increasingly interesting inputs. Take

f(x) = x^2 - 3.

1. A plain number, f(3). Replace the x with 3:

f(3) = (3)^2 - 3 = 9 - 3 = 6.

2. A negative number, f(-2). This is where the "wrap it in brackets" habit earns its keep. Substituting carelessly gives -2^2 - 3 = -7 — wrong, because the square only grabbed the 2. With brackets:

f(-2) = (-2)^2 - 3 = 4 - 3 = 1.

3. A letter, f(a). Nothing about substitution requires a number. Feed in the letter a and the machine hands back a formula:

f(a) = a^2 - 3.

4. A whole expression, f(a+1). The entire parcel (a+1) goes into the slot — the whole thing replaces x, so the whole thing gets squared. Expanding honestly:

f(a+1) = (a+1)^2 - 3 = a^2 + 2a + 1 - 3 = a^2 + 2a - 2.

Compare steps 3 and 4: f(a+1) = a^2 + 2a - 2 is not f(a) + 1 = a^2 - 2. Feeding the machine a bigger input is not the same as adding to its output — the machine processes what it's given, and squaring (a+1) stirs the +1 right into the mix. This distinction is the exact muscle you'll use constantly in calculus, where the expression f(x+h) — the machine fed a nudged input — is the opening move of every derivative.

Machines feeding machines

Once machines have names, you can chain them: point the output chute of one at the input hopper of another. The notation stacks the same way the machines do. With

f(x) = x^2 - 3 \qquad \text{and} \qquad g(x) = 3x + 1,

what is f(g(2))? Read it from the inside out, because the inner machine has to finish before the outer one has anything to eat:

g(2) = 3(2) + 1 = 7 f(g(2)) = f(7) = 7^2 - 3 = 46.

And the order matters — these are two different assembly lines. Running them the other way round, g(f(2)) = g(2^2 - 3) = g(1) = 3(1) + 1 = 4. Same two machines, opposite order, wildly different answers (46 vs 4). Chaining machines like this is called composition, and it gets a starring role later in calculus — for now, just get comfortable reading nested brackets from the inside out.

Inputs and outputs on a graph

Every fact written in function notation is also a fact about a picture. The statement f(2) = 5 says: when the input is 2, the output is 5 — and on the graph of f, that is exactly the point (2,\,5). The input runs along the bottom axis; the output is the height of the curve above it. One equation, one dot.

Drag the input below and watch the point (x,\,f(x)) ride along the line y = 2x + 1. The dashed guides show the two-step journey your eye should learn: up from the input on the horizontal axis to the curve, then across to read the output off the vertical axis. Park the slider at x = 2 and you'll see the point (2, 5) — the picture of f(2) = 5.

The translation runs both ways, and reading it backwards is just as useful. Spot the point (-1, -1) on the line? That's the graph telling you f(-1) = -1, no algebra needed. In general:

f(a) = b \quad \Longleftrightarrow \quad (a,\,b) \text{ is on the graph of } f.

Keep the order straight: the input a — the thing in the brackets — is always the first coordinate, and the output b is the second. f(2) = 5 is the point (2, 5), never (5, 2).

Function notation has three classic ambushes. Meet them here so they never get you:

The name is just a label

The letter f has no magic — it's short for "function" the way x is a stand-in for "some number". Any name works, and a well-chosen one carries meaning for free: a height function reads naturally as h(t) ("height at time t"), a cost function as C(n) ("cost of n items"), a population as P(t). The input letter is equally free: t hints at time, n at a count. They all obey the same grammar — feed the input into the brackets, run the rule, read the output:

g(x) = x^2 - 4 \qquad\Rightarrow\qquad g(5) = 5^2 - 4 = 21

One habit worth forming now: when a problem hands you two functions at once, say each statement to yourself in machine language. "C(40) = 12" is "forty items cost twelve pounds"; "h(0) = 1.5" is "the height at time zero — the launch height — is one and a half metres". The notation compresses whole sentences into a handful of symbols, and decompressing them back into words is how you check you've understood a problem before touching any algebra.

Khan Academy works through evaluating with function notation here — a second voice on the same idea:

The notation you've just learned is one of history's great hits. Leonhard Euler introduced f(x) in a paper written in 1734, and it won so completely that today it's hard to imagine mathematics without it. Before Euler, mathematicians wrote functions out in words, or as freestanding formulas with no name at all — fine for one curve, hopeless for reasoning about functions in general. The stroke of genius was to separate the machine from the input: give the rule its own symbol, and suddenly you could write statements about all functions at once — laws like f(g(x)) or, later, f'(x) — without ever spelling out a particular rule.

Euler was arguably the greatest notation designer who ever lived: he also gave us e, popularised \pi, invented \Sigma for sums and i for \sqrt{-1}. Good notation, he understood, isn't just shorthand — it does part of your thinking for you. (Not every notation war ends so cleanly: calculus spent a century split between Newton's dot \dot{y} and Leibniz's \tfrac{dy}{dx}, and both survive to this day.)

And f(x) had a second life Euler never saw coming: it became the function call, the most-typed construct in all of programming. When FORTRAN's designers needed a syntax for "run this procedure on this input" in the 1950s, they simply borrowed the mathematician's brackets — and every major language since has kept them. The code below is Euler's notation, executing. Press Run — and then try editing it: change the rule, or ask it for f(f(1)).

function f(x: number): number { return 2 * x + 1; } console.log("f(3) =", f(3)); // feed it 3 console.log("f(-2) =", f(-2)); // feed it -2 console.log("f(f(1)) =", f(f(1))); // machines feeding machines

Same grammar, same inside-out evaluation of f(f(1)), same "substitute the input everywhere" behaviour. If you ever program, you'll use Euler's notation thousands of times a day.