Back to homeMathematics · High School Year 2 · Physics-Math · Change subject
Start for free
Prep 2 Tech · Mathematics
Functions · Real functions

Composition of Functions

Before you start, make sure you know: Basic concepts (High School Year 1 (semesters 1 and 2))
Before you start, make sure you know: Algebraic expressions (High School Year 1 (semesters 1 and 2))

During El Buen Fin (Mexico's big shopping weekend), an electronics store first applies a $15\%$ discount and then you subtract a fixed coupon of $\$20$. The final price depends on the starting price through two functions applied one after the other. This operation is called composition, and the order in which the functions are applied changes the result. How much would you pay for a $\$100$ item in each order?

Operations between functions

Before composing, remember that two functions can also be added, subtracted, multiplied, and divided. These operations are done value by value: for each $x$, you compute $f(x)$ and $g(x)$ and then operate on the two numbers.

Notice the difference: in $f+g$ you add the outputs; in $g\circ f$ the output of $f$ becomes the input of $g$. They are different operations.

What it means to compose two functions

Diagram of composition: the input x enters function f to produce f(x), and this result enters 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

You can also chain three or more functions: $(h \circ g \circ f)(x) = h(g(f(x)))$. You always work from the inside out.

When you have the graphs of $f$ and $g$, the procedure is the same: you read the value $f(x)$ from the graph of the inner function and use that value to enter the graph of the outer one.

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

Given the functions $f(x) = 3x + 2$ and $g(x) = x^2 - 1$, calculate the numerical value of the composite function $(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 repeated composite function $(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 repeated composite function $(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

Algebraic expression of the composition

With rational functions it works the same way: if $f(x)=\frac{2}{x}$ and $g(x)=x+3$, then $(f \circ g)(x)=\frac{2}{x+3}$ and $(g \circ f)(x)=\frac{2}{x}+3=\frac{2+3x}{x}$.

Two useful special cases: the identity function $I(x)=x$ satisfies $(f \circ I)(x)=(I \circ f)(x)=f(x)$, and a constant function $f(x)=c$ gives $(g \circ f)(x)=g(c)$, a fixed number.

Composition as a model

Composition appears when one quantity depends on another and that one depends on a third. Example: the radius of a ripple grows with time, $r(t)=2.5t$, and the area depends on the radius, $A(r)=\pi r^2$. Then $(A \circ r)(t)=\pi(2.5t)^2=6.25\pi t^2$: the area as a function of time. To evaluate at a specific value, you can go step by step or use the composed formula.

Finding the outer function

Sometimes you know $f$ and the composition $g \circ f$, and you are asked for $g$. You look for how the composition "looks" in terms of $f(x)$. For example, if $f(x)=x+1$ and $(g \circ f)(x)=x^2+2x+1=(x+1)^2$, then $g(u)=u^2$. When it is not obvious at a glance, solve for $x$ from $u=f(x)$ and substitute into the composition.

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

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

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
Practice★★☆Not started
When a stone is dropped into a pond, a circular ripple is formed whose radius increases over time according to the function $r(t) = 2.5t$ (with $r$ in centimeters and…

When a stone is dropped into a pond, a circular ripple is formed whose radius increases over time according to the function $r(t) = 2.5t$ (with $r$ in centimeters and $t$ in seconds). Given that the area of the circle is given by $A(r) = \pi r^2$, find the function $(A \circ r)(t)$ describing the area as a function of time and calculate the area of the affected surface after $4$ seconds.

Solve
Practice★★☆Not started
The daily production cost of $x$ parts in a factory is given by the function $C(x) = 300x + 10\,000$ pesos. 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) = 300x + 10\,000$ pesos. 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 shift of $8$ hours.

Solve

Composition is not commutative

With the store discount: $f(x)=0.85x$ and $g(x)=x-20$. For $\$100$, $(g \circ f)(100)=0.85(100)-20=\$65$, but $(f \circ g)(100)=0.85(100-20)=\$68$. Applying the percentage first is better when the fixed discount is subtracted at the end.

There are special cases where they do agree, for example when one of the functions is the identity, or when you look for a parameter that makes it happen: if $f(x)=2x+k$ and $g(x)=4x-3$, setting $(f \circ g)(x)=8x-6+k$ equal to $(g \circ f)(x)=8x+4k-3$ gives $k=-1$.

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 function composition is not commutative.

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 function composition is not commutative.

Solve
Practice★★☆Not started
An electronics store applies a discount of $15\%$ to all its products, which is modeled by the function $d(x) = 0.85x$. In addition, a customer has a loyalty voucher for…

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

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 holds in this particular case, that is,…

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

Solve

Domain of the composite function

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

Rigorously determine the domain of the composite function $(g \circ f)(x)$ given 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}$. Perform 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}$. Perform a rigorous analytical study to determine the domain of definition of the composite function $(f \circ g)(x)$.

Solve

Repeated and piecewise compositions

Composing a function with itself

If $f(x)=\frac{x}{x-1}$, then $(f \circ f)(x)=\dfrac{\frac{x}{x-1}}{\frac{x}{x-1}-1}=\dfrac{\frac{x}{x-1}}{\frac{1}{x-1}}=x$. Composing it once more, $(f \circ f \circ f)(x)=f(x)$. The pattern repeats: $f^{[n]}=f$ if $n$ is odd and $f^{[n]}=I$ if $n$ is even. A function that satisfies $(f \circ f)(x)=x$ is its own inverse.

Piecewise functions

With a piecewise function, you evaluate the inner function and see which piece the result falls in. If $f(x)=2x$ for $x<1$ and $f(x)=x^2$ for $x\ge 1$, and $g(x)=x+3$, then $f(g(x))$ uses $2(x+3)$ when $x+3<1$, that is, $x<-2$, and $(x+3)^2$ when $x\ge -2$.

Reading a piecewise function from its graph

To write the expression of a piecewise function from its graph, follow these steps:

  1. Split the graph into pieces where the curve "changes formula" (jumps or corners).

  2. In each piece, identify the type of curve (here, lines) and find its formula using two points: slope $m=\frac{y_2-y_1}{x_2-x_1}$ and $y$-intercept $b$.

  3. Write the interval of each piece. An open circle means that point does not belong to the piece (strict inequality, $<$); a filled circle means it does ($\le$ or $\ge$).

Graph of a piecewise function: an increasing line that reaches the point (1, 3) with an open circle, and a decreasing line that starts at (1, 1) with a filled circle and reaches (3, -1). (1, 3) (1, 1) (-3, -1) (3, -1)

Decomposing a function

To write a function as a composition, identify which operation is done first, then the next one, and so on. For example, $h(x)=\sqrt{2x+5}$ is $g(f(x))$ with $f(x)=2x+5$ and $g(x)=\sqrt{x}$. For $H(x)=\frac{1}{\sqrt{3^{\sin x}+2}}$, you go from the inside out: $f_1=\sin x$, $f_2=3^x$, $f_3=x+2$, and $f_4=\frac{1}{\sqrt{x}}$.

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

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

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

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

Solve
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 algebraic…

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 algebraic expression for the composite function $(f \circ g)(x)$, paying special attention to the intervals of definition.

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

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

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

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

f(x) 2 −2 2 X Y
Solve

Back to the beginning: with $f(x)=0.85x$ (the $15\%$ discount) and $g(x)=x-20$ (the coupon), $(g \circ f)(100)=\$65$ and $(f \circ g)(100)=\$68$. Order does matter.

Summary

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
Prove analytically that composing the function $f(x) = \frac{3x + 1}{x - 2}$ with the identity function $I(x) = x$ yields the original function itself. Calculate and…

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

Solve
Practice★★☆Not started
The electricity demand of a city, in megawatts, depends on the ambient temperature according to the function $D(T) = 50T^2 - 100T + 200$. In turn, the temperature varies…

The electricity demand of a city, in megawatts, depends on the ambient temperature according to the function $D(T) = 50T^2 - 100T + 200$. In turn, the temperature varies with time in hours according to $T(t) = 1.5t + 10$. Calculate the exact electricity demand after $6$ hours.

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

A spherical hot-air balloon is inflated using a compressor that injects air at a constant rate, such that its volume in cubic meters 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 time elapsed.

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 verifying that…

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 verifying that $(f \circ f)(x) = x$ for all $x$ belonging to its domain.

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

A light beam passes through a series of optical filters. A type A filter reduces light intensity by $20\%$, modelled by $f_A(I) = 0.8I$. A type B filter reduces intensity by a fixed amount of $15 \text{ W/m}^2$, modelled 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 through the $2$ type B filters first and then the $3$ type A filters?

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 state the algebraic expression for each of the four functions.

Solve
See all the exercises in this section