Composite Functions
Theory
A composite function applies one function to the output of another: \(f(g(x))\) means apply \(g\) first, then apply \(f\) to the result. This Year 11 Mathematics Advanced page shows how to evaluate a composite from the inside out, form \(f(g(x))\) and \(g(f(x))\), solve equations involving composites, find an unknown function or constant, and find the domain and range of a composite function.
A composite function is formed when the output of one function becomes the input of another. \(f(g(x))\) is read "\(f\) of \(g\) of \(x\)". The inner function \(g\) acts on \(x\) first, then the outer function \(f\) acts on \(g(x)\).
To evaluate \(f(g(a))\), work from the inside out: find the number \(g(a)\) first, then substitute that number into \(f\). To form \(f(g(x))\) as an expression, replace every \(x\) in \(f(x)\) by \(g(x)\), in brackets, then expand and simplify.
Order matters. In general \(f(g(x))\neq g(f(x))\). With \(f(x)=x+1\) and \(g(x)=x^{2}\), \(f(g(3))=f(9)=10\) but \(g(f(3))=g(4)=16\).
The domain of \(f(g(x))\) is every \(x\) in the domain of \(g\) for which \(g(x)\) lies in the domain of \(f\). For example, with \(f(x)=\dfrac{1}{x-5}\) and \(g(x)=2x+1\), \(f(g(x))=\dfrac{1}{(2x+1)-5}=\dfrac{1}{2x-4}\), which is undefined when \(x=2\). The range of \(f(g(x))\) is the set of values it takes as \(x\) runs through that domain.
Composite function: apply \(g\) first, then \(f\).
To form it, replace \(x\) in \(f(x)\) by \(g(x)\). For example, if \(f(x)=x^{2}-5\):
Domain of a composite:
How to evaluate \(f(g(a))\)
- Find the inner value \(g(a)\) first.
- Substitute that number into \(f\): \(f(g(a))=f(\text{that number})\).
- State the answer with \(\therefore\).
How to form and use \(f(g(x))\)
- Replace every \(x\) in \(f(x)\) by \(g(x)\), in brackets.
- Expand and simplify.
- Use it: solve an equation, compare coefficients for "all values of \(x\)", or find where the composite is undefined.
How to find the domain and range of \(f(g(x))\)
- Form the composite and simplify.
- Domain: start with the domain of \(g\), then remove any \(x\) that makes the composite undefined (a zero denominator, a negative under a square root).
- Range: find the values the inner expression takes over that domain, then see what the outer function does to them. Note which values are reached (endpoints) and which are only approached (asymptotes).
Work from the inside out:
| \(g(-2)\) | \(=\) | \(3(-2)+1=-5\) |
| \(f(g(-2))\) | \(=\) | \(f(-5)\) |
| \(\) | \(=\) | \((-5)^{2}-5\) |
| \(\) | \(=\) | \(20\) |
| \(f(-2)\) | \(=\) | \((-2)^{2}-5=-1\) |
| \(g(f(-2))\) | \(=\) | \(g(-1)\) |
| \(\) | \(=\) | \(3(-1)+1\) |
| \(\) | \(=\) | \(-2\) |
\(\therefore\ f(g(-2))=\mathbf{20}\) and \(g(f(-2))=\mathbf{-2}\). Changing the order changes the answer.
Replace \(x\) in \(f\) by \(g(x)=2x+1\):
| \(f(g(x))\) | \(=\) | \((2x+1)^{2}-3(2x+1)\) |
| \(\) | \(=\) | \(4x^{2}+4x+1-6x-3\) |
| \(\) | \(=\) | \(\boldsymbol{4x^{2}-2x-2}\) |
Replace \(x\) in \(g\) by \(f(x)=x^{2}-3x\):
| \(g(f(x))\) | \(=\) | \(2f(x)+1\) |
| \(\) | \(=\) | \(2(x^{2}-3x)+1\) |
| \(\) | \(=\) | \(\boldsymbol{2x^{2}-6x+1}\) |
The two composites are different functions.
Form both composites:
| \(f(g(x))\) | \(=\) | \((x+2)^{2}+1\) |
| \(\) | \(=\) | \(x^{2}+4x+4+1\) |
| \(\) | \(=\) | \(x^{2}+4x+5\) |
| \(g(f(x))\) | \(=\) | \(x^{2}+1+2\) |
| \(\) | \(=\) | \(x^{2}+3\) |
Set them equal and solve:
| \(x^{2}+4x+5\) | \(=\) | \(x^{2}+3\) |
| \(4x\) | \(=\) | \(-2\) |
| \(\therefore\ x\) | \(=\) | \(\boldsymbol{-\dfrac{1}{2}}\) |
Check: \(f\left(g\left(-\dfrac{1}{2}\right)\right)=\left(\dfrac{3}{2}\right)^{2}+1=\dfrac{13}{4}\) and \(g\left(f\left(-\dfrac{1}{2}\right)\right)=\dfrac{5}{4}+2=\dfrac{13}{4}\).
Form the composite, keeping the domain of \(g\):
| \(f(g(x))\) | \(=\) | \(\dfrac{1}{\left(\sqrt{x-2}\right)^{2}-4}\) |
| \(\) | \(=\) | \(\dfrac{1}{x-2-4}\) |
| \(\) | \(=\) | \(\dfrac{1}{x-6}\) |
\(g(x)=\sqrt{x-2}\) needs \(x\ge2\); \(\dfrac{1}{x-6}\) needs \(x\neq6\).
Domain: \(\boldsymbol{x\ge2,\ x\neq6}\).
For \(2\le x<6\): \(-4\le x-6<0\), so \(\dfrac{1}{x-6}\le-\dfrac{1}{4}\) (equal to \(-\dfrac{1}{4}\) at \(x=2\)).
For \(x>6\): \(x-6>0\), so \(\dfrac{1}{x-6}>0\).
\(\therefore\) range: \(\boldsymbol{f(g(x))\le-\dfrac{1}{4}}\) or \(\boldsymbol{f(g(x))>0}\).
The graph is in the Diagrams tab.
Common pitfalls
Frequently asked questions
What is a composite function?
A function applied to the output of another function. \(f(g(x))\) means apply \(g\) to \(x\) first, then apply \(f\) to the result \(g(x)\).
How do you find f(g(x))?
Replace every \(x\) in \(f(x)\) by \(g(x)\), in brackets, then expand and simplify. For a number, work from the inside out: find \(g(a)\) first, then substitute it into \(f\).
Is f(g(x)) the same as g(f(x))?
Not in general. With \(f(x)=x+1\) and \(g(x)=x^{2}\), \(f(g(3))=10\) but \(g(f(3))=16\). Always apply the inner function first.
How do you find the domain of a composite function?
Start with the domain of the inner function \(g\), then remove any \(x\) for which \(g(x)\) is not in the domain of \(f\), such as values that make a denominator zero. Simplifying the formula does not remove the restrictions from \(g\).
How do you find the range of a composite function?
Work out which values the inner expression takes over the domain, then see what the outer function does to those values. Check endpoints (value reached) and asymptotes (value never reached).
How do you find g(x) if you know f(x) and f(g(x))?
Write \(f(g(x))\) by replacing \(x\) in \(f\) by \(g(x)\), set it equal to the given expression, then solve for \(g(x)\). For \(f(x)=3x-1\) and \(f(g(x))=6x+8\): \(3g(x)-1=6x+8\), so \(g(x)=2x+3\).