Definition. [Codomain] A perhaps larger set $C$ that contains the range set $R$ is called the codomain of the function.
If a function is named \( f \), and the domain element is \( x \), then the corresponding range element is written as \( f(x) \), which is also called the image of \( x \).
Example: Consider the function $f(x) = 2x$ and the domain $D = \{1, 2, 3\}$. The range/image under this function is $R = \{2, 4, 6\}$ (because the function takes each element in $D$ and outputs its product by $2$.) That is, we have $f(1) = 2\cdot1 = 2$, $f(2) = 2\cdot2 = 4$, and $f(3) = 2\cdot3 = 6$. Also, since all the elements in the range $R$ are integers, we can say that the codomain is $\mathbb{P}$, $\mathbb{N}$, or $\mathbb{Z}$, depending on how much precise we want to be.
As a shorthand, instead of writing long verbal descriptions of a function's domain and range/codomain, we could use the following notation instead:
$f: D \to R$ (
$f: D \to R$
) or $f: D \to C$ ($f: D \to C$
) [We read it as: "$f$ is a function from set $D$ to set $R$."]