A function is a relation with discipline
Last node: a relation on is a subset of pairs. A function is a relation from a set to a set — a subset of — that obeys two rules, no exceptions:
- Total: every input gets an output. For every , there is some with . Nobody in is left unmapped.
- Single-valued: every input gets exactly one output. If and , then . No input maps to two places.
Together: every element of is assigned one and only one element of . We write , and means . That's the whole definition — no formula required. A function is a set of input-output pairs with the discipline that each input shows up exactly once. Nothing more, nothing less, no exceptions.
A formula like is just one convenient way to specify which pairs are in . But the function is the set of pairs , not the squiggle "". The squiggle is not the thing — same fucking lesson as when we built numbers, and you'll keep hearing it until it's reflexive.
Domain, codomain, image — declared versus earned
Three sets travel with every function, and confusing them is a rite of passage you should skip.
- Domain = , the set of all legal inputs. Every element of must get used (totality).
- Codomain = , the declared set of possible outputs. You announce it when you write .
- Image (or range) = the set of outputs that actually get hit: .
The crucial distinction: the codomain is declared; the image is earned. When you write , you declared the codomain to be all of . But the image is only — no negative number is ever an output of squaring. The codomain is a promise about where outputs might land; the image is the truth about where they do land. Always , and often the containment is strict. That gap between declared and earned is exactly where the next lesson's theorems live.
The vertical line test, unmasked
Here's a "rule" you were handed in school with no explanation: a graph is a function iff every vertical line hits it at most once. Why? Because the vertical line test is just "single-valued" in graph clothing.
A graph lives in — it's literally the set of pairs . A vertical line is "all points with first coordinate ". If that line hit the graph at two points and with , then the input would map to two outputs — violating single-valuedness. So "at most one hit per vertical line" is the single-valued rule, drawn. (And for totality, every vertical line over the domain must hit at least once.) Not a magic rule — a picture of the definition.
Well-defined: the word that separates pros from amateurs
Now the deep one, and the real reason this lesson exists. Sometimes a "rule" for a function secretly depends on how you wrote the input, not on the input itself. When that happens, the rule might not even be a function — it's just a process that produces different answers depending on how you dress up the question. You must check that it's well-defined, and most textbooks skip this check entirely, which is why graduates of those programs get eaten alive when they hit quotient spaces.
The danger zone is defining functions on equivalence classes (from the last node — fractions, integers mod ). An equivalence class has many names: the rational is also is also . If you define a function by picking a representative and computing with it, you'd better get the same answer no matter which representative you grab — otherwise your "function" gives different outputs for the same input, violating single-valuedness.
Example of a rule that FAILS. Try to define on the rationals. Test it on the same number written two ways: But — the same input! The rule spat out and for one number. Not well-defined, not a function. It depended on the representation, not the value.
Example that SUCCEEDS. Define . On : get . On : get . Same answer. It only used the value, so it's well-defined. The lesson: whenever a function's inputs have multiple names, prove that different names give the same output before you call it a function. Pros check; amateurs get burned — and they don't even know they're burned until two lessons later when everything mysteriously explodes.
Three views, one object
Finally, the same function wears three costumes, and fluency means switching between them without thinking:
- As a machine: feed in , the box does something, comes out. Great for intuition.
- As a graph: the set of points plotted in . Great for seeing behavior.
- As a set of pairs: . The actual definition — great for proofs.
Drag the bastard -probe and watch the machine view (input output) and the graph view (the point riding the curve) be the same object from two angles:
Machine, graph, set of pairs — one function, three angles. The proofs in the next two lessons (injective, surjective, inverse) all run in the set of pairs view, so get comfortable there. It's the bedrock; the rest is decoration.