Composition of Functions

Let f: A → B and g: B → C be two functions. Then the composition of f and g, denoted by gof, is defined as the function gof: A → C given by;

gof (x) = g(f (x)), ∀ x ∈ A

Example 1. Find gof and fog when f: R → R and g : R → R is defined by 

(i) f(x) = 2x + 3 and  g(x) = x2 + 5.

(ii) f(x) = 2x + x2 and  g(x) = x3

(iii) f (x) = x2 + 8 and g(x) = 3x3 + 1

(iv) f (x) = x and g(x) = |x|     

(v) f(x) = x2 + 2x − 3 and  g(x) = 3x − 4 

(vi) f(x) = 8x3 and  g(x) = x1/3

Solution:

(i) Given, f: R → R and g: R → R

So, gof: R → R and fog: R → R

Also given that f(x) = 2x + 3 and g(x) = x2 + 5

Now, (gof) (x) = g (f (x))

= g (2x +3)

= (2x + 3)2 + 5

= 4x2+ 9 + 12x +5

=4x2+ 12x + 14

Now, (fog) (x) = f (g (x))

= f (x2 + 5)

= 2 (x2 + 5) +3

= 2 x2+ 10 + 3

= 2x2 + 13

(ii) Given, f: R → R and g: R → R

so, gof: R → R and fog: R → R

f(x) = 2x + x2 and g(x) = x3

(gof) (x)= g (f (x))

= g (2x+x2)

= (2x+x2)3

Now, (fog) (x) = f (g (x))

= f (x3)

= 2 (x3) + (x3)2

= 2x+ x6

(iii) Given, f: R → R and g: R → R

So, gof: R → R and fog: R → R

f(x) = x2 + 8  and g(x) = 3x3 + 1

(gof) (x) = g (f (x))

= g (x2 + 8)

= 3 (x2+8)3 + 1

Now, (fog) (x) = f (g (x))

= f (3x3 + 1)

= (3x3+1)2 + 8

= 9x6 + 6x+ 1 + 8

= 9x+ 6x+ 9

(iv) Given, f: R → R and g: R → R

So, gof: R → R and fog: R → R

f(x) = x and g(x) = |x|

(gof) (x) = g (f (x))

= g (x)

= |x|

Now (fog) (x) = f (g (x))

= f (|x|)

= |x|

(v) Given, f: R → R and g: R → R

So, gof: R → R and fog: R → R

f(x) = x2 + 2x − 3 and g(x) = 3x − 4

(gof) (x) = g (f(x))

= g (x+ 2x − 3)

= 3 (x+ 2x − 3) − 4

= 3x+ 6x − 9 − 4

= 3x+ 6x − 13

Now, (fog) (x) = f (g (x))

= f (3x − 4)

= (3x − 4)+ 2 (3x − 4) −3

= 9x+ 16 − 24x + 6x – 8 − 3

= 9x− 18x + 5

(vi) Given, f: R → R and g: R → R

So, gof: R → R and fog: R → R

f(x) = 8x3 and g(x) = x1/3

(gof) (x) = g (f (x))

= g (8x3)

= (8x3)1/3

= [(2x)3]1/3

= 2x

Now, (fog) (x) = f (g (x))

= f (x1/3)

= 8 (x1/3)3

= 8x

Example 2. Let f = {(3, 1), (9, 3), (12, 4)} and g = {(1, 3), (3, 3) (4, 9) (5, 9)}. Show that gof and fog are both defined. Also, find fog and gof.

Solution:

Given f = {(3, 1), (9, 3), (12, 4)} and g = {(1, 3), (3, 3) (4, 9) (5, 9)}

f : {3, 9, 12} → {1, 3, 4} and g : {1, 3, 4, 5} → {3, 9}

Co-domain of f is a subset of the domain of g.

So, gof exists and gof: {3, 9, 12} → {3, 9}

(gof) (3) = g (f (3)) = g (1) = 3

(gof) (9) = g (f (9)) = g (3) = 3

(gof) (12) = g (f (12)) = g (4) = 9

⇒ gof = {(3, 3), (9, 3), (12, 9)}

Co-domain of g is a subset of the domain of f.

So, fog exists and fog: {1, 3, 4, 5} → {3, 9, 12}

(fog) (1) = f (g (1)) = f (3) = 1

(fog) (3) = f (g (3)) = f (3) = 1

(fog) (4) = f (g (4)) = f (9) = 3

(fog) (5) = f (g (5)) = f (9) = 3

⇒ fog = {(1, 1), (3, 1), (4, 3), (5, 3)}

Example 3.  Let f = {(1, −1), (4, −2), (9, −3), (16, 4)} and g = {(−1, −2), (−2, −4), (−3, −6), (4, 8)}. Show that gof is defined while fog is not defined. Also, find gof.

Solution:

Given f = {(1, −1), (4, −2), (9, −3), (16, 4)} and g = {(−1, −2), (−2, −4), (−3, −6), (4, 8)}

f: {1, 4, 9, 16} → {-1, -2, -3, 4} and g: {-1, -2, -3, 4} → {-2, -4, -6, 8}

Co-domain of f = domain of g

So, gof exists and gof: {1, 4, 9, 16} → {-2, -4, -6, 8}

(gof) (1) = g (f (1)) = g (−1) = −2

(gof) (4) = g (f (4)) = g (−2) = −4

(gof) (9) = g (f (9)) = g (−3) = −6

(gof) (16) = g (f (16)) = g (4) = 8

So, gof = {(1, −2), (4, −4), (9, −6), (16, 8)}

But the co-domain of g is not same as the domain of f.

So, fog does not exist.

Example 4:. If f(x) = |x|, prove that fof = f.

Solution:

Given f(x) = |x|,

Now we have to prove that fof = f.

Consider (fof) (x) = f (f (x))

= f (|x|)

= ||x||

= |x|

= f (x)

So,

(fof) (x) = f (x), ∀x ∈ R

Hence, fof = f.