# What does it mean for a composite function to be defined?

I am trying to answer the following question from a past exam paper:

Let $A =$ {$1,2,3$}, $B =$ {$2,3,4$}, and $C =$ {$1,2,3,4$}, consider the following functions:

$f: A \to B$

$f(x) = x + 1$

$g: A \to C$

$g(x) = x$

$h: C \to A$

$h(1) = 2$, $h(2) = 3$, $h(3) = 2$, $h(4) = 1$

The question is: which of the following are / are not defined. If they are defined, find their domain, codomain and range. If they are not defined, state why.

$f \circ g$

$f \circ h$

$h \circ f$

$g \circ h$

I am struggling to understand functions, and wondered if someone might be willing to go through the process of answering one of the above so I can understand how it is done. I have tried searching, but can not find an example that I can understand. Thank you!

• First thing to check is if the domain and range sets are aligned. For example, as $f:A\to B$ and $g:A\to C$ we can't compose $f\circ g$ as $g$ takes us to $C$ but $f$ is not defined on $C$.
– lulu
Jan 4 '18 at 20:51

For example if we take $f \circ g$, notice that in the first place since $f$ is defined on $A$, not $C$, $f \circ g$ is not defined (Also notice that in order for $f \circ g$ to be defined, $g$ must have range on $A$, which is not the case; it has range on $C$).
But for example if we take $f \circ h$, since there is no such problem as in the previous example, we can simply say that $f(h(1)) = f(2) = 3$, $f(h(2)) = f(3) = 4$, $f(h(3)) = f(2) = 3$ and $f(h(4)) = f(1) = 2$, which are all in $B$, therefore it is defined and we can write $f \circ h: C \to B$ where $C$ is the domain of $f \circ h$ and $B$ is the range, and also codomain of $f \circ h$.
• So would I be correct in stating that $h \circ f$ is not defined because the domain of $h$ != $B$. And that $g \circ h$ is defined because $C \to C$? Jan 4 '18 at 21:28
• Yes, and what you have found in the case $g \circ h: C \to C$ is a permutation on set $C$, indeed. It sends $1 \to 2$, $2 \to 3$, $3 \to 2$, $4 \to 1$. And your answer and reasoning for the case of $h \circ f$ is correct as well. Jan 4 '18 at 21:33
• Great, thank you. I think I now understand how to determine if a function is defined or not, however, can I just confirm I understand what must be done in order to find the domain and range: Using $g \circ h$ as the example, would {1,2,3,4} ($C$) be the domain and {1,2,3} ($A$) be the range? I am completely lost as to how you determine the co-domain however. Jan 4 '18 at 21:46
• When a function $f$ is defined as $f:X \to Y$, we call $X$ the domain and $Y$ the codomain. Range $Z$ is a subset of codomain $Y$ where $f(X) = Z$. Here is a better illustration for these definitions: mathsisfun.com/sets/images/domain-range-codomain.svg Jan 4 '18 at 21:52
• After that, can you tell me what is the domain, codomain and range for the case of $g \circ h$ again? Jan 4 '18 at 21:58