Skip to content Skip to navigation Skip to collection information

OpenStax_CNX

You are here: Home » Content » Functions » Composition of functions

Navigation

Recently Viewed

This feature requires Javascript to be enabled.
 

Composition of functions

Module by: Sunil Kumar Singh. E-mail the author

Function is a relation on two sets by a rule. It is a special mapping between two sets. It emerges that it is possible to combine two functions, provided co-domain of one function is domain of another function. The composite function is a relation by a new rule between sets, which are not common to the functions.

We can understand composition in terms of two functions. Let there be two functions defined as :

f : A B by f(x) for all x A f : A B by f(x) for all x A

g : B C by g(x) for all x B g : B C by g(x) for all x B

Observe that set “B” is common to two functions. The rules of the functions are given by “f(x)” and “g(x)” respectively. Our objective here is to define a new function h : A C h : A C and its rule.

Thinking in terms of relation, “A” and “B” are the domain and co-domain of the function “f”. It means that every element “x” of “A” has an image “f(x)” in “B”.

Similarly, thinking in terms of relation, “B” and “C” are the domain and co-domain of the function “g”. In this function, "f(x)" – which was the image of pre-image “x” in “A” – is now pre-image for the function “g”. There is a corresponding unique image in set "C". Following the symbolic notation, "f(x)" has image denoted by "g(f(x))" in "C". The figure here depicts the relationship among three sets via two functions (relations) and the combination function.

Figure 1: Composition functions is a special relation between sets not common to two functions.
Composition of two functions
 Composition of two functions  (cf1a.gif)

For every element, “x” in “A”, there exists an element f(x) in set “B”. This is the requirement of function “f” by definition. For every element “f(x)” in “B”, there exists an element g(f(x)) in set “B”. This is the requirement of function “g” by definition. It follows, then, that for every element “x” in “A”, there exists an element g(f(x)) in set “C”. This concluding statement is definition of a new function :

h : A C by g(f(x)) for all x A h : A C by g(f(x)) for all x A

By convention, we call this new function as “gof” and is read as "g circle f" or "g composed with f".

g o f x = g f x for all x A g o f x = g f x for all x A

The two symbolical representations are equivalent.

Example

Problem 1: Let two sets be defined as :

h : R R by x 2 for all x R h : R R by x 2 for all x R

k : R R by x + 1 for all x R k : R R by x + 1 for all x R

Determine “hok” and “koh”.

Solution : According to definition,

h o k x = h k x h o k x = h k x

h o k x = h x + 1 h o k x = h x + 1

h o k x = x + 1 2 h o k x = x + 1 2

Again, according to definition,

k o h x = k h x k o h x = k h x

k o h x = k x 2 k o h x = k x 2

k o h x = x 2 + 1 k o h x = x 2 + 1

Importantly note that h o k x k o h x h o k x k o h x . It indicates that composition of functions is not commutative.

Existence of composition set

In accordance with the definition of function, “f”, the range of “f” is a subset of its co-domain “B”. But, set “B” is the domain of function “g” such that there exists image g(f(x)) in “C” for every “x” in “A”. This means that range of “f” is subset of domain of “g” :

Range of “f” Domain of “g” Range of “f” Domain of “g”

Clearly, if this condition is met, then composition “gof” exists. Following this conclusion, “fog” will exist, if

Range of “g” Domain of “f” Range of “g” Domain of “f”

And, if both conditions are met simultaneously, then we can conclude that both “gof” and “fog” exist. Such possibility is generally met when all sets involved are set of real numbers, “R”.

Example

Problem 2: Let two functions be defined as :

f = { 1,2 , 2,3 , 3,4 , 4,5 } f = { 1,2 , 2,3 , 3,4 , 4,5 }

g = { 2,4 , 3,2 , 4,3 , 5,1 } g = { 2,4 , 3,2 , 4,3 , 5,1 }

Check whether “gof” and “fog” exit for the given functions?

Solution : Here,

Domain of “f” = { 1,2,3,4 } Domain of “f” = { 1,2,3,4 }

Range of “f” = { 2,3,4,5 } Range of “f” = { 2,3,4,5 }

Domain of “g” = { 2,3,4,5 } Domain of “g” = { 2,3,4,5 }

Range of “g” = { 4,2,3,1 } = { 1,2,3,4 } Range of “g” = { 4,2,3,1 } = { 1,2,3,4 }

Hence,

Range of “f” Domain of “g” Range of “f” Domain of “g”

and

Range of “g” Domain of “f” Range of “g” Domain of “f”

It means that both compositions “gof” and “fog” exist for the given sets.

Domain of Composition

Composition of two functions results in new rule for the new composite function. The expression of new rule may prohibit certain elements of the original domain set. For example, consider the function,

f x = 1 1 - x when x 1 f x = 1 1 - x when x 1

Clearly, the domain of function is R – {1}. Let us now see the expression of composition of function with itself,

f o f = f f x = 1 1 1 1 x = 1 x 1 x 1 f o f = f f x = 1 1 1 1 x = 1 x 1 x 1

f o f = x 1 x f o f = x 1 x

This expression is valid for real values of “x” when x 0 x 0 . Thus, we see that new rule has changed the domain of resulting function. The domain of the composition fof(x) is "R - {0,1}".

If functions “f” and “g” having different intervals of real numbers are involved in the composition, then we consider both the intervals and determine the domain of the composition by meeting requirement of both intervals (common interval). This aspect is illustrated in the examples given in the next section.

Algorithm for finding interval of composition

The most important aspect of working with composition of function is to combine intervals i.e. domains of two functions. Consider for example the function given by :

f x = x + 1 ; 0 x 2 f x = x + 1 ; 0 x 2

g x = | x | ; 0 x 3 g x = | x | ; 0 x 3

Here, "|x|" is modulus function, which returns non-negative number for all real values of "x". We are required to find fog(x). What would be the domain of the resulting composition? Let us have a closer look at the definition of composition,

f o g x = f g x = f | x | f o g x = f g x = f | x |

In plain words, it means that argument of the function “f” is the function “g” itself. The function “f” is defined in the domain "0 ≤ x ≤ 2", whereas function “g” is defined in "0≤x≤3". From the expression of composition as above, it is clear that we need to ensure that value of “x” should lie in the domain interval of function “g”. Hence,

f o g x = f g x = f | x | ; 0 x 3 f o g x = f g x = f | x | ; 0 x 3

But function “f” is defined for values of “x”, which lie in its interval “0≤x≤2”. So when we expand the composition in accordance with the rule of function “f”, we should ensure that value of its argument – note that it is not the value of independent variable “x” - lies in the interval specified by its domain.

f o g x = | x | + 1 ; 0 | x | 2 and 0 x 3 f o g x = | x | + 1 ; 0 | x | 2 and 0 x 3

Note that interval of function “f” is written with respect to function “g” i.e. “|x|” – not “x”. Since requirements of both functions are required to be met simultaneously, the domain of the resulting composition is intersection of two domains. It is this reason that we use either “and” or a comma “,” to combine two intervals.

Now, we interpret the interval of modulus function “0≤ |x| ≤2”. We see that part of the interval, "|x| ≥0", is always true for all values of “x”. Whereas part of the interval, "|x| ≤2", means (we shall learn about interpreting modulus inequality in a separate module) :

- 2 x 2 - 2 x 2

Combining intervals of two parts of the interval “0≤ |x| ≤2”, we conclude that it is equal to :

- 2 x 2 - 2 x 2

Hence,

f o g x = | x | + 1 ; - 2 x 2 and 0 x 3 f o g x = | x | + 1 ; - 2 x 2 and 0 x 3

f o g x = | x | + 1 ; 0 x 2 f o g x = | x | + 1 ; 0 x 2

Examples

Problem 3: Consider the function as given here :

f x = x + 1 ; 0 x 2 f x = x + 1 ; 0 x 2

Determine fof(x).

Solution : The composition of the function with itself is :

f o f x = f f x = f x + 1 ; 0 x 2 f o f x = f f x = f x + 1 ; 0 x 2

f o f x = x + 1 + 1 ; 0 x + 1 2 and 0 x 2 f o f x = x + 1 + 1 ; 0 x + 1 2 and 0 x 2

f o f x = x + 2 ; - 1 x 1 and 0 x 2 f o f x = x + 2 ; - 1 x 1 and 0 x 2

f o f x = x + 2 ; 0 x 1 f o f x = x + 2 ; 0 x 1

Problem 4: A function is defined for real values by :

f x = 1 1 - x for all real values except x = 1 f x = 1 1 - x for all real values except x = 1

Determine f[f{f(x)}] and draw the graph of resulting composition.

Solution : This is composition triplet. We have already seen that :

f o f = f { f x } = x - 1 x when x 0 , 1 f o f = f { f x } = x - 1 x when x 0 , 1

Compositing again with f(x), we have :

f [ f { f x } ] = 1 1 x 1 x = x x x + 1 when x 0 , 1 f [ f { f x } ] = 1 1 x 1 x = x x x + 1 when x 0 , 1

y = f [ f { f x } ] = x when x 0 , 1 y = f [ f { f x } ] = x when x 0 , 1

The graph of the composition is as shown here :

Figure 2: The plot is a straight line with two undefined points.
Plot of compostion
 Plot of compostion  (cf2.gif)

Problem 5: A function is defined for real values by :


       | 1 + x ;  0 ≤ x ≤ 2    
f(x) = |  
       | 3 – x ;  2 < x ≤ 3  

Determine f(f(x)).

Solution : The function “f(x)” is combined with itself. Here,


          | f(1 + x) ;  0 ≤ x ≤ 2    
f(f(x)) = |
          | f(3 - x) ;  2 < x ≤ 3    

We need to evaluate function for each of the above two intervals :


f(1 + x) ;  0 ≤ x ≤ 2 


  | 1 + (1+x) ; 0 ≤ 1+ x ≤ 2 and 0 ≤ x ≤ 2    
= |
  | 3 – (1+x); 2 < 1+ x ≤ 3 and 0 ≤ x ≤ 2  


  | 2 + x ; -1 ≤ x ≤ 1 and 0 ≤ x ≤ 2    
= |
  | 2 – x ; 1 < x ≤ 2 and 0 ≤ x ≤ 2 


  | 2 + x ; 0 ≤ x ≤ 1 
= |
  | 2 – x ; 1 < x ≤ 2 

Similarly,


f(3 - x) ;  2 < x ≤ 3


  | 1 + (3-x) ; 0 ≤ 3- x ≤ 2 and 2 < x ≤ 3    
= |
  | 3 – (3-x) ; 2 < 3- x ≤3 and 2 < x ≤3  


  | 4 - x ;  -3 ≤ x ≤ -1 and 2 < x ≤ 3    
= |
  | x     ; -1 < x ≤ 0 and 2 < x ≤ 3  


  | 4 - x ;  1 ≤ x ≤ 3 and 2 < x ≤ 3    
= |
  | x     ; 0 < x ≤ 1 and 2 < x ≤ 3 


  | 4 - x ;  2 < x ≤ 3    
= |
  |   x   ; No common interval  


= | 4 - x ;  2 < x ≤ 3    

Putting the results in the expression of “fof”, we have :


          | 2 + x ; 0 ≤ x ≤1
f(f(x)) = | 2 – x ; 1 < x ≤ 2
          | 4 - x ; 2 < x ≤ 3  

Properties of composition

The composition is generally not commutative except for some special functions.

g o f x f o g x g o f x f o g x

On the other hand, composition among three functions is independent of parentheses and hence is associative.

g o f o h = g o f o h g o f o h = g o f o h

Collection Navigation

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add:

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks