What is a Function? — From Intuition to Precision
Think of a function as a machine that takes an input and gives you exactly one output. You put something in, the machine does a fixed operation, and out comes a result. If you put the same input in again, you always get the same output.
A vending machine is a good analogy. You press a button (input), and it gives you a specific snack (output). Pressing the same button again gives you the same snack. That's a function. But if pressing the same button sometimes gave you chips and sometimes gave you chocolate, that machine would not be a function.
The Intuition: A Rule That Matches
At its simplest, a function is a rule that pairs each element from one set (the domain) with exactly one element from another set (the codomain). The key word is exactly one.
Consider the rule "square the number". If you give it 3, you get 9. Give it -3, you also get 9. That's fine — two different inputs can give the same output. But if you give it 3, you must always get 9, and never anything else.
A function is not the same as an equation. An equation like y=x2 can represent a function, but the function is the rule itself, not the equation. The equation is just one way to describe the rule.
The Precise Definition
A function f from a set A to a set B, written f:A→B, is a rule that assigns to each element x in A exactly one element y in B. We write y=f(x), read as "f of x".
The set A is the domain — all possible inputs. The set B is the codomain — the set that contains all possible outputs. The actual outputs that occur are called the range, which is a subset of the codomain.
f:A→B,x↦f(x)
For every x∈A, there exists exactly one y∈B such that y=f(x).
The Vertical Line Test — A Visual Check
If you graph a function on the xy-plane, the input is x and the output is f(x). The vertical line test tells you whether a graph represents a function: if any vertical line crosses the graph more than once, it is not a function. …