Lesson Explainer: Composite Functions | Nagwa Lesson Explainer: Composite Functions | Nagwa

Lesson Explainer: Composite Functions Mathematics • Second Year of Secondary School

In this explainer, we will learn how to form a composite function by composing two or more functions.

Let us begin by recalling the definition of a function and a domain, along with some notation we will be using in this explainer.

Definition: Functions and Domains

A function 𝑓𝑋𝑌 is a relation that sends elements from the domain 𝑋 to the codomain 𝑌. The domain is defined to be the set of all possible inputs 𝑥 of the function such that 𝑓(𝑥) is defined.

Now, to help explain composite functions, let us consider the following analogy. Suppose a cyclist is traveling along a mountainous path. As they go up and down the mountain, their altitude 𝑧 (in metres above sea level) varies with respect to the time 𝑡 since they started cycling (in minutes). Let us suppose this altitude is given by the function 𝑧=𝑍(𝑡).

Let us also suppose that in the region that the cyclist is traveling, the temperature (in degrees Celsius) depends only on the altitude. So no matter where exactly they are, their altitude determines their temperature. In other words, the temperature 𝑇(𝑧) is a function of altitude 𝑧.

Thus, since the temperature can be calculated from the altitude, and the altitude can be calculated from the time elapsed, the temperature can be calculated from the time elapsed, as follows: timealtitudetemperature𝑡𝑧=𝑍(𝑡)𝑇(𝑧)=𝑇(𝑍(𝑡))

For instance, if after 12 minutes the cyclist is at an altitude of 335 m, and it is known that the temperature at 335 m is 14C, it follows that the temperature they experience after 12 minutes is 14C.

This process is known as function composition. The new function we have created, 𝑡𝑇(𝑍(𝑡)), is a composite function. We can formally define composite functions as follows.

Definition: Composite Functions

Let 𝑓 and 𝑔 be functions. Then, the composite function 𝑔𝑓 is defined by (𝑔𝑓)(𝑥)=𝑔(𝑓(𝑥)).

Note that the order of 𝑔𝑓 (pronounced “𝑔 of 𝑓”) is important; this applies 𝑓 to 𝑥 first, followed by 𝑔. The precise domain of 𝑔𝑓 is slightly tricky to figure out; hence, we will return to it later on in the explainer.

For now, let us consider a concrete example of calculating composite functions. Suppose we have the functions 𝑓(𝑥)=3𝑥+𝜋,𝑓,𝑔(𝑥)=2𝑥+𝑥1,𝑔.

Then, to calculate 𝑔𝑓, we substitute every occurrence of 𝑥 in 𝑔(𝑥) with 𝑓(𝑥), as follows: (𝑔𝑓)(𝑥)=𝑔(𝑓(𝑥))=𝑔(3𝑥+𝜋)=2(3𝑥+𝜋)+(3𝑥+𝜋)1=29𝑥+6𝜋𝑥+𝜋+3𝑥+𝜋1=18𝑥+(12𝜋+3)𝑥+2𝜋+𝜋1.

Another way to think of this is that we substitute the innermost values first (in this case 𝑓(𝑥)) and work outward.

Alternatively, we could compose them in the opposite order. We would have (𝑓𝑔)(𝑥)=𝑓(𝑔(𝑥))=𝑓2𝑥+𝑥1=32𝑥+𝑥1+𝜋=6𝑥+3𝑥3+𝜋.

It is important to note that 𝑓𝑔𝑔𝑓. In fact, generally speaking, it may not always be possible to compose functions in the opposite order, depending on the domains and ranges. This leads to the following rule.

Rule: Commutativity of the Composition of Functions

The composition of functions is not commutative. This means that for two functions 𝑓 and 𝑔, 𝑓𝑔 is not the same as 𝑔𝑓. The two operations are only equal under specific circumstances (e.g., 𝑓=𝑔).

We have now been introduced to function composition and some of the properties it has. Let us test our knowledge with the following example.

Example 1: Finding the Expression of a Composite Function

If 𝑓(𝑥)=3 and 𝑔(𝑥)=𝑥2, what is (𝑓𝑔)(𝑥)?

Answer

Recall that, from the definition of a composite function, (𝑓𝑔)(𝑥)=𝑓(𝑔(𝑥)).

To evaluate a composite function, we substitute in the expressions for 𝑔 and 𝑓, starting from the inside and going outward. The innermost expression is 𝑔(𝑥); therefore, substituting in 𝑔(𝑥)=𝑥2, we have 𝑓(𝑔(𝑥))=𝑓(𝑥2).

Now we can substitute in 𝑓(𝑥)=3. This just means that we take 3 and replace the argument 𝑥 with 𝑥2. This gives us 𝑓(𝑥2)=3.

In conclusion, we have (𝑓𝑔)(𝑥)=3.

We have now seen a couple of basic examples of how function composition works. Sometimes, we may be asked to evaluate composite functions at a specific point. As we will see in the next example, this is actually easier than computing the entire function.

Example 2: Evaluating Composite Functions at a Given Value

Given 𝑓(𝑥)=3𝑥1 and 𝑔(𝑥)=𝑥+1, find (𝑓𝑔)(2).

Answer

Recall, from the definition, that we have (𝑓𝑔)(𝑥)=𝑓(𝑔(𝑥)).

In this question, we have to evaluate the above expression at 𝑥=2; that is, (𝑓𝑔)(2)=𝑓(𝑔(2)).

We begin by substituting in the expression for 𝑔(𝑥) and evaluating it at 2, as follows: 𝑓(𝑔(2))=𝑓2+1=𝑓(5).

Now we simply substitute in 𝑓(𝑥)=3𝑥1 and evaluate it at 5: 𝑓(𝑔(2))=3(5)1=14.

Thus, (𝑓𝑔)(2)=14.

Note

We did not have to work out the full expression for (𝑓𝑔)(𝑥) here to evaluate it at a certain value. If it had been necessary, we could have calculated (𝑓𝑔)(𝑥)=3𝑥+2 first and evaluated it at 2 to get 14.

Evaluation of composite functions can be done using the expressions of the component functions, as we saw in the previous example. Equally, we can evaluate them using graphs of the component functions, which we will show in the next example.

Example 3: Evaluating Composite Functions at a Given Value from Their Graphs

In the given figure, the red graph represents 𝑦=𝑓(𝑥), while the blue represents 𝑦=𝑔(𝑥).

What is 𝑓(𝑔(2))?

Answer

To calculate 𝑓(𝑔(2)), we start from the inside of the expression and calculate 𝑔(2) and then substitute this value into 𝑓.

To find 𝑔(2) from the graph, we draw a line segment from the 𝑥-axis at 𝑥=2 to the curve for 𝑔(𝑥) (the blue curve) and project it onto the 𝑦-axis. We show this below.

This gives us 𝑔(2)=1. Thus, we have 𝑓(𝑔(2))=𝑓(1). To calculate 𝑓(1), we return to the diagram and follow the same procedure; we draw a line from the 𝑥-axis at 𝑥=1 to the line for 𝑓(𝑥) (the red curve) and follow it to the 𝑦-axis, as shown below.

So, 𝑓(1)=3. Overall, this gives us 𝑓(𝑔(2))=3.

Up until now, we have only seen a function composed with one other function at a time, but we can extend this to composing multiple functions together by simply using the definition of function composition multiple times. For instance, (𝑓𝑔)(𝑥)=𝑓(𝑔((𝑥))).

In the next example, we will see how this works if we compose the same function with itself multiple times.

Example 4: Evaluating the Composite of a Function with Itself Multiple Times at a Given Value

Set 𝑓=𝑓𝑓(), 𝑓=𝑓𝑓𝑓(), and so on such that 𝑓(𝑥)=𝑓(𝑓(𝑥))(), 𝑓(𝑥)=𝑓(𝑓(𝑓(𝑥)))(), and so on. Suppose 𝑔(𝑥)=4𝑥5. Find 𝑔(3)().

Answer

Using the logic above, we are being asked to calculate 𝑔(3)=𝑔(𝑔(𝑔(𝑔(3)))).()

This might look tricky at first, but note that we do not actually have to calculate 𝑔(𝑥)(). We simply need to calculate 𝑔(3) and then apply 𝑔 to the result multiple times. Let us do this below: 𝑔(3)=4(3)5=7,𝑔(𝑔(3))=𝑔(7)=4(7)5=23,𝑔(𝑔(𝑔(3)))=𝑔(23)=4(23)5=87,𝑔(𝑔(𝑔(𝑔(3))))=𝑔(87)=4(87)5=343.

So, in conclusion, we have 𝑔(3)=343().

Earlier, we said we would return to the issue of the domain of a composite function, so let us explore that concept now.

The general method for finding the domain of a composite function is fairly complicated, but in some cases, if we try substituting the inner function into the outer function, it may simplify into a form in which we can directly determine the domain. Let us present a short example of this. Suppose we have 𝑓(𝑥)=𝑥3,𝑓,𝑔(𝑥)=𝑥,𝑔[0,[[0,[, and we want to find the domain of 𝑔𝑓. If we substitute 𝑓 into 𝑔, we get 𝑔(𝑓(𝑥))=𝑓(𝑥)=𝑥3.

From here, we can figure out the domain of the function by noting that the input of a square root must always be positive. This means that 𝑥3𝑥30𝑥3.

That is to say, the domain of 𝑔𝑓 is equal to [3,[.

Let us attempt another example of this, where this time the resulting composite function is a rational function.

Example 5: Determining the Domain of a Composite Function

If the function 𝑓(𝑥)=2𝑥, where 𝑥0, and the function 𝑔(𝑥)=𝑥41, determine the domain of 𝑓𝑔.

Answer

To determine the domain of a function composition, one method is to evaluate 𝑓𝑔 as a function by substituting 𝑔 into 𝑓 and finding the domain of the resulting function. Doing this, we get (𝑓𝑔)(𝑥)=𝑓(𝑔(𝑥))=2𝑔(𝑥)=2𝑥41.

As this is a rational function, we can determine its domain directly. Recall that the domain of a rational function is determined by the restriction that its denominator has to be nonzero for all 𝑥 (since we cannot divide by zero). That is, 2𝑥41𝑥410𝑥41.

So, the domain is every real value of 𝑥 except for 41, or in other words, the domain is {41}.

Let us further consider the domain and range of the composite function in the previous example and how they differ from the domains and ranges of the original functions. We note that, originally, 𝑓 and 𝑔 have domains and ranges as follows: 𝑓(𝑥)=2𝑥{0},{0},𝑔(𝑥)=𝑥41,.domainrangedomainrange

For 𝑓(𝑥), since it is a rational function, we recall that its domain is all of , except for the point where its denominator is zero (i.e., at 𝑥=0), and its range is all of , except for zero, since 2𝑥 can never be zero. For 𝑔(𝑥), since it is a linear function, it has both a domain and range of .

In comparison, 𝑓𝑔 has a domain and range given by 𝑓(𝑥)=2𝑥41{41},{0}.domainrange

Since it is a rational function, the domain and range are found similarly to those of 2𝑥; the only difference is the domain, which we calculated previously. If we plot the two rational functions, we have the following.

In other words, they take the exact same shape, except that the composite function has been shifted to the right by 41 units.

Let us finish by recapping the main things we have learned in this explainer.

Key Points

  • Let 𝑓 and 𝑔 be functions. Then, the composite function 𝑔𝑓 is defined by (𝑔𝑓)(𝑥)=𝑔(𝑓(𝑥)).
  • We can compute 𝑔(𝑓(𝑥)) by replacing each instance of 𝑥 in 𝑔(𝑥) by 𝑓(𝑥).
  • The composition of functions is not commutative. This means that for two functions 𝑓 and 𝑔, 𝑓𝑔 is not the same as 𝑔𝑓.
  • We can determine the domain of 𝑔𝑓 by substituting 𝑓 into 𝑔 and finding the domain of the resulting function 𝑔(𝑓(𝑥)).

Join Nagwa Classes

Attend live sessions on Nagwa Classes to boost your learning with guidance and advice from an expert teacher!

  • Interactive Sessions
  • Chat & Messaging
  • Realistic Exam Questions

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy