Function is a relation on two sets by a rule. It is a special mapping between two sets. It emerges that it is possible to combine two functions, provided co-domain of one function is domain of another function. The composite function is a relation by a new rule between sets, which are not common to the functions.
We can understand composition in terms of two functions. Let there be two functions defined as :
Observe that set “B” is common to two functions. The rules of the functions are given by “f(x)” and “g(x)” respectively. Our objective here is to define a new function
Thinking in terms of relation, “A” and “B” are the domain and co-domain of the function “f”. It means that every element “x” of “A” has an image “f(x)” in “B”.
Similarly, thinking in terms of relation, “B” and “C” are the domain and co-domain of the function “g”. In this function, "f(x)" – which was the image of pre-image “x” in “A” – is now pre-image for the function “g”. There is a corresponding unique image in set "C". Following the symbolic notation, "f(x)" has image denoted by "g(f(x))" in "C". The figure here depicts the relationship among three sets via two functions (relations) and the combination function.
| Composition of two functions |
|---|
![]() |
For every element, “x” in “A”, there exists an element f(x) in set “B”. This is the requirement of function “f” by definition. For every element “f(x)” in “B”, there exists an element g(f(x)) in set “B”. This is the requirement of function “g” by definition. It follows, then, that for every element “x” in “A”, there exists an element g(f(x)) in set “C”. This concluding statement is definition of a new function :
By convention, we call this new function as “gof” and is read as "g circle f" or "g composed with f".
The two symbolical representations are equivalent.
Problem 1: Let two sets be defined as :
Determine “hok” and “koh”.
Solution : According to definition,
Again, according to definition,
Importantly note that
In accordance with the definition of function, “f”, the range of “f” is a subset of its co-domain “B”. But, set “B” is the domain of function “g” such that there exists image g(f(x)) in “C” for every “x” in “A”. This means that range of “f” is subset of domain of “g” :
Clearly, if this condition is met, then composition “gof” exists. Following this conclusion, “fog” will exist, if
And, if both conditions are met simultaneously, then we can conclude that both “gof” and “fog” exist. Such possibility is generally met when all sets involved are set of real numbers, “R”.
Problem 2: Let two functions be defined as :
Check whether “gof” and “fog” exit for the given functions?
Solution : Here,
Hence,
and
It means that both compositions “gof” and “fog” exist for the given sets.
Composition of two functions results in new rule for the new composite function. The expression of new rule may prohibit certain elements of the original domain set. For example, consider the function,
Clearly, the domain of function is R – {1}. Let us now see the expression of composition of function with itself,
This expression is valid for real values of “x” when
If functions “f” and “g” having different intervals of real numbers are involved in the composition, then we consider both the intervals and determine the domain of the composition by meeting requirement of both intervals (common interval). This aspect is illustrated in the examples given in the next section.
The most important aspect of working with composition of function is to combine intervals i.e. domains of two functions. Consider for example the function given by :
Here, "|x|" is modulus function, which returns non-negative number for all real values of "x". We are required to find fog(x). What would be the domain of the resulting composition? Let us have a closer look at the definition of composition,
In plain words, it means that argument of the function “f” is the function “g” itself. The function “f” is defined in the domain "0 ≤ x ≤ 2", whereas function “g” is defined in "0≤x≤3". From the expression of composition as above, it is clear that we need to ensure that value of “x” should lie in the domain interval of function “g”. Hence,
But function “f” is defined for values of “x”, which lie in its interval “0≤x≤2”. So when we expand the composition in accordance with the rule of function “f”, we should ensure that value of its argument – note that it is not the value of independent variable “x” - lies in the interval specified by its domain.
Note that interval of function “f” is written with respect to function “g” i.e. “|x|” – not “x”. Since requirements of both functions are required to be met simultaneously, the domain of the resulting composition is intersection of two domains. It is this reason that we use either “and” or a comma “,” to combine two intervals.
Now, we interpret the interval of modulus function “0≤ |x| ≤2”. We see that part of the interval, "|x| ≥0", is always true for all values of “x”. Whereas part of the interval, "|x| ≤2", means (we shall learn about interpreting modulus inequality in a separate module) :
Combining intervals of two parts of the interval “0≤ |x| ≤2”, we conclude that it is equal to :
Hence,
Problem 3: Consider the function as given here :
Determine fof(x).
Solution : The composition of the function with itself is :
Problem 4: A function is defined for real values by :
Determine f[f{f(x)}] and draw the graph of resulting composition.
Solution : This is composition triplet. We have already seen that :
Compositing again with f(x), we have :
The graph of the composition is as shown here :
| Plot of compostion |
|---|
![]() |
Problem 5: A function is defined for real values by :
| 1 + x ; 0 ≤ x ≤ 2
f(x) = |
| 3 – x ; 2 < x ≤ 3
Determine f(f(x)).
Solution : The function “f(x)” is combined with itself. Here,
| f(1 + x) ; 0 ≤ x ≤ 2
f(f(x)) = |
| f(3 - x) ; 2 < x ≤ 3
We need to evaluate function for each of the above two intervals :
f(1 + x) ; 0 ≤ x ≤ 2
| 1 + (1+x) ; 0 ≤ 1+ x ≤ 2 and 0 ≤ x ≤ 2
= |
| 3 – (1+x); 2 < 1+ x ≤ 3 and 0 ≤ x ≤ 2
| 2 + x ; -1 ≤ x ≤ 1 and 0 ≤ x ≤ 2
= |
| 2 – x ; 1 < x ≤ 2 and 0 ≤ x ≤ 2
| 2 + x ; 0 ≤ x ≤ 1
= |
| 2 – x ; 1 < x ≤ 2
Similarly,
f(3 - x) ; 2 < x ≤ 3
| 1 + (3-x) ; 0 ≤ 3- x ≤ 2 and 2 < x ≤ 3
= |
| 3 – (3-x) ; 2 < 3- x ≤3 and 2 < x ≤3
| 4 - x ; -3 ≤ x ≤ -1 and 2 < x ≤ 3
= |
| x ; -1 < x ≤ 0 and 2 < x ≤ 3
| 4 - x ; 1 ≤ x ≤ 3 and 2 < x ≤ 3
= |
| x ; 0 < x ≤ 1 and 2 < x ≤ 3
| 4 - x ; 2 < x ≤ 3
= |
| x ; No common interval
= | 4 - x ; 2 < x ≤ 3
Putting the results in the expression of “fof”, we have :
| 2 + x ; 0 ≤ x ≤1
f(f(x)) = | 2 – x ; 1 < x ≤ 2
| 4 - x ; 2 < x ≤ 3
The composition is generally not commutative except for some special functions.
On the other hand, composition among three functions is independent of parentheses and hence is associative.