DOMAIN AND CODOMAIN

A function $F$ has associated with it two sets, its domain $\operatorname{dom}F$ and its codomain $\operatorname{cod}F$.    By the specification of function, we know that for a function $F$,

•  $F$ (a) is defined for every element $a\in\operatorname{dom}F$ and for no other a. 

•  For every $a\in\operatorname{dom}F$, $F$ (a) must be an element of $\operatorname{cod}F$.  It is OK for there to be elements of $\operatorname{cod}F$ that are not $F$ (a) for any $a\in\operatorname{dom}F$.

Example

If we say $F:\{1,2,3,6\}\to\mathbb{R}$ (where F is the finite function defined above), then F(7) is not defined because $7\notin\operatorname{dom}F$. And note that $42\in\operatorname{cod}F$ but there is no number a for which F(a) = 42.

Example

•  If we say $G:\mathbb{R}\to\mathbb{R}$ is defined by $G(x)=x^2+2x+5$, then we can’t talk about G(3 + 2i), where 3 + 2i is a complex number, because the domain of G includes by definition only the real numbers. 

•  The formula $(3+2i)^2+2(3+2i)+5$ is a perfectly well defined complex number, namely 16 + 16i,  but 3 + 2i  is nevertheless not in the domain of G. 

•  And 3 is a real number, so it is in the codomain of G, but the minimum value for G is 4, so there is no real number a for which $G(a)=3$.   G(i − 1) = 3, but i − 1 is not in the domain of G.

A function is not the same thing as its defining expression.

Example

Let $K:\mathbb{R}\to\mathbb{R}$ be defined by $K(x)=x^2-6x+25$.  Then $K(3)=16$ and $(3+2i)^2-6(3+2i)+25=12$, and all these things are true:

•  $3\in\operatorname{dom}K$

•  $12\in\operatorname{cod}K$

•  $3+2i\notin\operatorname{dom}K$ even though $(3+2i)^2-6(3+2i)+25=12$ and $12\in\operatorname{cod}K$.  $3+2i\notin\operatorname{dom}K$ because the notation $K:\mathbb{R}\to\mathbb{R}$ tells you that the domain of K is $\mathbb{R}$ .

Usage for domain and codomain

•  Especially for functions defined by a formula on the real numbers, texts often don’t specify the domain of a function.  In that case the domain is usually regarded as the set of all real numbers for which the formula is defined.  For example, for G defined by $G(x)=x^2+2x+5$, the domain is $\mathbb{R}$ but for the function H defined by $H(x)=\frac{1}{x}$ the domain is $\mathbb{R}-0$ (the set of all real numbers except 0).

•  If you have two functions in which all the data is the same except which set is specified for the codomain, are they the same function?  Mathematicians disagree on this, with the result that there are two definitions of function in common use (more about that here.) Those who go with the stricter definition say that if $B\ne C$ then $F:A\to B$ and $F:A\to C$ are two different functions.  Those who go with the looser definition say they are the same.