### Codomain definition

The codomain of a function is the set of its possible outputs. In the function machine metaphor, the codomain is the set of objects that might possible come out of the machine.

For example, when we use the function notation $f: \R \to \R$, we mean that $f$ is a function from the real numbers to the real numbers. In other words, the codomain of $f$ is the set of real numbers $\R$ (and its set of possible inputs or domain is also the set of real numbers $\R$).

Just because an object is in the codomain of a function, it does not necessarily mean that there is an input for which the function will output that object. For example, we could define a function $f: \R \to \R$ as $f(x)=x^2$. Since $f(x)$ will always be non-negative, the number $-3$ is in the codomain of $f$, but there is no input of $x$ for which $f(x)=-3$. The set of all outputs that result from putting all inputs into the function is called the range. For the above $f$, the range is the set of non-negative real numbers while the codomain is the set of all real numbers.