UK Secondary (7-11)
topic badge
Composite Functions
Lesson

The idea behind the composition of functions is best explained with an example.

Suppose we think about the function given by $f\left(x\right)=2x+1$f(x)=2x+1. We understand that the function takes values of $x$x in the domain and maps them to values, say $y=2x+1$y=2x+1, in the range.

Suppose however that this is only the first part of a two-stage treatment of $x$x. Suppose we now take these function values and map them using another function, say $g\left(x\right)=x^2$g(x)=x2. This means that the $y$y values given by $\left(2x+1\right)$(2x+1) become the squared values $\left(2x+1\right)^2$(2x+1)2. The diagram below captures the idea.

The function values $f\left(x\right)$f(x) have become the domain values of $g\left(x\right)$g(x). Thus we could describe the complete two-stage process by the expression $g\left(f\left(x\right)\right)$g(f(x)), sometimes written $g\left[f\left(x\right)\right]$g[f(x)] and spoken of as the "gof" of $x$x

Algebraically, we can write $g\left(f\left(x\right)\right)=g\left[2x+1\right]=\left(2x+1\right)^2$g(f(x))=g[2x+1]=(2x+1)2

Note that if we reversed the order of the two-stage processing, we would, in this instance, develop a different composite function. 

Thus $f\left(g\left(x\right)\right)=f\left(x^2\right)=2\left(x^2\right)+1=2x^2+1$f(g(x))=f(x2)=2(x2)+1=2x2+1. This is known as the "fog" of $x$x.

The domain of Composite functions

One very important point needs to be made here in terms of the domain of composite functions.

If we consider, say $g\left(f\left(x\right)\right)$g(f(x)), then range of the function $f\left(x\right)$f(x) (which is the function applied first) must be a subset of the domain of the function $g\left(x\right)$g(x) (the function that is applied second).

That is to say, the domain of $g\left(f\left(x\right)\right)$g(f(x)) must only consist of elements that can be mapped by both $f\left(x\right)$f(x) and then by $g\left(x\right)$g(x) without causing an issue in either function. 

A similar situation applies for  $f\left(g\left(x\right)\right)$f(g(x)).

For example, if $f\left(x\right)=\sqrt{x}$f(x)=x and $g\left(x\right)=\frac{1}{x}$g(x)=1x, then both $f\left(g\left(x\right)\right)$f(g(x)) and $g\left(f\left(x\right)\right)$g(f(x)) have the restricted domain $x\in R^+$xR+. Lets explain why.

If we consider $g\left(f\left(x\right)\right)$g(f(x)), the range of $f\left(x\right)$f(x) includes non-negative real numbers, but we can't use all of these in $g\left(x\right)$g(x). The number zero needs to be deleted.

If we consider $f\left(g\left(x\right)\right)$f(g(x)), the range of $g\left(x\right)$g(x) includes all real numbers other than zero, but only positive reals can be considered for $f\left(x\right)$f(x)

Taking this last example, we have $f\left(g\left(x\right)\right)=f\left(\frac{1}{x}\right)=\sqrt{\frac{1}{x}}=\frac{1}{\sqrt{x}}$f(g(x))=f(1x)=1x=1x and $g\left(f\left(x\right)\right)=g\left(\sqrt{x}\right)=\frac{1}{\sqrt{x}}$g(f(x))=g(x)=1x and so in this instance the fog and the gof are equal. 

The graph of the composition is shown here. Note that the composition is graphed for positive reals only.

 

Worked examples

Question 1

If $f\left(x\right)=4x+4$f(x)=4x+4,

  1. find $f\left(2\right)$f(2).

  2. find $f\left(-5\right)$f(5).

Question 2

Consider the functions $f\left(x\right)=-2x-3$f(x)=2x3 and $g\left(x\right)=-2x-6$g(x)=2x6.

  1. Find $f\left(7\right)$f(7).

  2. Hence, or otherwise, evaluate $g\left(f\left(7\right)\right)$g(f(7)).

  3. Now find $g\left(7\right)$g(7).

  4. Hence, evaluate $f\left(g\left(7\right)\right)$f(g(7)).

  5. Is it true that $f\left(g\left(x\right)\right)=g\left(f\left(x\right)\right)$f(g(x))=g(f(x)) for all $x$x?

    Yes

    A

    No

    B

    Yes

    A

    No

    B

Question 3

Consider the functions $f\left(x\right)=-2x+6$f(x)=2x+6 and $g\left(x\right)=3x+1$g(x)=3x+1.

  1. The function $r\left(x\right)$r(x) is defined as $r\left(x\right)=f\left(x^2\right)$r(x)=f(x2). Define $r\left(x\right)$r(x).

  2. Using the results of the previous part, define $q\left(x\right)$q(x), which is $g\left(f\left(x^2\right)\right)$g(f(x2)).

 

What is Mathspace

About Mathspace