0% found this document useful (0 votes)
85 views5 pages

1.5 Function Composition: (From Wikipedia, Author Tlep, Available Under The Creative Commons License.)

1. Function composition involves combining two functions by taking the output of one function as the input of another. It is represented as g ◦ f, where f is applied first, then g. 2. The order of functions matters - g ◦ f is not necessarily equal to f ◦ g. 3. Functions can be composed in chains, by applying multiple functions in sequence to an input. This allows breaking down complex functions as compositions of simpler functions.

Uploaded by

sairam patnaik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
85 views5 pages

1.5 Function Composition: (From Wikipedia, Author Tlep, Available Under The Creative Commons License.)

1. Function composition involves combining two functions by taking the output of one function as the input of another. It is represented as g ◦ f, where f is applied first, then g. 2. The order of functions matters - g ◦ f is not necessarily equal to f ◦ g. 3. Functions can be composed in chains, by applying multiple functions in sequence to an input. This allows breaking down complex functions as compositions of simpler functions.

Uploaded by

sairam patnaik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

1.

5 Function composition
1.5.1 The algebra of functions
Given two functions, say f (x) = x2 and g(x) = x + 1, we can, in obvious ways, add, subtract, multiply
and divide these functions. For example, the function f + g is defined simply by
(f + g)(x) = x2 + (x + 1);
the function f − g is defined simply by
(f + g)(x) = x2 − (x + 1).
Similarly
(f · g)(x) = (x2 ) · (x + 1)
and
f x2
( )(x) = .
g x+1
f
In the last case we should note that the function ( )(x) is not defined wherever g(x) is zero and so, in
g
f x2
this case, −1 is not in the domain of ( )(x) = .
g x+1

The operations of addition, subtraction, multiplication and division are easily and naturally defined on
functions. But a more important operation between functions is the operation of function composition.

1.5.2 Composing two functions


In an earlier lecture, a function was defined as a map from one set to another, taking each input to
a unique output. If we have a second function acting on the outputs of another, we can combine the
functions, creating the composition of the two functions. If f is a function from the set X into the set Y
and if g is a function from the set Y into the set Z then g ◦ f is a function from the set X into the set Z
defined by first allowing f to map elements of X into Y and then allowing elements of Y to be mapped
by g into Z
Here is a picture of this composition of two functions (copied from the Wikipedia article on function composition):

Figure 24. The function machine


(from Wikipedia, author Tlep, available under the Creative Commons license.)

Notice that in g ◦ f , f is the first function involved while g is the second! We read function notation
(g ◦ f )(x) from right to left. (This right-to-left method of creating function composition is due to our
basic function notation, f (x), since we want (g ◦ f )(x) to be the same as g(f (x)), inserting x first into
f and then inserting f (x) into g. In the example above in figure 24, g ◦ f maps the elements of X as
follows:
a 7→ @

41
b 7→ @
c 7→ #
d 7→!!

Some define a function as a “machine”, taking inputs and generating outputs.

When viewed that way, the composition of two functions will be a sequence of function machines:

Figure 25. The composition g ◦ f


(This diagram and the previous were created by Wvbailey and available under the Creative Commons License)

We may take the Wikipedia example and suppose that f (x) = x2 and that f maps the set R into the
set R. Suppose also, that g(x) = x + 1 and that g maps R to R. Then the function (g ◦ f ) maps real
numbers to real numbers. The function (g ◦ f ) maps 3 to 10 since f maps 3 to 32 = 9 and g maps 9 to
10.
If f and g are described by an equation then often (g ◦ f ) can be described by an equation. In this
case (g ◦ f )(x) = g(f (x)) = g(x2 ) = x2 + 1. So the composition function can be completely described by
(g ◦ f )(x) = x2 + 1.

42
1.5.3 Order is important! (f ◦ g 6= g ◦ f !)
If the codomain of the function f is the same as the domain of the function g, then we can compose first
f then g to create (g ◦ f ). Or we can compose first g then f to create (f ◦ g). But here, with the operation
of function composition, the order of composition is important! The function (f ◦ g) is probably not the
same function as (g ◦ f )!
For example, if f (x) = x2 and g(x) = x + 1 then (as done above) we have

(g ◦ f )(x) = x2 + 1.

But on the other hand (f ◦ g)(x) = f (g(x)) = f (x + 1) = (x + 1)2 . So

(g ◦ f )(x) = x2 + 1 but (f ◦ g)(x) = (x + 1)2 .

In elementary algebra we learned the importance of parentheses, for example, that1 + x2 is quite
different from (1 + x)2 . The use of parentheses and the order of operations is especially important in the
composition of functions. Here squaring and then adding one (g ◦ f ) is different from adding one and
then squaring (f ◦ g).

Some worked examples.


Given the functions f and g, below, find the composition functions f ◦ g and g ◦ f . The function
(f ◦ g)(x) is the same as f (g(x)); (g ◦ f )(x) is the same as g(f (x)). Please distinguish between your answer
for f ◦ g and g ◦ f .

1. f (x) = x2 − 1 and g(x) = x + 2



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


3. f (x) = x2 + 9 and g(x) = x.

4. f (x) = x2 + 5 and g(x) = x − 5.

Solution.

1. (f ◦ g)(x) = f (g(x)) = f (x + 2) = (x + 2)2 − 1 = x2 + 4x + 4 − 1 = x2 + 4x + 3.


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


2. f (x) = x2 + 1 and g(x) = 3.
√ √ 2
(f ◦ g)(x) = f (g(x)) = f ( 3) = 3 + 1 = 3 + 1 = 4.
√ √
(g ◦ f )(x) = g(f (x)). But g(anything) = 3, so the answer is 3.


(f ◦ g)(x) = 4 and (g ◦ f )(x) = 3.

3. f (x) = x2 + 9 and g(x) = x.

(f ◦ g)(x) = ( x)2 + 9 = x + 9.

(g ◦ f )(x) = x2 + 9.


(f ◦ g)(x) = x + 9 and (g ◦ f )(x) = x2 + 9.

43

4. f (x) = x2 + 5 and g(x) = x − 5.

(f ◦ g)(x) = ( x − 5)2 + 5 = (x − 5) + 5 = x.
√ √
(g ◦ f )(x) = x2 + 5 − 5 = x2 = |x|.

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

It is convenient at times to break a function down into pieces, so that we may view the function itself
as a composition of two or more functions.

For example, suppose h(x) = 3x + 4. If we input an x-value into h, we first compute 3x + 4 and
then take the√ square root. So we may view the function h as a composition of a function g(x) = 3x + 4
and f (x) = x.

Some more worked examples.

1. For each of the functions f (x) and h(x) below, find a function g(x) such that h(x) = (f ◦ g)(x).
2
−17)
(a) f (x) = 10x , h(x) = 10(x .
√ √
(b) f (x) = x, h(x) = x2 + 4.

Solution.
2
(a) h(x) = 10(x −17) = (f ◦ g)(x) if g(x) = x2 − 17.

(b) h(x) = x2 + 4 = (f ◦ g)(x) if g(x) = x2 + 4.

2. For each function h given below, decompose h into the composition of two functions f and g so
that h = f ◦ g.

(a) h(x) = (x + 5)2



3
(b) h(x) = 5x2 + 1

(c) h(x) = 2cos x

Solutions.

(a) h(x) = (x + 5)2 is the composition of g(x) = x + 5 and f (x) = x2 .


√ √
(b) h(x) = 3
5x2 + 1 is the composition of g(x) = 5x2 + 1 and f (x) = 3
x.

(c) h(x) = 2cos x is the composition of g(x) = cos x and f (x) = 2x . (We can find the functions g
and f , even if we have not yet studied the function cos x – the notation leads us to the answer!)

1.5.4 Chaining functions together


Once we understand function composition, there is no reason to stop at composing just two functions!
We can compose a chain of functions, running an input x through one function after another.

44

For example, suppose that f (x) = x2 , g(x) = 3x + 5 and h(x) = x. If we run x through f, g and h
in that order we get
p
(h ◦ g ◦ f )(x) = h(g(f (x))) = h(g(x2 )) = h(3x2 + 5) = 3x2 + 5.

There is no limit to the number √ of functions we can “chain” together. For example, suppose that
f (x) = x2 , g(x) = 3x + 5, h(x) = x and j(x) = cos(x). If we run x through f, g, h and j in that order
we get
p p
(j ◦ h ◦ g ◦ f )(x) = j(h(g(f (x)))) = j(h(g(x2 ))) = j(h(3x2 + 5)) = j( 3x2 + 5) = cos( 3x2 + 5).

(We can do this even if we have not yet studied the cosine function cos(x) – we just follow our notation!)
In calculus, after we study the derivative of a function, we will learn to take the derivative of a “chain”
of functions composed together in this manner. The method we develop there is called the “Chain Rule”
for derivatives.

1.5.5 Resources for the composition of functions


In the free textbook, Precalculus, by Stitz and Zeager (version 3, July 2011, available at stitz-zeager.com)
this material is covered in section 5.1.

In the free textbook, Precalculus, An Investigation of Functions, by Lippman and Rassmussen (Edition
1.3, available at www.opentextbookstore.com) this material is covered in section 1.4.

In the textbook by Ratti & McWaters, Precalculus, A Unit Circle Approach, 2nd ed., c. 2014,
here at Amazon.com this material appears in section 1.6. In the textbook by Stewart, Precalculus,
Mathematics for Calculus, 6th ed., c. 2012, (here at Amazon.com) this material appears in section
2.6. (In July 2013 the first textbook was $147 at Amazon.com and the second textbook was $136 at
Amazon.com They are even more expensive in campus bookstores.)

There are lots of online resources for studying the composition of functions. Here are some I recom-
mend.
In addition to the Wikipedia webpage on function composition there are also
1. Paul’s online math notes on function composition.
2. See these Khan Academy videos.

Worksheet to go with these notes.


As class homework, please complete Worksheet 1.5, Function composition, available through
the class webpage.

45

You might also like