Composition of Functions
The composition of functions is the process of combining two or more functions into a single function. A function represents some work. Let us take the preparation of bread. Let x is the flour, the food processor is doing the function of preparing the dough using the flour (and let this function be g(x)) and let the oven is doing the function of making the bread (and let this function be f(x)). To prepare bread, the output of g(x) should be placed in the function f(x) (i.e., the prepared dough should be placed in the oven). The result is denoted by f(g(x)) and is a composition of functions f(x) and g(x).
Let us see what is the composition of functions in math along with calculating it. Let us also see how to find its domain and range.
What is the Composition of Functions?
The composition of functions f(x) and g(x) where g(x) is acting first is represented by f(g(x)) or (f ∘ g)(x). It combines two or more functions to result in another function. In the composition of functions, the output of one function that is inside the parenthesis becomes the input of the outside function. i.e.,
 In f(g(x)), g(x) is the input of f(x).
 In g(f(x)), f(x) is the input of g(x).
We can understand this using the following figure:
i.e., to find f(g(x)) (which is read as "f of g of x"), we have to find g(x) first and then we substitute the result in f(x).
Symbol of Composition of Functions
The symbol of the composition of functions is ∘. It can also be shown without using this symbol but by using the brackets. i.e.,
 (f ∘ g)(x) = f(g(x)) and is read as "f of g of x". Here, g is the inner function and f is the outer function.
 (g ∘ f)(x) = g(f(x)) and is read as "g of f of x". Here, f is the inner function and g is the outer function.
How to Solve Composite Functions?
Using BODMAS, we always first simplify whatever is within brackets. So to find f(g(x)), first g(x) has to be calculated and is to be substituted within f(x). In the same way, to find g(f(x)), first f(x) has to be calculated and is to be substituted in g(x). i.e., while finding the composite functions, the order matters. It means f(g(x)) may NOT be equal to g(f(x)). For any two functions f(x) and g(x), we find the composite function f(g(a)) using the following steps:
 Find g(a) by substituting x = a in g(x).
 Find f(g(a)) by substituting x = g(a) in f(x).
We can understand these steps using the example below. Here we are finding f(g(1)) when f(x) = x^{2}  2x and g(x) = x  5.
We can summarize this process by simple mathematics calculation as shown below:
f(g(1)) = f(15)
= f(6)
= (6)^{2}  2 (6)
= 36 + 12
= 48
Finding Composite Function From Graph
To find the composite function of two functions (which are not defined algebraically) shown graphically, we should recall that if (x, y) is a point on a function f(x) then f(x) = y. Using this, to find f(g(a)) (i.e., f(g(x)) at x = a):
 Find g(a) first (i.e., the ycoordinate the on the graph of g(x) that corresponds to x = a)
 Find f(g(a)) (i.e., the ycoordinate on the graph of f(x) that corresponds to g(a))
Example: Find f(g(5)) from the following graph.
Solution:
f(g(5)) = f(3) (Because g(5) = 3 as (5, 3) is on g(x))
= 2 (Because f(3) = 2 as (3, 2) is on f(x))
Hence, f(g(5)) = 2.
Finding Composite Function From Table
We have already seen how to find the composite function when a graph of functions is given. Sometimes the points on the graph of functions are shown by tables. So we apply the same procedure as explained in the previous section.
Example: Find g(f(3)) using the following tables.
x  f(x) 

1  4 
2  3 
3  2 
4  1 
x  g(x) 

4  1 
3  0 
2  1 
1  2 
Solution:
From the table of f(x), f(3) = 2.
So g(f(3))= g(2).
From the table of g(x), g(2) = 1.
Thus, g(f(3)) = 1.
Domain of Composite Functions
In general, if g : X → Y and f : Y → Z then f ∘ g : X → Z. i.e., the domain of f ∘ g is X and its range is Z. But when the functions are defined algebraically, here are the steps to find the domain of the composite function f(g(x)).
 Find the domain of the inner function g(x) (Let this be A)
 Find the domain of the function obtained by finding f(g(x)) (Let it be B)
 Find the intersection of A and B and A ∩ B gives the domain of f(g(x))
Example: Find the domain of f(g(x)) when f(x) = 1/(x+2) and g(x) = 1/(x+3).
Solution:
In f(g(x)), the inner function is g(x) and its domain is A = {x  x ≠ 3}.
Now we will calculate f(g(x)).
\(\begin{aligned}
f(g(x)) &=f\left(\frac{1}{x+3}\right) \\
&=\frac{1}{\frac{1}{x+3}+2} \\
&=\frac{1}{\frac{1+2 x+6}{x+3}} \\
&=\frac{x+3}{2 x+7}
\end{aligned}\)
Its domain is B = {x : x ≠ 7/2}
Thus, the domain of f(g(x)) is, A ∩ B = {x : x ≠ 3 and x ≠ 7/2}.
This in the interval notation is (∞, 7/2) U (7/2, 3) U (3, ∞).
Range of Composite Functions
The range of composite function is calculated just like the range of any other function. It doesn't depend on the inner or outer functions. Let us calculate the range of f(g(x)) that was shown in the last example. We got f(g(x)) = \(\frac{x+3}{2 x+7}\). Assume that y = \(\frac{x+3}{2 x+7}\). This is a rational function. Hence we solve it for x and set the denominator not equal to zero to find the range.
(2x + 7) y = x + 3
2xy + 7y = x + 3
2xy  x = 3  7y
x (2y  1) = 3  7y
x = (3  7y) / (2y  1)
For range, 2y  1 ≠ 0 which gives y ≠ 1/2.
Therefore, range = {y : y ≠ 1/2}.
☛ Related Topics:
Composite Function Examples

Example 1: If f(x) = √(x  2) and g(x) = ln (1 + x^{2}), find the composition of functions (g ∘ f)(x).
Solution:
(g ∘ f)(x) is found by substituting f(x) into g(x).
(g ∘ f)(x) = g(f(x))
= g (√(x  2))
= ln (1 + [ √(x  2)] ^{2})
= ln (1 + x  2)
= ln (x  1)Answer: (g ∘ f)(x) = ln (x  1).

Example 2: If g(x) = 9x + 2, then what is g(g(x))?
Solution:
The composite function g(g(x)) can be obtained by substituting g(x) into itself.
g(g(x)) = g (9x + 2)
= 9 (9x + 2) + 2
= 81x + 18 + 2
= 81x + 20Answer: g(g(x)) = 81x + 20.

Example 3: For the given two functions f(x) = kx  4 and g(x) = kx + 6, if the two composite functions f(g(x)) and g(f(x)) are equal for all x, find k.
Solution:
Let us find f(g(x)) and g(f(x).
 f(g(x)) = f(kx + 6) = k(kx+6)  4 = k^{2}x + 6k  4
 g(f(x)) = g(kx  4) = k(kx4) + 6 = k^{2}x  4k + 6
It is given that:
f(g(x)) = g(f(x))
k^{2}x + 6k  4 = k^{2}x  4k + 6
6k  4 = 4k + 6
10k = 10
k = 1
Answer: k = 1.
FAQs on Composition of Functions
What is Composite Function Definition?
A composite function of two functions combines the given two functions in the given order. i.e., for any given two functions f(x) and g(x), there can be 4 composite functions:
 f(g(x)) which is substituting g(x) into f(x)
 g(f(x)) which is substituting f(x) into g(x)
 f(f(x)) which is substituting f(x) into itself
 g(g(x)) which is substituting g(x) into itself
How Do You Find Composition of Functions?
To evaluate a composite function f(g(x)) at some x = a, first compute g(a) by substituting x = a in the function g(x). Then substitute g(a) into the function f(x) by substituting x = g(a). In the same way, we can calculate g(f(a)) as well.
Is the Order Important in Composite Functions?
Yes, the order really matters in composite functions. i.e., f(g(x)) ≠ g(f(x)) (i.e., they may not be equal all the time). But sometimes, they may be equal.
How to Find the Domain of a Composite Function?
To find the domain of a composite function, find the domain of the inner function, and the domain of the resultant function. Take the intersection of both domains.
How to Find the Range of a Composite Function?
The range of a composite function is irrespective of inner or outer functions. Its range is calculated just like how we calculate the range of any other function.
How to Find Composition of Functions From Graphs?
If graphs of two functions f(x) and g(x) are given, then to find g(f(a)):
 Find f(a) (using the point (a, f(a)) on f(x))
 Find g(f(a)) (using the point (f(a), g(f(a)) ) on the graph of g(x))
How to Break Composition of Functions?
We can break a composite function into two functions by some observation. Do not forget to crosscheck your answer after breaking. If f(g(x)) = sin (x + 1), then we can say that g(x) = x + 1 and f(x) = sin x. Let us cross check the answer.
f(g(x)) = f (x + 1) = sin (x + 1) and hence our answer is correct.
visual curriculum