Back to homeMathematics · Precalculus · Change subject
Start for free
Precalculus · Mathematics
Functions · Real functions

Composition of Functions

Before you start, make sure you know: Basic concepts (Algebra 1)
Before you start, make sure you know: Algebraic expressions (Algebra 1)

Emma is buying a $\$100$ jacket. The store takes $15\%$ off, and she also has a $\$20$ coupon. Does it matter which one the cashier applies first? The final price depends on the original price through two functions applied one after the other. Chaining functions like this is called composition, and the order you choose changes the answer.

What it means to compose two functions

Flow diagram of a composition: the input x goes into the function f to produce f(x), and that result goes into the function g to produce g(f(x)). x f f(x) g g(f(x)) (g ∘ f)(x) = g(f(x)): first f, then g

Think of it as working from the inside out: the innermost function touches $x$ first. With three functions, $(h \circ g \circ f)(x) = h(g(f(x)))$: apply $f$, then $g$, then $h$.

Tables and graphs work the same way. Find $f(a)$ in the table or on the graph of $f$, then use that number as the input in the table or on the graph of $g$. Suppose $f$ and $g$ are given by these tables:

$x$ $-1$ $0$ $1$ $2$
$f(x)$ $3$ $1$ $0$ $-2$
$x$ $-2$ $0$ $1$ $3$
$g(x)$ $5$ $-1$ $4$ $2$

To find $(g \circ f)(-1)$, read $f(-1) = 3$ from the first table, then $g(3) = 2$ from the second. So $(g \circ f)(-1) = 2$. Likewise $(g \circ f)(2) = g(-2) = 5$.

Practice★☆☆Not started
Given the functions $f(x) = 3x + 2$ and $g(x) = x^2 - 1$, calculate the numerical value of the composition $(g \circ f)(2)$.

Given the functions $f(x) = 3x + 2$ and $g(x) = x^2 - 1$, calculate the numerical value of the composition $(g \circ f)(2)$.

Solve
Practice★☆☆Not started
Consider the functions $f(x) = x - 2$, $g(x) = 3x$ and $h(x) = x^2$. Calculate the numerical value of the successive composition $(h \circ g \circ f)(4)$.

Consider the functions $f(x) = x - 2$, $g(x) = 3x$ and $h(x) = x^2$. Calculate the numerical value of the successive composition $(h \circ g \circ f)(4)$.

Solve
Practice★★☆Not started
Observe the following graph where the functions $f(x)$ (in blue) and $g(x)$ (in green) are represented. From the visual information and without needing to obtain their…

Observe the following graph where the functions $f(x)$ (in blue) and $g(x)$ (in green) are represented. From the visual information and without needing to obtain their algebraic expressions, determine the numerical values of $(f \circ g)(2)$ and $(g \circ f)(-1)$.

X Y f(x) g(x)
Solve

Finding the algebraic expression

Rational functions work the same way, but be careful with fractions.

Constant functions are a special case. If $f(x) = c$, then $f(g(x)) = c$ for every $x$, because the output of $f$ never changes. And $g(f(x)) = g(c)$ is also a constant, because $f$ always feeds the same number into $g$.

Practice★☆☆Not started
Find the algebraic expression of the composite function $(f \circ g)(x)$ knowing that $f(x) = 5x - 4$ and $g(x) = x^2 + 3x$.

Find the algebraic expression of the composite function $(f \circ g)(x)$ knowing that $f(x) = 5x - 4$ and $g(x) = x^2 + 3x$.

Solve
Practice★☆☆Not started
Given the rational functions $f(x) = \frac{2}{x}$ and $g(x) = x + 3$, determine the simplified expression for $(f \circ g)(x)$ and for $(g \circ f)(x)$.

Given the rational functions $f(x) = \frac{2}{x}$ and $g(x) = x + 3$, determine the simplified expression for $(f \circ g)(x)$ and for $(g \circ f)(x)$.

Solve
Practice★☆☆Not started
Given the constant function $f(x) = 7$ and the quadratic function $g(x) = 2x^2 - x$, determine the algebraic expressions for $(f \circ g)(x)$ and $(g \circ f)(x)$.

Given the constant function $f(x) = 7$ and the quadratic function $g(x) = 2x^2 - x$, determine the algebraic expressions for $(f \circ g)(x)$ and $(g \circ f)(x)$.

Solve

Composition is not commutative

The store at the beginning confirms it: taking $15\%$ off first and then subtracting the coupon does not give the same price as subtracting the coupon first and then taking $15\%$ off.

The identity function $I(x) = x$ does nothing to its input, so composing with it changes nothing: $(f \circ I)(x) = f(x)$ and $(I \circ f)(x) = f(x)$. The identity is an example where the order does not matter.

Sometimes two compositions agree for a particular choice of parameters. For that to hold for all $x$, the two expressions must be the same polynomial, so their coefficients must match.

Practice★☆☆Not started
Using the functions $f(x) = 5x - 4$ and $g(x) = x^2 + 3x$, find the expression for $(g \circ f)(x)$ and prove analytically that the composition of functions is not…

Using the functions $f(x) = 5x - 4$ and $g(x) = x^2 + 3x$, find the expression for $(g \circ f)(x)$ and prove analytically that the composition of functions is not commutative.

Solve
Practice★★☆Not started
Given the functions $f(x) = 2x + k$ and $g(x) = 4x - 3$, find the value of the parameter $k$ so that the commutative property is fulfilled in this particular case, that…

Given the functions $f(x) = 2x + k$ and $g(x) = 4x - 3$, find the value of the parameter $k$ so that the commutative property is fulfilled in this particular case, that is, that $(f \circ g)(x) = (g \circ f)(x)$ for any value of $x$.

Solve
Practice★☆☆Not started
Prove analytically that by composing the function $f(x) = \frac{3x + 1}{x - 2}$ with the identity function $I(x) = x$, the same original function is obtained. Calculate…

Prove analytically that by composing the function $f(x) = \frac{3x + 1}{x - 2}$ with the identity function $I(x) = x$, the same original function is obtained. Calculate and simplify both $(f \circ I)(x)$ and $(I \circ f)(x)$.

Solve

Composition in models: chaining formulas

Composition is how we link formulas in real problems. If a quantity $A$ depends on $s$, and $s$ depends on time $t$, then $A$ depends on $t$ through the composite function $A(s(t))$.

Chain of two formulas: time t goes into s(t) = 4 + 2t, and the side s goes into A(s) = s squared to give the area. t s(t) = 4 + 2t A(s) = s² A(s(t)) The output of s becomes the input of A

If you only need a number, you can also go step by step: compute the inner value first, then the outer one. If you need a formula that works for any $t$, compose symbolically.

Practice★★☆Not started
When throwing a stone into a pond, a circular wave is formed whose radius increases with time according to the function $r(t) = 2.5t$ (with $r$ in inches and $t$ in…

When throwing a stone into a pond, a circular wave is formed whose radius increases with time according to the function $r(t) = 2.5t$ (with $r$ in inches and $t$ in seconds). Knowing that the area of the circle is given by $A(r) = \pi r^2$, find the function $(A \circ r)(t)$ that describes the area as a function of time and calculate the area of the affected surface at $4$ seconds.

Solve
Practice★★☆Not started
The population of a bacterium in a culture depends on the temperature according to the function $P(T) = 50T^2 - 100T + 200$. In turn, the temperature of the incubator…

The population of a bacterium in a culture depends on the temperature according to the function $P(T) = 50T^2 - 100T + 200$. In turn, the temperature of the incubator varies with time in hours according to $T(t) = 1.5t + 10$. Calculate the exact population of bacteria there will be after $6$ hours have elapsed.

Solve
Practice★★☆Not started
The daily production cost of $x$ parts in a factory is given by the function $C(x) = 15x + 500$ dollars. The number of parts assembled by a machine in $t$ hours of…

The daily production cost of $x$ parts in a factory is given by the function $C(x) = 15x + 500$ dollars. The number of parts assembled by a machine in $t$ hours of continuous operation is $x(t) = 40t$. Express the production cost as a function of the machine's operating time and calculate the total cost after a working day of $8$ hours.

Solve

Longer chains: discounts, filters, and hidden links

Two situations come up again and again. In the first, you apply the same kind of step several times. In the second, the link between two quantities is not given directly, and you must solve for the middle variable first.

Back to the store. With $d(x) = 0.85x$ for the $15\%$ discount and $c(x) = x - 20$ for the coupon, applying the discount first gives $(c \circ d)(x) = 0.85x - 20$. For the $\$100$ jacket, Emma pays $0.85(100) - 20 = \$65$. With the coupon first, $(d \circ c)(100) = 0.85(100 - 20) = \$68$. Same reason as in the question above: the discount first is cheaper.

Now the second situation: the link between quantities is hidden.

Chain of three formulas: volume V(t) = 64 minus 8t, side s equals the cube root of V, and surface area S(s) = 6 s squared. V(t) = 64 − 8t s(V) = ∛V S(s) = 6s² Time gives volume, volume gives side, side gives surface area
Practice★★☆Not started
An electronics store applies a $15\%$ discount to all its products, which is modeled by the function $d(x) = 0.85x$. In addition, a customer has a loyalty coupon for a…

An electronics store applies a $15\%$ discount to all its products, which is modeled by the function $d(x) = 0.85x$. In addition, a customer has a loyalty coupon for a direct discount of $\$20$, modeled by the function $c(x) = x - 20$. Determine the expressions for $(c \circ d)(x)$ and $(d \circ c)(x)$. Which order of composition benefits the customer most if they want to buy a computer whose initial price is $\$600$?

Solve
Practice★★★Not started
A spherical hot-air balloon is inflated by a compressor that injects air at a constant rate, so that its volume in cubic feet is given by $V(t) = 12t$ (with $t$ in…

A spherical hot-air balloon is inflated by a compressor that injects air at a constant rate, so that its volume in cubic feet is given by $V(t) = 12t$ (with $t$ in minutes). Knowing that the volume of a sphere is $V = \frac{4}{3}\pi r^3$ and its surface area is $S = 4\pi r^2$, find the composite function $S(t)$ that gives the surface area of the balloon directly as a function of the elapsed time.

Solve
Practice★★★Not started
A beam of light passes through a series of optical filters. A type A filter reduces the luminous intensity by $20\%$, modeled by $f_A(I) = 0.8I$. A type B filter reduces…

A beam of light passes through a series of optical filters. A type A filter reduces the luminous intensity by $20\%$, modeled by $f_A(I) = 0.8I$. A type B filter reduces the intensity by a fixed amount of $15 \text{ W/m}^2$, modeled by $f_B(I) = I - 15$. If the initial intensity is $I_0$, find the expression for the final intensity after passing through $3$ type A filters followed by $2$ type B filters. Is the result equivalent to passing first through the $2$ type B filters and then the $3$ type A filters?

Solve

Domain of a composite function

A harder case: the inner function has its own restriction and the outer function restricts its output.

Practice★★☆Not started
Rigorously determine the domain of the composite function $(g \circ f)(x)$ knowing that $f(x) = x - 4$ and $g(x) = \sqrt{x}$.

Rigorously determine the domain of the composite function $(g \circ f)(x)$ knowing that $f(x) = x - 4$ and $g(x) = \sqrt{x}$.

Solve
Practice★★★Not started
Consider the functions $f(x) = \sqrt{x + 3}$ and $g(x) = \frac{1}{x^2 - 4}$. Carry out a rigorous analytical study to determine the domain of definition of the composite…

Consider the functions $f(x) = \sqrt{x + 3}$ and $g(x) = \frac{1}{x^2 - 4}$. Carry out a rigorous analytical study to determine the domain of definition of the composite function $(f \circ g)(x)$.

Solve

Decomposing a function

Sometimes you need to go the other way: take a complicated formula and see it as a composition of simple pieces. Imagine evaluating the formula at a specific number. The first operation you perform is the innermost function, the next operation is the next function out, and so on.

Decomposition of p(x) = 1 over (x + 4) squared into three functions: add 4, square, then take the reciprocal. x f₁(x) = x + 4 f₂(x) = x² f₃(x) = 1/x p(x) = f₃(f₂(f₁(x))) = 1/(x + 4)²

You can also be given the inner function and the composite, and be asked for the outer function. Then you "peel off" the inner function.

When the composite is simple, there is a shortcut: rewrite it so that the inner expression $f(x)$ appears as a block. For example, if $f(x) = x + 5$ and $(g \circ f)(x) = x^2 + 10x + 30$, then $x^2 + 10x + 30 = (x + 5)^2 + 5$, so $g(x) = x^2 + 5$.

Practice★☆☆Not started
Given the composite function $h(x) = \sqrt{2x + 5}$, express it as the composition of two simpler functions $(g \circ f)(x)$, clearly indicating which is the expression…

Given the composite function $h(x) = \sqrt{2x + 5}$, express it as the composition of two simpler functions $(g \circ f)(x)$, clearly indicating which is the expression for $f(x)$ and which is for $g(x)$.

Solve
Practice★★☆Not started
Knowing that $f(x) = 3x + 2$ and that the composite function is $(g \circ f)(x) = 9x^2 + 12x + 5$, determine the algebraic expression of the outer function $g(x)$.

Knowing that $f(x) = 3x + 2$ and that the composite function is $(g \circ f)(x) = 9x^2 + 12x + 5$, determine the algebraic expression of the outer function $g(x)$.

Solve
Practice★★★Not started
Decompose the complex function $H(x) = \frac{1}{\sqrt{3^{\sin x} + 2}}$ as the successive composition of four elementary functions $f_1, f_2, f_3, f_4$ such that…

Decompose the complex function $H(x) = \frac{1}{\sqrt{3^{\sin x} + 2}}$ as the successive composition of four elementary functions $f_1, f_2, f_3, f_4$ such that $H(x) = (f_4 \circ f_3 \circ f_2 \circ f_1)(x)$. Clearly indicate the algebraic expression of each of the four functions.

Solve

Composing piecewise functions

When the outer function is piecewise, the branch you use depends on the value of the inner function. So you translate each condition on $f(x)$ into a condition on $x$.

Reading a piecewise function from its graph also takes a systematic approach. For each piece, pick two points on the line, find its slope and intercept, and decide from the endpoints (open or closed circles) which inequality ($<$ or $\le$) belongs to which piece.

Graph of the piecewise function f of g of x: the line y = x - 1 for x less than 2, ending at an open circle at (2, 1), and the line y = 2x - 4 for x at least 2, starting at a closed circle at (2, 0). x y 2 y = x − 1 (x < 2) y = 2x − 4 (x ≥ 2)

Notice the jump at $x = 2$: the first piece approaches $1$ but the second starts at $0$. Composing continuous pieces does not always give a continuous function.

The same idea works when you compose a piecewise function with itself.

Practice★★★Not started
Given the functions $f(x)$ and $g(x)$, where $f(x) = 2x$ if $x < 1$ and $f(x) = x^2$ if $x \geq 1$, and the function $g(x) = x + 3$. Determine the complete analytical…

Given the functions $f(x)$ and $g(x)$, where $f(x) = 2x$ if $x < 1$ and $f(x) = x^2$ if $x \geq 1$, and the function $g(x) = x + 3$. Determine the complete analytical expression of the composite function $(f \circ g)(x)$, paying special attention to the intervals of definition.

Solve
Practice★★★Not started
Observe the graph of the function $f(x)$. From it, obtain the analytical expression of $f(x)$ defined piecewise and calculate the detailed algebraic expression for…

Observe the graph of the function $f(x)$. From it, obtain the analytical expression of $f(x)$ defined piecewise and calculate the detailed algebraic expression for $(f \circ f)(x)$.

f(x) 2 −2 2 X Y
Solve

Composing a function with itself

We write $f^{[n]}$ for the composition of $f$ with itself $n$ times: $f^{[2]} = f \circ f$, $f^{[3]} = f \circ f \circ f$, and so on. (This is not an exponent: $f^{[2]}(x) \neq (f(x))^2$.) Computing the first few and looking for a pattern is the standard strategy.

For $f(x) = 2x + 1$ we get $f^{[2]}(x) = 2(2x + 1) + 1 = 4x + 3$ and $f^{[3]}(x) = 2(4x + 3) + 1 = 8x + 7$. The pattern is $f^{[n]}(x) = 2^n x + (2^n - 1)$.

A function with $f(f(x)) = x$ for every $x$ in its domain is its own inverse: applying it twice undoes it. To prove this algebraically, substitute $f(x)$ into $f$ and simplify the complex fraction by multiplying the numerator and denominator by the common denominator. For example, $f(x) = \dfrac{6}{x}$ gives $f(f(x)) = \dfrac{6}{6/x} = x$ for $x \ne 0$.

Practice★★★Not started
Let the rational function be $f(x) = \frac{x}{x - 1}$. Calculate the successive compositions $(f \circ f)(x)$ and $(f \circ f \circ f)(x)$. From the results obtained,…

Let the rational function be $f(x) = \frac{x}{x - 1}$. Calculate the successive compositions $(f \circ f)(x)$ and $(f \circ f \circ f)(x)$. From the results obtained, logically deduce what the expression for $f^{[n]}(x)$ (the composition of $f$ with itself $n$ times) will be, depending on whether $n$ is an even or odd number.

Solve
Practice★★★Not started
Prove algebraically that, if $f(x) = \frac{ax + b}{cx - a}$ (with the condition $a^2 + bc \neq 0$), the function is its own inverse by checking that $(f \circ f)(x) = x$…

Prove algebraically that, if $f(x) = \frac{ax + b}{cx - a}$ (with the condition $a^2 + bc \neq 0$), the function is its own inverse by checking that $(f \circ f)(x) = x$ for all $x$ belonging to its domain.

Solve

Summary

See all the exercises in this section