Table of contents
1.
Introduction
2.
Composition of Functions
3.
Properties
4.
Examples
5.
FAQs
6.
Key Takeaways
Last Updated: Mar 27, 2024

Composition of Functions

Author Yukti Kumari
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

In this article, we will learn the concept composition of functions. We will start with introducing the composition of functions and then understand their properties, how to solve composite functions and work out some examples to make the concept crystal clear. 

Let’s get started 🚀 

Composition of Functions

Function composition is an operation “∘” that takes two functions f and g and forms a new function h =  f ∘ g, such that h(x) = f(g(x))

f(g(x)) essentially means the function f is applied to the result of applying g to x. 

It's important to note that h =  f ∘ g is valid only if the range/codomain of the function g is a subset of the domain of the function f.

Different ways to read the composition of functions,  f ∘ g are:

  • f of g
  • f after g
  • f composed with g

Let’s see few examples-

  • f(x) = 2x and g(x)=x3, then h(x) = f(g(x)) = f(x3) = 2x3
  • Similarly, h(x) = g(f(x)) = g(2x) = 8x3

Example showing the composition of functions

Source

Properties

  • Associative Property
    The associative property states that if f,g, and h are composable functions, then f ∘ (g ∘ h) = (f ∘ g) ∘ h. Due to this property, generally, parenthesis is omitted as the result remains the same.
     
  • Commutative Property
    Any two functions, f and g, are said to commute with each other if g ∘ f = f ∘ g. Only some particular functions follow this property. 
     
  • If two functions f and g are injective(one-to-one), then the function obtained by their composition is also injective.
     
  • If two functions f and g are surjective(onto), then the function obtained by their composition is also surjective.
     
  • From the previous two properties, the composition of two bijective(both injective and surjective) functions is also bijective.

Examples

Let’s solve a problem based on the composition of functions to gain more clarity.

Consider three functions f, g and h, such that f (x) =x2, g (x) = x + 1 and h (x) = x.

Determine (i) h ∘ f ∘ g       (ii) g ∘ f ∘ h  (iii) f ∘ g ∘ h

  • h ∘ f ∘ g
    h ∘ f ∘ g = h( f( g(x)))
    Putting g(x) = x+1, we get →
    h( f( g(x))) = h(f(x+1))
    Putting f(x+1) = (x+1)2 we get →
    h( f( g(x))) = h(f(x+1)) = h((x+1)2
    Finally, putting h((x+1)2) = (x+1)we get →
    h ∘ f ∘ g = h( f( g(x))) = h(f(x+1)) = h((x+1)2) = (x+1)2
     
  • g ∘ f ∘ h
    g ∘ f ∘ h = g( f( h(x)))
    Putting h(x) = x, we get →
    g( f( h(x))) = g(f(x))
    Putting f(x) = x2 we get →
    g( f( h(x))) = g(f(x)) = g(x2)
    Finally, putting g(x2), we get →
    g ∘ f ∘ h =g( f( h(x))) = g(f(x)) = g(x2) = x2 + 1
     
  • f ∘ g ∘ h
    f ∘ g ∘ h = f( g( h(x)))
    Putting, h(x)=x we get →
    f( g( h(x))) = f(g(x))
    Putting g(x)=x+1 we get →
    f( g( h(x))) = f(g(x)) = f(x+1)
    Finally, putting f(x+1)=(x+1)2 we get →
    f ∘ g ∘ h = f( g( h(x))) = f(g(x)) = f(x+1) = (x+1)2

FAQs

  1. What is the domain of a composite function?
    The domain of a composite function f(g(x)) is the set of those inputs x in the domain of g for which g(x) is in the domain of f.
     
  2. Are composite functions commutative?
    The fact that we can have g∘h≠h∘g, for some functions g,h, says that the composition of functions is not commutative. 
     
  3. What is the necessary condition to find the composite function of two functions?
    When two functions combine so that the output of one function becomes the input of the other, the function is a composite function.
     
  4. What is a bijective function?
    A function that is both surjective and injective is called bijective.
     
  5. What is an injective function?
    An injective function (also known as injection, or one-to-one function) is a function f that maps distinct elements to distinct elements; that is, f(x1) = f(x2) implies x1 = x2.

Key Takeaways

In this article, we have extensively discussed the Composition of functions, their properties, along with examples of composite functions.

We hope that this blog has helped you enhance your knowledge regarding the Composition of functions. If you would like to learn more, check out our articles on Cauchy’s mean value theoremProsecutor’s fallacyPoisson distributionRolle’s mean value theorem.

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. 

Enrol in our courses and refer to the mock test and problems available.

Take a look at the interview experiences and interview bundle for placement preparations.

Do upvote our blog to help other ninjas grow.

Happy Learning!

Live masterclass