Module 1: Basic Set Theory
Module 2: Modular Arithmetic, Divisibility, and the Fundamental Theorem of Arithmetic
Module 3: Functions and Relations
Module 4: Truth Tables and Symbolic Logic
Module 5: Basic Direct Proofs
Module 6: Proof Techniques Part 1: Contrapositive and Contradiction
Module 7: Sequences, Sums, and Products
Module 8: Proof Techniques Part 2: (Weak) Induction
Module 9: Recurrence Relations and Recursion
Module 10: Counting Systems (Binary, Hex, Octal, etc.)
Module 11: Combinatorics
Module 12: Graph Theory
Module 13: Review

Domains, Codomains, and Ranges

That is, the domain of a function \(f\) is the set of all objects/elements that have a corresponding output through \(f\). In other words, it’s the set of all elements that you can “plug into” \(f\).

In other words, the codomain of a function, in a sense, represents the type of output we can expect to get from \(f\); not specifically what the outputs of the function are. The set of specific outputs of a function is what define next.

An Example of Domain, Codomain, and Range Using a Potato Diagram

Let \(f\) be defined by the potato diagram below.

The set of all inputs that have a corresponding output via \(f\) is \(\text{dom}(f)=\{1,2,3,5\}\).

The range of \(f\) is \(\text{ran}(f)=\{-1,0,3,4\}\); i.e. the set of all possible outputs of \(f\) (in this case, the set of all numbers with arrows pointing to them).

The codomain of \(f\) is \(\text{codom}(f)=\{-1,0,3,4,5\}\), which is the set to which all outputs of \(f\) are constrained. No output of \(f\) will fall outside the codomain given just now.

Example with a Function Defined By a Rule

Let \(f\) be the function defined as \(f(x)=x^2\). Note that \(\text{dom}(f)=\mathbb{R}\) (or at least can be assumed so), because there is no real number that we cannot plug into \(f\); i.e. we can plug in whatever real number we like and we will get out an answer. We know that \(f\) will only produce real number outputs, so the codomain of \(f\) is \(\text{codom}(f)=\mathbb{R}\). Finally, the range of \(f\) is \(\text{ran}(f)=[0,\infty)\), because the outputs (i.e. the \(y\)-values of \(f\)) are all greater than or equal to \(0\) (you can’t get a negative number by squaring something).

How Functions are Sometimes Defined

Occasionally, when defining a function, we outright list the domain and codomain of the function so that it is clear what sets the function is mapping from and to. Suppose for example that we are defining a function from the set \(A\) to the set \(B\). We would then write “Let \(f:A\rightarrow B\) be a function defined such that…” to define the function, where the first set \(A\) is the domain and the second set \(B\) is the codomain. We could easily just skip on the notation and define \(f\) by saying “Let \(f\) be a function from \(A\) to \(B\) be defined…” and then list how the function is defined (i.e. by a rule, diagram, graph, etc.).

Point of Interest: You might be wondering why we even bother with codomains of functions when we could write the range set instead. One reason for this is that, for complicated functions, determining what the range is can be a horribly cumbersome task. Its often easier to state what type of output we could expect.

\(x\)\(f(x)=y\)
1-551
44
65412
7-41
2undefined
910

\(\text{dom}(f)=\{1,4,6,7,9\}\)

\(\text{ran}(f)=\{-551,4,5412, -41, 10\}\)

\(\text{codom}(f)=\mathbb{Z}\) (as long as your answer for codomain is a set that includes the range above, you are correct)

For the domain, we are looking for the set of all \(x\)-values that the function (as defined by the table) has a defined output for. In this case, we have a defined output for every \(x\)-value except \(2\), so \(2\) is not in the domain of \(f\).

For the range, we are looking for the set of all possible outputs, or \(y\)-values returned by the function. In this case, the \(y\)-values are the ones given in the list. We don’t list the word “undefined” because it indicates that there is no output that corresponds with the input of \(2\).

For the codomain, we are looking for the type of output we can expect to get from our function. In this case, it looks like the outputs are positive and negative whole numbers, so a solid choice for codomain is the set of all integers.

\(\text{dom}(f)=\{-5,3.14,12,0,1\}\)

\(\text{ran}(f)=\{6,0,54,3\}\)

\(\text{codom}(f)=\mathbb{N}\) (as long as your choice of codomain has the above range as a subset, your answer is technically correct.)

For the domain, we are looking for all possible \(x\)-values that have a corresponding \(y\)-value in the list. In other words, list all possible \(x\)-values from the list of \((x,y)\) pairs in the given set.

For the range, we are looking for all possible output \(y\)-values that the function returns. In other words, we are looking for a list of all possible \(y\)-values from the list of \((x,y)\) pairs in the given set, without listing duplicates.

For the codomain, note that all outputs are positive whole numbers (i.e. natural numbers), so \(\mathbb{N}\) makes for a solid choice of codomain.

Important point: The number of elements in the range of a function can never exceed the number of elements in the domain. For, otherwise, the function would have some inputs going to multiple outputs, which is contrary to how functions work. Functions, by definition, take one input and return exactly one possible output… never more than one output. It IS possible for several different \(x\)-values to map to the same \(y\)-value, but you cannot have one \(x\)-value that produces more than one output.

Solution:

dom\((f)=\{1,3,4,5\}\)

ran\((f)=\{7,3,2\}\)

codom\((f)=\{7,3,1,2\}\)

For the domain, i.e. the set of all inputs that the function produces an output for, notice that the only numbers in the left bubble that have arrows coming out of them are 1,3,4, and 5. While 2 appears in the left potato, there is no arrow coming out of it, and therefore no output for an input of 2. Therefore, the domain is \(\{1,3,4,5\}\).

For range, the only numbers in the right potato that have an arrow pointing to them are 7,3, and 2. So, those numbers are the only outputs of the function. Hence, the range is \(\{7,3,2\}\)

For codomain, the most natural choice is everything in the second bubble since our output arrows don’t leave the second bubble.

Scroll to Top