What Is a Function?
Definition
A function is a rule that assigns exactly one output to each allowable input. We write
$$f: X \to Y, \qquad y = f(x)$$
where:
- $X$ is the domain — the set of all allowable inputs.
- $Y$ is the codomain — the set that contains all potential outputs.
- $x$ is the argument (input).
- $f(x)$ is the value (output); also called the image of $x$ under $f$.
Mapping Diagram
Think of a function as a machine: you feed in an element from $X$, and the machine produces exactly one element in $Y$.
Why "One Input — One Output" Matters
Not every correspondence between $x$ and $y$ is a function. The defining property is that each input produces exactly one output.
$y = x^2$
For every $x$, there is exactly one $y$. For example, $x = 3 \Rightarrow y = 9$ (only one answer).
$x^2 + y^2 = 4$ (circle)
For $x = 0$, we get $y = 2$ and $y = -2$ — two outputs for one input!
The Vertical Line Test
A graph represents a function if and only if every vertical line intersects the graph at most once. If any vertical line hits the graph in two or more points, the relation is not a function.
$y = x^2$ — Passes VLT ✓
$x^2 + y^2 = 4$ — Fails VLT ✗
Drag the red point left and right. On the parabola, the vertical line always hits one point. On the circle, it can hit two.
Ways to Define a Function
Functions can be specified in several equivalent ways:
| Method | Example | When to Use |
|---|---|---|
| Formula | $f(x) = 2x + 3$ | When a clear algebraic rule exists |
| Table | $\{(1,5),(2,7),(3,9)\}$ | When data is collected experimentally |
| Graph | A curve in the $xy$-plane | For visual analysis of behaviour |
| Verbal description | "Double the input and add 3" | Real-world modelling, word problems |
| Piecewise definition | $f(x) = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}$ | When the rule changes across intervals |