The machine picture
A function is a rule that takes an input, does something to it, and gives back exactly one output. Picture a vending machine: press B4 and you always get the same snack. The button you press is the input; the snack is the output; the wiring inside is the rule. The whole point is the word *exactly one* — the same input can never come back with two different answers.
The input is the independent variable (we usually call it x), and the output is the dependent variable (usually y), because its value *depends on* what you fed in. A function pairs each x with one y, so it is really a tidy collection of ordered pairs (x, y).
Function or just a relation?
Any set of ordered pairs is a relation. A function is the special, well-behaved kind of relation where no input is reused with a different output. Compare the two tables below: the first repeats the input 2 with two different outputs, so it breaks the rule.
Relation A (NOT a function): x: 1 2 2 3 y: 5 8 9 7 -> input 2 has TWO outputs (8 and 9). Fails. Relation B (a function): x: 1 2 3 4 y: 5 8 8 7 -> every input has ONE output. (8 repeating is fine.) Passes.
The vertical line test
When a relation is drawn on the coordinate plane, there is a one-glance check. A graph represents a function exactly when no vertical line crosses it more than once. This is the vertical line test. A vertical line is one fixed x; if it hits the curve twice, that single x has two y-values, which a function forbids.
- A straight line y = 2x + 1: any vertical line meets it once. Function.
- A circle x^2 + y^2 = 25: a vertical line through the middle meets it twice. Not a function.
- A sideways parabola x = y^2: again two y-values for one x. Not a function.