Chapter 7 gives functions a full formal treatment — injective, surjective, bijective, the works. Before that, this course needs the plain vocabulary settled: not "a formula you plug numbers into," but a rule assigning each input from one set to exactly one output in another. That reframing — function as assignment between sets, not just algebra — is the lens every later chapter, including relations and counting, quietly assumes.
Think of the domain as a row of labeled mailboxes. The codomain is a row of labeled mail slots at the post office. Every mailbox's letter goes into exactly one slot. No letter gets split between two slots, and none goes missing. The codomain lists every slot that exists, whether or not mail ever lands there. The range is only the slots that actually received something. A rule that delivers one letter to two different slots is not a broken function. By definition, it isn't a function at all.
A function f: A \to B assigns to every element of A (the domain) exactly one element of B (the codomain). Write f(a)=b when f assigns a \in A to b \in B. The range (or image) of f is the subset of B actually hit by some input — \{f(a) : a \in A\} — which can be smaller than the whole codomain. "Exactly one" is the entire content of the definition: a rule assigning some input to two different outputs, or to none at all, is not a function. Concretely, for f: \mathbb{Z} \to \mathbb{Z} given by f(n) = n^2, the codomain is all of \mathbb{Z} by declaration, but the range is only the perfect squares — f never actually produces a negative output, even though negatives sit in the codomain it was declared into.
Domain in, codomain out
Send each input through f(x) = x^2 - 3. Every input from the domain produces exactly one output -- confirm no input ever produces two different results.
Loading interactive…
Function or not a function
Sort each input-output rule by whether it's a genuine function -- every input assigned to exactly one output.
Loading interactive…
Worked example
Identify domain, codomain, and range
-
1
For f: \mathbb{Z} \to \mathbb{Z} defined by f(n) = n^2, describe the domain, codomain, and range.
-
2
Domain and codomain are stated directly in the notation f: \mathbb{Z}\to\mathbb{Z}: both are \mathbb{Z}, the full set of integers.
-
3
The range is only what's actually hit. Since n^2 \ge 0 for every integer n, and every nonnegative integer that's a perfect square is hit (e.g. f(3)=9), the range is \boxed{\{0, 1, 4, 9, 16, \ldots\}} Notice the range (\{0,1,4,9,\ldots\}) is a proper subset of the codomain (\mathbb{Z}) — negative integers and non-squares like 2 are in the codomain but never produced.
Loading interactive…
Worked example
Decide whether a rule is a function
-
1
Is the rule assigning each positive integer n to "a prime factor of n" a function from \mathbb{Z}^+ to \mathbb{Z}^+?
-
2
Check the "exactly one output" requirement directly against a specific input rather than arguing in the abstract.
-
3
n=6 has two different prime factors, 2 and 3 — the rule doesn't say which one to pick, so it assigns 6 to more than one output.
-
4\boxed{\text{Not a function} \text{ -- fails at } n=6}
"The prime factorization of n" (the full list) would be a function into sets of primes; "a prime factor" (unspecified which one) is not a function into \mathbb{Z}^+ at all.
Where this goes next
Chapters 7, 8, and 9
Every idea Chapters 7 through 9 build — one-to-one, onto, composition, inverses, recursively defined sequences — is stated in exactly this domain/codomain language, never "plug in a number and see what comes out." A relation (Chapter 8) is what you get by dropping the "exactly one output" requirement entirely; seeing a function as the special case of a relation that happens to satisfy it is what makes Chapter 8's whole framework click instead of feeling like an unrelated new topic.
Check your understanding (counts toward your progress)
In f: A \to B, what is B called?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
Why
B, the set the function maps INTO, is the codomain by definition.
Which rule assigning students to something FAILS to be a function?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
Each student has exactly one student ID -- this rule is a genuine function.
Each student has exactly one current age -- this rule is a genuine function.
Each student has exactly one birth year -- this rule is a genuine function.
Why
A student enrolled in more than one course gets assigned more than one output, breaking the exactly-one-output rule every function requires.
The range of a function is always...
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
Why
The range is only what is actually produced -- it can be smaller than the codomain, though never larger.
Which rule is NOT a function from real numbers to real numbers?
Right on try — credit. Right — the answer had already been shown, so no credit this time. Next try is worth Answer shown after three tries — this one no longer earns credit. You chose to see the answer — this one earns no credit.
Why
For x=4, both y=2 and y=-2 satisfy y^2=4 -- two valid outputs for one input, so this rule is not a function.