← All MathIsland labs
f(x)Function Lab

The single box on which half of all mathematics is built.

We've been using 'boxes' that turn one thing into another for a very long time.

Put something in, one thing comes out — a function.

Experiment

Hands-on experiment

apple???apple juice

A box that always turns an apple into apple juice, even if you don't know what happens inside — we can call a device like this a box. Could there be a box that eats numbers too?

Experiment 1 — The mystery box

?????

Experiment 2 — The broken box

This box always gets fed the same number, 5. Feed it a few times.

5😵?

Experiment 3 — Build your own Function

Pick two parts and drop them into the box. A function that never existed before is born.

Part 1:
Part 2:
4×2+311
Test input:
Read more — why it exists · insights · common mistakes · formulasExpand ▾

Why

Why does this exist?

Picture a box that always turns an apple you drop in into apple juice. You don't need to know what happens inside — what comes out is decided by what goes in. We can call a device like this a 'box'.

The West named this box after what it does: function, from the Latin functio, 'performance'. East Asia named it after what it looks like — 函數, 'box-number'. Same object, two names: one for the doing, one for the shape. And because writing it out every time got tedious, it got shortened to a single letter, f. So f isn't some scary symbol — it's just the box's name.

So f(3) = 7 is just shorthand for the picture 'I dropped 3 into the box called f, and 7 came out.' On top of this trustworthy box, half of mathematics is built — prediction, graphs, derivatives, even probability distributions.

Insight

Insights from the video

A function isn't a symbol — it's a promise.

The notation f(x) may look intimidating, but its meaning is just a promise: 'put something in, and something determined comes out.' Science and engineering stand on functions precisely because that promise makes prediction possible.

A graph is a single photograph of a rule.

Plot every possible input–output pair as a point and you get a graph. Reading a graph means seeing infinitely many calculated results at a single glance.

Misconception

Common misconceptions

A function needs a formula, like y = f(x).

A formula is just one way to write down a function. A price table, a dictionary (word → meaning), a vending machine's buttons — all of these are functions too. What matters is the promise 'one input, one output', not the formula.

If the output is always the same, it isn't a function (e.g. a machine that always spits out 7).

It's the opposite. Different inputs are allowed to produce the same output (a constant function is still a function). What's forbidden is a single input having multiple outputs.

Formula

Writing it as math

Write the promise you saw in the vending-machine experiment — 'one input, one output' — in the language of mathematics, and you get the following.

Function notation

Feed in an element x of X (the domain) and out comes an element f(x) of Y. f is the machine's name, x is the input, f(x) is the output.

The condition for being a function

Equal inputs must give equal outputs. The 'broken vending machine' in the experiment violated exactly this condition.

Definition of a graph

The collection of every (input, output) pair, plotted on the coordinate plane. If a single vertical line hits the graph twice, it isn't a function (the vertical line test).

In Real Life

Where you meet it in real life

Price tables and policy

Taxi fares, income tax, shipping fees — most of society's rules are designed as functions where the output (amount) is determined by the input (distance, income, weight).

The 'function' in programming

A function in code borrows its name from the mathematical function. The more a function behaves like a pure function — same input, same output — the fewer bugs it tends to have.

AI models

Even ChatGPT is, at bottom, a giant function from 'input sentence' to 'output probabilities'. Learning AI means learning how to find a good function.

Unit conversion

Celsius to Fahrenheit, won to dollars — every converter is a function. You trust it because the same input always gives the same output.

Try Yourself

Test yourself

Q1Suppose f(3) = 9 and f(−3) = 9. One output (9) has two inputs — is this still a function?Show answer ▾

Yes, it's still a function (f(x) = x² works exactly like this). What's forbidden is 'one input, multiple outputs'; 'multiple inputs, one output' is allowed. Mixing up the direction is the most common mistake here.

Q2Is 'student → assigned seat' a function? What about 'seat → student'?Show answer ▾

With assigned seating, both are functions (one seat per student, one student per seat). When a relationship is a function in both directions, an 'inverse function' exists — meaning the relationship can be reversed.

Q3A shipping price table: up to 5kg costs $4, up to 10kg costs $6. Is the fee for a 7.3kg box uniquely determined? Is this a function?Show answer ▾

Yes — it's determined: $6. It's defined by a table rather than a formula, but each input (weight) maps to exactly one output (fee), so it's a complete function. The essence of a function is reliability of the rule, not a formula.

Try answering yourself before revealing it — getting it wrong is where learning starts.

Connection

Concepts connect

Previous concept

x=?

Equations

Where an equation finds 'the single moment things balance', a function looks at 'the entire relationship across every input'. It's the moment your view widens from a point to a relationship.

← Equations lab

Leads to next

ax+b

Linear Functions

Now that you have the language of functions, meet the simplest and most powerful one. A relationship that changes at a constant rate — half the pricing plans in the world are this function.

Go to the Linear Functions lab →

Related

Labs worth exploring together

Related lab

→₩

Take-home Pay

Salary → take-home pay is a function too. See how a 'piecewise function', where the rule changes across ranges, actually works in real life.

Go to the Take-home Pay lab →

Related lab

P(A)

Probability

A random variable is a function from 'event' to 'number'. The language of functions carries straight into the world of uncertainty.

Go to the Probability lab →