Back to homeMathematics · Algebra 2 · Change subject
Start for free
Algebra 2 · 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)

A jacket costs $\$100$. The store offers 15% off, and you also have a $\$20$ coupon. Does it matter whether the cashier takes off the 15% first or subtracts the coupon first? Two functions are applied one after the other, and the order may change the final price. This chain of functions is called composition, and we will answer the jacket question at the end of the page.

What it means to compose two functions

Think of two machines connected in a row. The output of the first machine is the input of the second.

Two function machines in a row: the input x goes into f to produce f(x), and that result goes into g to produce g(f(x)). x f f(x) g g(f(x)) (g ∘ f)(x) = g(f(x)): first f, then g

To evaluate a composite at a number, work from the inside out.

Longer chains work the same way. For $(h \circ g \circ f)(x)$, apply $f$ first, then $g$, then $h$.

You can also evaluate a composite from a graph or a table, with no formulas at all. To find $(f \circ g)(2)$, read $g(2)$ from the graph of $g$. That output becomes the input you look up on the graph of $f$.

Graphs of two lines g and f. Reading g at x = 2 gives 3, and reading f at x = 3 gives 1, so f of g of 2 equals 1. g f g(2)=3 f(3)=1 12345 12345 (f ∘ g)(2) = f(3) = 1
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

Writing the composite function as an expression

With rational functions, finish by combining into a single fraction.

A constant function is a special case. If $f(x) = 4$, then $(f \circ g)(x) = f(g(x)) = 4$ for every $x$, because $f$ ignores its input. But $(g \circ f)(x) = g(4)$ is just one fixed number.

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

Order matters (and the identity function)

The two graphs are different curves, so the two orders really are different functions.

Sometimes the order does not matter. The identity function $I(x) = x$ does nothing to its input, so composing with it changes nothing.

Order can also be forced to not matter by choosing a parameter. Let's find $k$ so that two functions commute.

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
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
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

Composition in real situations

Many real quantities are chained: time determines a radius, the radius determines an area. If you know both rules, composing them gives the area directly in terms of time.

A chain of two functions: hours h go into E to give earnings, and earnings go into S to give savings. hours h E earnings E S savings S S(E(h)): hours → earnings → savings
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$ dollars, 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$ dollars?

Solve
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 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 workday of $8$ hours.

Solve

Multi-step models

Sometimes the quantity you have isn't the one the next formula needs. Then you may have to rewrite a formula before you can compose.

A four-step chain: time t gives volume V, volume gives side s, and side gives surface area S. timet (min) volumeV = 8t sides = ∛V surface areaS = 6s² S(s(V(t))): three functions, one chain

If you only need a number (say, a population after 6 hours), you don't have to build the whole formula. Evaluate step by step: first find the intermediate value (a temperature at $t = 6$), then feed it to the next function.

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
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

Repeated composition

Composing a function with itself is written $f \circ f$. Applying it $n$ times is sometimes written $f^{[n]}$. Don't confuse this with $f^n$ (a power) or $f^{-1}$ (the inverse).

Repeated steps are common in real problems, and the order of different steps matters.

Sometimes repeating a function leads to a pattern, and you can predict $f^{[n]}$ for any $n$. Let's look at a pattern that repeats every 2 steps.

Now a pattern that repeats every 3 steps.

A function with $(f \circ f)(x) = x$ undoes itself, so $f$ is its own inverse. To prove it, simplify the complex fraction by multiplying numerator and denominator by the common denominator.

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
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

The line is $f(x) = x + 2$ and the curve is $(g \circ f)(x) = \sqrt{x + 2}$ with $g(x) = \sqrt{x}$. The curve starts exactly where $f(x) \ge 0$, at $x = -2$.

Things get more interesting when the inner function has its own restriction.

When the inner function has a quadratic denominator, factor it to find the excluded values, then combine and use a sign chart as above.

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 go backward: given a complicated function $h$, find simpler functions whose composition is $h$.

Exponential and trig functions are peeled off the same way. In $5^{\cos x}$, the expression $\cos x$ is the exponent, so it must be computed before the power. Remember that $\cos x$ means "the function cos applied to $x$", not "cos times $x$". An exponential with base $5$ (or $3$, or any $b > 0$) is just another function, $u \mapsto 5^u$.

You can also be given the inner function and the composite, and be asked for the outer function.

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

To compose with a piecewise function, the value of the inner function decides which piece of the outer function to use. Split the domain at the places where that value crosses a boundary.

For $f \circ f$ you have to be more careful, since both the inner and outer functions are piecewise. Handle each inner piece separately, find its range of outputs, then decide which outer piece those outputs fall into.

Graph of a piecewise linear function: the line y = x + 2 rises up to the point (1, 3), then the line y = 4 - x falls. (1, 3) y = x + 2 (x < 1) y = 4 − x (x ≥ 1)

To read a piecewise formula from a graph, find the slope and the $y$-intercept of each segment, and note where each segment starts and ends.

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

Back to the opening question: Let $d(x) = 0.85x$ (take 15% off) and $c(x) = x - 20$ (use the coupon). Discount first, then coupon: $(c \circ d)(100) = 0.85(100) - 20 = \$65$. Coupon first, then discount: $(d \circ c)(100) = 0.85(100 - 20) = \$68$. Order matters. Here the discount-first order saves you more, because the coupon is then subtracted at full value instead of being shrunk by the 15%.

Summary

See all the exercises in this section