In What Sense Is a Function a Set?
At a glance
- 1. Specify the mapping
Identify the domain and codomain, then state which output each domain element receives.
- 2. Form ordered pairs
Pair each input with its output to make the function’s graph.
- 3. Collect the pairs
The graph is a set of ordered pairs and a subset of the domain–codomain product.
- 4. Check the convention
A function may be represented by its graph or by a triple that also records its codomain.
A function is often written as a rule, such as , or as an arrow from one set to another. In set theory, the rule can be represented by a set of ordered pairs: one pair for each input and its output. This set is called the function’s graph.
That representation explains in what sense functions are sets. It also highlights a convention: the graph alone records which outputs occur, but it does not always specify the codomain named when the function is introduced.
The graph of a function
Suppose is a function with domain and codomain . Its graph is
Each member is an ordered pair: its first entry is an input and its second entry is the corresponding output. Since every output lies in , the graph is a subset of the Cartesian product:
Not every subset of is the graph of a function from to . A function’s graph must contain exactly one pair whose first entry is , for every . In particular, a relation that assigns two different outputs to the same input is not a function.
A worked example
Let , let , and define by . Evaluate the rule at each input:
The graph is therefore
It is a set whose elements are ordered pairs, and it is a subset of . Notice that is in the stated codomain but is not an output. A function does not have to use every member of its codomain.
By contrast, is not the graph of a function with domain : the input is paired with two outputs, and has no output.
How are ordered pairs sets?
Set theory can define an ordered pair using sets. One standard encoding is the Kuratowski pair:
This encoding is chosen so that the pair’s order can be recovered: if and only if and . Other encodings are possible; what matters is that ordered pairs have this distinguishing property.
With ordered pairs encoded as sets, a graph is a set of sets. The function is not a separate kind of object that set theory cannot describe: it can be represented entirely using sets. In ordinary mathematics, people usually write rather than expand the encoding, because the notation is much easier to read.
Does the graph include the codomain?
There are two common ways to define a function.
- As a graph: A function is a set of ordered pairs satisfying the function condition. Its domain is the set of first entries, and the outputs are the set of second entries.
- As a mapping with specified sets: A function from to is recorded as , where is its graph and .
The distinction matters because the same graph can be paired with different codomains. In the example, the graph also defines a function from to , as well as one from to . The outputs have not changed, but the codomain has. If a problem asks whether two functions are equal, check whether its convention counts the codomain as part of the function.
The graph determines the domain and all input-output assignments. It does not determine a larger codomain that includes values never attained. The set of actual outputs, called the range or image, is determined by the graph.
Common mistakes
- Treating the formula as the whole function. The expression does not by itself specify a domain or codomain. Those sets can affect which mapping is meant.
- Confusing range with codomain. The range consists of outputs actually attained; the codomain is the target set specified for the function. They may differ.
- Thinking any set of pairs is a function. Each domain element must occur as a first entry exactly once. Missing inputs or repeated inputs with different outputs violate the function condition.
- Assuming every function is a set in every context. In standard set theory, a function with a set domain and set-valued outputs has a set graph. A function defined on all sets, such as the assignment sending each set to itself, is instead a proper-class-sized mapping in common set-theoretic foundations, not a set of all its pairs.
For most elementary problems, the practical answer is simple: view a function as the set of all input-output pairs in its graph, and keep the domain and codomain explicit when they matter.
References
- Paul R. Halmos, Naive Set Theory
- Thomas Jech, Set Theory
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.