TopComposition of functions is a form of merging functions in which input to one function is another function. Let us consider two functions f and g. Let us see how to find the domain of fog and gof. For this, let us consider an example as shown below:

Suppose we have two function f(a) = $\frac{1}{a + 2}$ and g(a) = $\frac{a}{a - 3}$.

Real domain of g(a) cannot include a = 3 because at this value of “a”, value of function is not defined. Similarly, domain of function f(a) can be any real number except for a = -2.

Let us first consider the function fog. According to fog, we get f(g(a)) = $\frac{1}{g(a) + 2}$.

Domain of this function will contain the values from domain of the function g(a) which means, solutions generated by these values from function g(a) must be chosen by function f(a).

We know that the function g(a) cannot possess the value a = 3 and same is true in case of fog also.

Also, solutions that arise from g(a) are obtained in the form $\frac{a}{a - 3}$.

Next, we check “a” for value of the function g(a) = -2 as at this value, f(a) is not defined.

So, by solving $\frac{a}{a - 3}$ = -2, we get a = 2.

So, from domain of fog, we remove a = 2 also and final domain of the function fog is “a” belonging to real number and a $\neq$ 2, 3.

Similarly, domain of gof can also be found by checking the points which were checked in case of fog.

Domain of gof comes out to be all real numbers with 3 and 2 excluded.