Processing math: 98%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

6.7: Composite Functions

( \newcommand{\kernel}{\mathrm{null}\,}\)

Given functions f:AB and g:BC, the composite function, gf, which is pronounced as “g circle f”, is defined as gf:AC,(gf)(x)=g(f(x)). The image is obtained in two steps. First, f(x) is obtained. Next, it is passed to g to obtain the final result. It works like connecting two machines to form a bigger one, see Figure 6.7.1. We can also use an arrow diagram to provide another pictorial view, see Figure 6.7.2.

Screen Shot 2020-01-13 at 1.40.00 PM.png
Figure 6.7.1: A composite function, viewed as input-output machines.
Screen Shot 2020-01-13 at 1.40.05 PM.png
Figure 6.7.2: Another pictorial view of a composite function.

Numeric value of (gf)(x) can be computed in two steps. For example, to compute (gf)(5), we first compute the value of f(5), and then the value of g(f(5)). To find the algebraic description of (gf)(x), we need to compute and simplify the formula for g(f(x)). In this case, it is often easier to start from the “outside” function. More precisely, start with g, and write the intermediate answer in terms of f(x), then substitute in the definition of f(x) and simplify the result.

Example 6.7.1

Assume f,g:RR are defined as f(x)=x2, and g(x)=3x+1. We find

(gf)(x)=g(f(x))=3[f(x)]+1=3x2+1,(fg)(x)=f(g(x))=[g(x)]2=(3x+1)2.

Therefore,

gf:RR,(gf)(x)=3x2+1

fg:RR,(fg)(x)=(3x+1)2

We note that, in general, fggf.

hands-on exercise 6.7.1

If p,q:RR are defined as p(x)=2x+5, and q(x)=x2+1, determine pq and qp. Do not forget to describe the domain and the codomain.

hands-on exercise 6.7.2

The functions f,g:Z12Z12 are defined by

f(x)7x+2(mod12),andg(x)5x3(mod12).

Compute the composite function fg.

Example 6.7.2

Define f,g:RR as

f(x)={3x+1 if x<02x+5 if x0

and g(x)=5x7. Find gf.

Answer

Since f is a piecewise-defined function, we expect the composite function gf is also a piecewise-defined function. It is defined by (gf)(x)=g(f(x))=5f(x)7={5(3x+1)7 if x<05(2x+5)7 if x0

After simplification, we find gf:RR, by: (gf)(x)={15x2 if x<010x+18 if x0 In this example, it is rather obvious what the domain and codomain are. Nevertheless, it is always a good practice to include them when we describe a function.

hands-on exercise 6.7.3

The functions f:RR and g:RR are defined by f(x)=3x+2,andg(x)={x2 if x52x1 if x>5 Determine fg.

The next example further illustrates why it is often easier to start with the outside function g in the derivation of the formula for g(f(x)).

Example 6.7.3

The function p:[1,5]R is defined by

p(x)={2x+3 if 1x<35x2 if 3x5

and the function q:RR by

q(x)={4x if x<73x if x7

Describe the function qp.

Answer

Since (qp)(x)=q(p(x))={4p(x) if p(x)<73p(x) if p(x)7 we have to find out when will p(x)<7, and when will p(x)7, because these conditions determine what we need to do next to continue the computation. Since p(x) is computed in two different ways, we have to analyze two cases.

Case 1: 1x<3. In this case, p(x) is defined as 2x+3. This is an increasing function, hence, p(x)p(1)=21+3=5,andp(x)<p(3)=23+3=9. For some xs in this range, we have p(x)<7, but for other x-values, we have p(x)7. We need to know the cut-off point. This happens when p(x)=2x+3=7, that is, when x=2. This leads to two subcases.

  • Case 1a: When 1x<2, we have p(x)=2x+3<7. Thus, q(p(x))=4p(x)=4(2x+3)=8x+12.
  • Case 1b: When 2x<3, we have p(x)=2x+37. Thus, q(p(x))=3p(x)=3(2x+3)=6x+9.

Case 2: 3x5. In this case, p(x) is computed as 5x2. This is an increasing function, hence p(x)p(3)=532=13. Since p(x) is always greater than 7, we find q(p(x))=3p(x)=3(5x2)=15x6.

Combining these cases, we determine that the composite function qp[1,5]R is defined by (qp)(x)={8x+12 if 1x<26x+9 if 2x<315x6 if 3x5 Study this example again to make sure that you understand it thoroughly.

hands-on exercise 6.7.4

The functions f,g:ZZ are defined by f(n)={n+1 if n is even n1 if n is odd g(n)={n+3 if n is even n7 if n is odd  Determine fg.

Strictly speaking, gf is well-defined if the codomain of f equals to the domain of g. It is clear that gf is still well-defined if imf is a subset of the domain of g. Hence, if f:AB,g:CD, then gf is well-defined if BC, or more generally, imfC.

Example 6.7.4

Let R denote the set of nonzero real numbers. Suppose

f:RR,f(x)=1x

g:R(0,),g(x)=3x2+11.

Determine fg and gf. Be sure to specify their domains and codomains.

Answer

To compute fg, we start with g, whose domain is R. Hence, R is the domain of fg. The result from g is a number in (0,). The interval (0,) contains positive numbers only, so it is a subset of R. Therefore, we can continue our computation with f, and the final result is a number in R. Hence, the codomain of fg is R. The image is computed according to f(g(x))=1/g(x)=1/(3x2+11). We are now ready to present our answer:

fg:RR, by:

(fg)(x)=13x2+11.

In a similar manner, the composite function gf:R(0,) is defined as (gf)(x)=3x2+11. Be sure you understand how we determine the domain and codomain of gf.

hands-on exercise 6.7.5

Let Z denote the set of integers. Determine hg, where g:ZR,g(x)=|x|,h:RR,h(x)=(x5)2 Is gh well-defined? Explain!

As usual, take extra caution with modular arithmetic.

Example 6.7.5

Define f:Z15Z23 and g:Z23Z32 according to

f(x)3x+5(mod23),g(x)2x+1(mod32).

We may expect gf:Z15Z23 to be defined as

(gf)(x)2(3x+5)+16x+11)(mod32).

In particular, (gf)(8)5927 (mod 32).

If we perform the computation one step at a time, we find f(8)296 (mod 23), from which we obtain (gf)(8)=g(f(8))=g(6)13(mod32). which is not what we have just found. Can you explain why?

Answer

The source of the problem is the different moduli used in f and g. The composite function should be defined as (gf)(x)2r+1(mod32),where r3x+5(mod23). In a way, this definition forces us to carry out the computation in two steps. Consequently, we will obtain the correct answer (gf)(8)=13.

There is a close connection between a bijection and its inverse function, from the perspective of composition.

Theorem 6.7.1

For a bijective function f:AB,

f1f=iA,andff1=iB,

where iA and iB denote the identity function on A and B, respectively.

Proof

To prove that f1f=iA, we need to show that (f1f)(a)=a for all aA. Assume f(a)=b. Then, because f1 is the inverse function of f, we know that f1(b)=a. Therefore,

(f1f)(a)=f1(f(a))=f1(b)=a,

which is what we want to show. The proof of ff1=iB procceds in the exact same manner, and is omitted here.

Example 6.7.6

Show that the functions f,g:RR defined by f(x)=2x+1 and g(x)=12(x1) are inverse functions of each other.

Answer

The problem does not ask you to find the inverse function of f or the inverse function of g. Instead, the answers are given to you already. You job is to verify that the answers are indeed correct, that the functions are inverse functions of each other.

Form the two composite functions fg and gf, and check whether they both equal to the identity function:

(fg)(x)=f(g(x))=2g(x)+1=2[12(x1)]+1=x,(gf)(x)=g(f(x))=12[f(x)1]=12[(2x+1)1]=x.

We conclude that f and g are inverse functions of each other.

hands-on exercise 6.7.6

Verify that f:RR+ defined by f(x)=ex, and g:R+R defined by g(x)=lnx, are inverse functions of each other.

Theorem 6.7.2

Suppose f:AB and g:BC. Let iA and iB denote the identity function on A and B, respectively. We have the following results.

  1. fiA=f and iBf=f.
  2. If both f and g are one-to-one, then gf is also one-to-one.
  3. If both f and g are onto, then gf is also onto.
  4. If both f and g are bijective, then gf is also bijective. In fact, (gf)1=f1g1.
Proof of (a)

To show that fiA=f, we need to show that (fiA)(a)=f(a) for all aA. This follows from direct computation: (fiA)(a)=f(iA(a))=f(a). The proofs of iBf=f and (b)–(d) are left as exercises.

Example 6.7.7

The converses of (b) and (c) in Theorem 6.7.2 are false, as demonstrated in the functions

g:ZZ,f(x)=2x,h:ZZ,g(x)=x/2

Here, gf=iZ, so gf is one-to-one, and it is obvious that f is also one-to-one, but g is not one-to-one. It is easy to see that both g and gf are onto, but f is not.

Summary and Review

  • The composition of two functions f:AB and g:BC is the function gf:AC defined by (gf)(x)=g(f(x)).
  • If f:AB is bijective, then f1f=iA and ff1=iB.
  • To check whether f:AB and g:BA are inverse of each other, we need to show that
    • (gf)(x)=g(f(x))=x for all xA, and
    • (fg)(y)=f(g(y))=y for all yB.

exercise 6.7.1

The functions g,f:RR are defined by f(x)=5x1 and g(x)=3x2+4. Determine fg and gf.

exercise 6.7.2

The function h:(0,)(0,) is defined by h(x)=x+1x. Determine hh. Simplify your answer as much as possible.

exercise 6.7.3

The functions g,f:RR are defined by f(x)=13x and g(x)=x2+1. Evaluate f(g(f(0))).

exercise 6.7.4

The functions p:(2,8]R and q:RR are defined by p(x)={3x1 if 2<x4172x if 4<x8q(x)={4x1 if x<33x+1 if x3 Evaluate qp.

exercise 6.7.5

Describe gf.

  1. f:ZN, f(n)=n2+1; g:NQ, g(n)=1n.
  2. f:R(0,1), f(x)=1/(x2+1); g:(0,1)(0,1), g(x)=1x.
  3. f:Q{2}Q, f(x)=1/(x2); g:QQ, g(x)=1/x.
  4. f:R[1,),f(x)=x2+1; g:[1,)[0,) g(x)=x1.
  5. f:Q{10/3}Q{3},f(x)=3x7; g:Q{3}Q{2}, g(x)=2x/(x3).

exercise 6.7.6

Describe gf.

  1. f:ZZ5, f(n)n (mod 5); g:Z5Z5, g(n)n+1 (mod 5).
  2. f:Z8Z12, f(n)3n (mod 12); g:→Z12Z6, g(n)2n (mod 6).

exercise 6.7.7

Describe gf.

  1. f:{1,2,3,4,5}{1,2,3,4,5}, f(1)=5, f(2)=3, f(3)=2, f(4)=1, f(5)=4;
  2. g:{1,2,3,4,5}{1,2,3,4,5}; g(1)=3, g(2)=1, g(3)=5, g(4)=4, g(5)=2
  3. f:{a,b,c,d,e}{1,2,3,4,5}; f(a)=5, f(b)=1, f(c)=2, f(d)=4, f(e)=3;
  4. g:{1,2,3,4,5}{a,b,c,d,e}; g(1)=e, g(2)=d, g(3)=a, g(4)=c, g(5)=b

exercise 6.7.8

Verify that f,g:RR defined by f(x)={112x if x<4 153x if x4 andg(x)={13(15x) if x3 12(11x) if x>3  are inverse to each other.

exercise 6.7.9

The functions f,g:ZZ are defined by f(n)={2n1 if n0 2n if n<0 andg(n)={n+1 if n is even 3n if n is odd  Determine gf.

exercise 6.7.10

Define the functions f and g on your maternal family tree (see Problem 6.7.8 in Exercises 1.2) according to f(x)=the mother of x,g(x)=the eldest daughter of the mother of x. Describe these functions.

  1. fg
  2. gf
  3. ff
  4. gg

exercise 6.7.11

Given the bijections f and g, find fg, (fg)1 and g1f1.

  1. f:ZZ, f(n)=n+1; g:ZZ, g(n)=2n.
  2. f:QQ, f(x)=5x; g:QQ, g(x)=x25.
  3. f:Q{2}Q{2}, f(x)=3x4; g:Q{2}Q{2}, g(x)=xx2.
  4. f:Z7Z7, f(n)2n+5 (mod 7); g:Z7Z7, g(n)3n2 (mod 7).

exercise 6.7.12

Give an example of sets A, B, and C, and of functions f:AB and g:BC, such that gf and f are both one-to-one, but g is not one-to-one.

exercise 6.7.13

Prove part (b) of Theorem 6.7.2.

exercise 6.7.14

Prove part (c) of Theorem 6.7.2.

exercise 6.7.15

Prove part (d) of Theorem 6.7.2.

exercise \PageIndex{16}\label{ex:compfcn-16}

The incidence matrices for the functions f :{\{a,b,c,d,e\}} \to{\{x,y,z,w\}} and g :{\{x,y,z,w\}}\to{\{1,2,3,4,5,6\}} are \begin{array}{ccccc} & \begin{array}{cccc} x & y & z & w \end{array} & & & \begin{array}{cccccc} 1 & 2 & 3 & 4 & 5 & 6 \end{array} \\ \begin{array}{c} a \\ b \\ c \\ d \\ e \end{array} & \left( \begin{array}{cccc} 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 \end{array} \right) & \text{ and } & \begin{array}{c} x \\ y \\ z \\ w \end{array} & \left( \begin{array}{cccccc} 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 \end{array} \right) \end{array} \nonumber respectively. Construct the incidence matrix for the composition g\circ f.


This page titled 6.7: Composite Functions is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Harris Kwong (OpenSUNY) .

  • Was this article helpful?

Support Center

How can we help?