Suppose function $f$ and sets $X$ and $Y$ such that $f : X \rightarrow Y$.
What does this notation exactly mean, out of the following options?
- $\text{domain(} f) \subseteq X \wedge \text{range(} f) \subseteq Y$
- $\text{domain(} f) = X \wedge \text{range(} f) \subseteq Y$
- $\text{domain(} f) = X \wedge \text{range(} f) = Y$
For example look at these three statements for the real-valued square root:
- $\sqrt{x} : \mathbb{R} \rightarrow \mathbb{R}$
- $\sqrt{x} : \mathbb{R} \rightarrow \mathbb{R}_{\geq 0}$
- $\sqrt{x} : \mathbb{R}_{\geq 0} \rightarrow \mathbb{R}_{\geq 0}$
which one of them are correct?
In the notation $f: X \rightarrow Y$, $X$ is the domain of $f$ and $Y$ is the codomain. The range of $f$, which we sometimes write as $f(X)$, is a subset of $Y$.
So then for the square root function, both $\sqrt{}: \mathbb{R}_{\geq 0} \rightarrow \mathbb{R}$ and $\sqrt{}: \mathbb{R}_{\geq 0} \rightarrow \mathbb{R}_{\geq 0}$ are valid, but $\sqrt{}: \mathbb{R} \rightarrow \mathbb{R}_{\geq 0}$ is not because the function is not defined on negative numbers. There is also a related function $\sqrt{}: \mathbb{N} \rightarrow \mathbb{R}$ which only takes inputs in the natural numbers, but note that we couldn't define $\sqrt{}: \mathbb{N} \rightarrow \mathbb{N}$ because then there would be inputs that don't produce a valid output.