๐ Key idea of this section
A function is a rule: put a number in, get exactly ONE number out. We name the machine f and write f(x) for "the output when x goes in."
Imagine a machine with a hopper on top and a chute on the bottom. You drop a number in the top, the machine follows its recipe, and out comes an answer. That machine is a function.
Here's a machine with the recipe "double it, then add 1":
drop in 0 โ out comes 1 drop in 1 โ out comes 3 drop in 2 โ out comes 5 drop in 3 โ out comes 7
The golden property of every function: each input gets exactly ONE output. Drop in 3 a hundred times, and you get 7 a hundred times. The machine never changes its mind.
The vending machine test
A good vending machine is a function: press D4, get the pretzels โ every time. A broken machine that sometimes gives pretzels and sometimes cookies for the same button is NOT a function, because one input gives different outputs. One input, one output โ that's the law.
The official notation: f(x)
Writing "drop in 3, out comes 7" gets tiring, so mathematicians name the machine (usually f, sometimes g or h) and write:
f(x) = 2x + 1
Read it "f of x equals 2x + 1." It means: the machine f runs the recipe "double the input, then add 1." Then f(4) means "the output when 4 goes in." Watch every step:
Step 1: f(4) = 2 ร 4 + 1 (replace every x in the recipe with 4) Step 2: f(4) = 8 + 1 (multiply first โ order of operations) Step 3: f(4) = 9 (add)
Negative inputs are welcome too. Find f(โ1):
Step 1: f(โ1) = 2 ร (โ1) + 1 (replace x with โ1 โ use parentheses!) Step 2: f(โ1) = โ2 + 1 (2 ร (โ1) = โ2) Step 3: f(โ1) = โ1 (climb from โ2 up by 1)
Two more vocabulary words you'll meet everywhere:
The DOMAIN of a function is the set of all allowed inputs. The RANGE is the set of all outputs it can actually produce.
For f(x) = 2x + 1, any number can be doubled and incremented, so the domain is all real numbers. And any target y can actually be produced (we'll prove this in Lesson 7 by running the machine backwards), so the range is also all real numbers. Compare with the flat machine f(x) = 4: its range is just the single number 4, because it only ever says "4."
โ๏ธ Your Turn!
Let f(x) = 3x โ 2. Find f(4) and f(โ1), showing each step.
๐ Show the answers
Answer: f(4) = 3 ร 4 โ 2 = 12 โ 2 = 10. And f(โ1) = 3 ร (โ1) โ 2 = โ3 โ 2 = โ5 (from โ3, subtract 2 more). The machine always triples the input, then subtracts 2.