Composite functions
A jacket in a Cork shop costs €80. There is 25% off, and you also have a €10 voucher. Does it matter whether the 25% comes off first or the voucher is taken off first? Two different orders can give two different prices. Composite functions are the tool for comparing them, and we will settle this question in the first section.
Doing one function after another
A function is like a machine: put in $x$, get out $f(x)$. A composite function connects two machines. The output of the first becomes the input of the second.
We write this as
$$(f\circ g)(x) = f(g(x)).$$Read $f\circ g$ as "$f$ after $g$" or "$f$ of $g$". The function nearest to $x$ acts first.
To evaluate a composite at a number, work from the inside out.
Notice $19 \neq 49$. In general $f\circ g \neq g\circ f$: the order matters.
Back to the jacket. Let $d(x) = 0.75x$ (25% off) and $v(x) = x - 10$ (voucher). Discount first, then voucher: $v(d(80)) = v(60) = 50$. Voucher first, then discount: $d(v(80)) = d(70) = 52.5$. So the first order gives €50 and the second gives €52.50. Taking the percentage off first is better, because the voucher then comes off the smaller price at full value.
Let $f(x) = 3x + 2$ and $g(x) = x^2 - 1$. a) Find $f(g(2))$. b) Find $g(f(2))$.
Let $f(x) = 3x + 2$ and $g(x) = x^2 - 1$.
- a) Find $f(g(2))$.
- b) Find $g(f(2))$.
Finding the expression for a composite
Often you want a single formula for $f(g(x))$. Do this: replace every $x$ in $f$ by the whole expression $g(x)$, using brackets, and then simplify.
When the outer function has a square, the brackets matter: if $f(x) = x^2$ and $g(x) = x + 3$, then $f(g(x)) = (x+3)^2 = x^2 + 6x + 9$ and $g(f(x)) = x^2 + 3$. These are different expressions. Remember $(x+3)^2 \neq x^2 + 9$.
If a function has a fraction, you will need a common denominator.
Let $f(x) = 2x - 5$ and $g(x) = x + 4$. Find expressions for $(f\circ g)(x)$ and $(g\circ f)(x)$, giving each in the form $ax + b$.
Let $f(x) = 2x - 5$ and $g(x) = x + 4$. Find expressions for $(f\circ g)(x)$ and $(g\circ f)(x)$, giving each in the form $ax + b$.
Let $f(x) = x^2$ and $g(x) = x + 3$. Find $f(g(x))$ and $g(f(x))$, and write each in expanded form.
Let $f(x) = x^2$ and $g(x) = x + 3$. Find $f(g(x))$ and $g(f(x))$, and write each in expanded form.
A shop in Galway offers a discount of 20% on all items, and a customer also has a voucher worth €10 that is subtracted from the bill. Let $d(x) = 0.8x$ and…
A shop in Galway offers a discount of 20% on all items, and a customer also has a voucher worth €10 that is subtracted from the bill. Let $d(x) = 0.8x$ and $v(x) = x - 10$, where $x$ is the original price in euro.
- a) Write down $v(d(x))$ and $d(v(x))$.
- b) For an item originally priced at €60, find the final price under each order of applying the offers.
- c) Which order is better for the customer? Justify your answer.
Domain and range of a composite
The domain of $f(g(x))$ is the set of $x$ for which the whole calculation makes sense. Two things must be true:
-
$x$ is allowed in $g$, and
-
the value $g(x)$ is allowed in $f$.
Check both, and do it on the unsimplified composite as well as the simplified one.
For a range, find the output values. Complete the square when the function is quadratic.
Let $f(x) = \dfrac{1}{x-2}$ and $g(x) = x^2 + 1$. a) Find $f(g(x))$ and state its domain. b) Find $g(f(x))$ and state the values of $x$ for which it is defined. c) Solve…
Let $f(x) = \dfrac{1}{x-2}$ and $g(x) = x^2 + 1$.
- a) Find $f(g(x))$ and state its domain.
- b) Find $g(f(x))$ and state the values of $x$ for which it is defined.
- c) Solve $f(g(x)) = \dfrac{1}{2}$.
Let $f(x) = x^2 - 4x + 7$ for $x \in \mathbb{R}$ and $g(x) = \sqrt{x}$ for $x \geq 0$. a) Find the range of $f$. b) Show that $g(f(x))$ is defined for all real $x$ and…
Let $f(x) = x^2 - 4x + 7$ for $x \in \mathbb{R}$ and $g(x) = \sqrt{x}$ for $x \geq 0$.
- a) Find the range of $f$.
- b) Show that $g(f(x))$ is defined for all real $x$ and find its minimum value.
- c) Find the range of $f(g(x))$ for $x \geq 0$.
Equations and parameters with composites
Once you have a composite as a single expression, you can solve equations with it in the usual way.
Finding an unknown constant
If a function contains a constant $k$, turn the given condition into an equation in $k$.
Composing a linear function with itself
Let $f(x) = ax + b$. Then
$$f(f(x)) = a(ax+b) + b = a^2x + ab + b = a^2 x + b(a+1).$$To match a given result, compare coefficients of $x$ and the constant terms.
Some functions undo themselves. For $f(x) = \dfrac{3}{x}$, $f(f(x)) = \dfrac{3}{3/x} = x$. If $f(f(x)) = x$ for all $x$ in the domain, then applying $f$ twice returns you to the start, so $f$ is its own inverse: $f^{-1}(x) = f(x)$.
The inverse function $f^{-1}$ undoes $f$, so that $f^{-1}(f(x)) = x$. To find it, write $y = f(x)$, swap $x$ and $y$, then solve for $y$.
Try the slider widget below. It plots $f(x) = ax + b$ and $f(f(x))$. Which values of $a$ and $b$ make the two lines coincide with $y = x$?
Let $f(x) = 2x + k$ and $g(x) = x^2 + 2$, where $k$ is a constant. Given that $f(g(1)) = g(f(1))$, find the possible values of $k$.
Let $f(x) = 2x + k$ and $g(x) = x^2 + 2$, where $k$ is a constant. Given that $f(g(1)) = g(f(1))$, find the possible values of $k$.
Let $f(x) = ax + b$ where $a, b$ are real constants with $a \neq 0$. a) Show that $f(f(x)) = x$ for all $x$ if and only if either $a = 1$ and $b = 0$, or $a = -1$. b)…
Let $f(x) = ax + b$ where $a, b$ are real constants with $a \neq 0$.
- a) Show that $f(f(x)) = x$ for all $x$ if and only if either $a = 1$ and $b = 0$, or $a = -1$.
- b) Hence find $f$ if $f(f(x)) = x$ and $f(3) = 7$.
- c) Find all linear functions $f$ for which $f(f(x)) = 9x + 8$.
Let $f(x) = \dfrac{x+1}{x-1}$, for $x \neq 1$. a) Show that $f(f(x)) = x$ for all $x \neq 1$. b) Hence write down $f^{-1}(x)$. c) Let $g(x) = 2x - 3$. Solve…
Let $f(x) = \dfrac{x+1}{x-1}$, for $x \neq 1$.
- a) Show that $f(f(x)) = x$ for all $x \neq 1$.
- b) Hence write down $f^{-1}(x)$.
- c) Let $g(x) = 2x - 3$. Solve $(f\circ g)(x) = 3$ and determine $(g\circ f)(x)$ in the form $\dfrac{ax+b}{x-1}$.