Sets and Logic · Siblings

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$.

Definitions

domain

Elementary

Think of a function as a machine that takes inputs and gives outputs. The domain of the function is the set of inputs that it accepts.

High school

Consider a function $f$ given by a rule, such as a formula. The domain of $f$ is the set of inputs $x$ for which $f(x)$ is defined.

Caveat. In high school, the domain is usually found as the largest set on which a formula makes sense. At higher levels, the domain is chosen as part of the definition of the function, and can be smaller than the set where the formula makes sense.
Undergraduate

Consider a function $f : X \to Y$. The domain of $f$ is the set $X$.

Worked examples

range (image)

Elementary

Think of a function as a machine that turns inputs into outputs. The range of the function is the set of all of the outputs that the function produces.

High school

Consider a function $f$ and all of the inputs in its domain. The range of $f$ is the set of all of outputs that are produced by one or more of the inputs in the domain of $f$.

Undergraduate

Consider a function $f : X \to Y$. The range of $f$ is the image of the whole domain $X$:

\[\range{f} = f(X) = \setdef{f(x) \suchthat x \in X}.\]
Worked examples

codomain

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.

Worked examples

image

Elementary

Think of a function as a machine that turns inputs into outputs, and pick a group of inputs. The image of that group is the set of outputs that the machine gives for those inputs.

High school

Consider a function and a set $A$ of inputs in its domain. The image of $A$ is the set of all outputs of the function for inputs in $A$.

Undergraduate

Consider a function $f : X \to Y$ and a set $A \subseteq X$. The image of $A$ under $f$ is

\[f(A) = \setdef{f(x) \suchthat x \in A}.\]
Worked examples
Properties
  • The image $f(X)$ of the whole domain is the range of $f$.
  • If $f$ is a linear map between vector spaces, then the image of every subspace is a subspace. In particular, the range of $f$ is a subspace of the codomain, and its dimension is the rank of $f$.

preimage

High school

Consider a function $f$ and a set $B$ of possible outputs. The preimage of $B$ under $f$ is the set of all inputs $x$ whose output $f(x)$ is in $B$.

Undergraduate

Consider a function $f : X \to Y$ and a set $B \subseteq Y$. The preimage of $B$ is

\[f^{-1}(B) = \setdef{x \in X \suchthat f(x) \in B}.\]
Worked examples
  • Value:

    $f^{-1}(\setdef{4}) = \setdef{-2, 2}$

    This is the same rule as $x \mapsto x^2$ on $\reals$, but with the smaller codomain $[0, \infty)$, which equals the range.
  • Value:

    $f^{-1}(\setdef{4}) = \setdef{-2, 2}$ and $f^{-1}(\setdef{-1}) = \emptyset$

    The preimage $f^{-1}(\setdef{4})$ exists even though $f$ has no inverse. No real number squares to $-1$, so $f^{-1}(\setdef{-1})$ is empty.
Properties
  • For a function $f : X \to \reals$, the $c$-level set of $f$ is the preimage $f^{-1}(\setdef{c})$ of a single point, and the $c$-sublevel set of $f$ is the preimage $f^{-1}((-\infty, c])$ of an interval.
  • Preimages preserve unions, intersections, and complements: $f^{-1}(A \cup B) = f^{-1}(A) \cup f^{-1}(B)$, $f^{-1}(A \cap B) = f^{-1}(A) \cap f^{-1}(B)$, and $f^{-1}(Y \setdiff B) = X \setdiff f^{-1}(B)$. Images preserve unions, but not always intersections or complements.

Examples

Each cell is the ___ of the function in that row.

$f(x) = x^2$ on $\reals$

The domain and codomain of $f$ are both $\reals$. Squares of real numbers are exactly the nonnegative numbers, so the range is $[0, \infty)$, which is smaller than the codomain. The image of $[-1, 2]$ is $[0, 4]$, which is smaller than the range. The preimage of $\setdef{4}$ is $\setdef{-2, 2}$, even though $f$ has no inverse.
domain $\reals$
range (image) $f(\reals) = [0, \infty)$
codomain $\reals$
image $f([-1, 2]) = [0, 4]$
preimage $f^{-1}(\setdef{4}) = \setdef{-2, 2}$ and $f^{-1}(\setdef{-1}) = \emptyset$

$f(x) = x^2$, as a function $f : \reals \to [0, \infty)$

This is the same rule as $x \mapsto x^2$ on $\reals$, but with the smaller codomain $[0, \infty)$, which equals the range.
domain $\reals$
range (image) $f(\reals) = [0, \infty)$
codomain $[0, \infty)$
image $f([-1, 2]) = [0, 4]$
preimage $f^{-1}(\setdef{4}) = \setdef{-2, 2}$

Notes

See also

All distinctions · All definitions · Notation