Codomain of a Function
High school
Consider a function. The codomain of the function is the set of values that its outputs are allowed to be. It can be larger than the set of outputs that actually occur: for $f(x) = x^2$ with real outputs, the codomain is all real numbers, but only nonnegative numbers occur.
Undergraduate
Consider a function $f : X \to Y$. The codomain of $f$ is the set $Y$. Every output is in $Y$, but not every element of $Y$ needs to be an output.
Examples
Worked examples
-
Value:
$[0, \infty)$
The codomain of $f$ is $[0, \infty)$, because $f$ is declared as a function from $\reals$ to $[0, \infty)$. -
Value:
$\reals$
$f$ is declared as a function $\reals \to \reals$. -
Value:
$\reals^2$
The matrix \(A = \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 3 \end{bmatrix}\) has $2$ rows, so the codomain of $x \mapsto A x$ is $\reals^2$. -
Value:
$\reals^2$
The matrix \(A = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}\) has $2$ rows, so $A x \in \reals^2$, and the codomain of $x \mapsto A x$ is $\reals^2$.
Notes
The codomain is part of the definition of a function. For example, $x \mapsto x^2$ as a function $\reals \to \reals$ is not surjective, but as a function $\reals \to [0, \infty)$ it is.
Distinctions involving this term
- Domain vs. Range vs. Codomain vs. Image vs. Preimage: A function comes with several sets that describe its inputs and outputs. The domain is where inputs come from, and the codomain is where outputs are allowed to land. The range is the set of outputs that actually occur. For a set $A$ of inputs, the image $f(A)$ is the set of outputs for inputs in $A$, so the range is the image of the whole domain. For a set $B$ of outputs, the preimage $f^{-1}(B)$ is the set of inputs that land in $B$.
All definitions · All distinctions · All examples · Notation