A composition feeds the output of one function into another. In f(g(x)), evaluate g first, then use that entire result as the input of f.
Free composition of functions practice: PDF set 1, topic quiz. The original short practice below includes explained solutions.
Rules and restrictions
Write \((f\circ g)(x)=f(g(x))\). Replace every input variable in the outer rule with the whole inner rule, using parentheses. The input must belong to the inner function's domain, and its output must belong to the outer function's domain. The two composition orders usually differ.
Worked examples
Example 1
For \(f(x)=x^2+1\) and \(g(x)=2x-3\), find both orders.
Substitute g into f: \(f(g(x))=(2x-3)^2+1=4x^2-12x+10\). In the reverse order, \(g(f(x))=2(x^2+1)-3=2x^2-1\). Both domains are all real numbers, but the rules are different.
Example 2
For \(f(x)=\sqrt{x}\) and \(g(x)=x-5\), find \(f(g(x))\) and \(g(f(x))\), including domains.
The first is \(\sqrt{x-5}\); require \(x-5\ge0\), so \(x\ge5\). The reverse is \(\sqrt{x}-5\); its inner root requires \(x\ge0\). Changing the order changes both the expression and domain.
Try these before opening the solutions
- For \(f(x)=3x+2\), \(g(x)=x^2\), find \(f(g(-2))\).
- For those rules, find \(g(f(x))\).
- For \(f(x)=1/x\), \(g(x)=x^2-9\), find \(f(g(x))\) and its domain.
- For \(f(x)=\sqrt{x}\), \(g(x)=1/x\), find \(g(f(x))\) and its real domain.
Show step-by-step solutions
- Evaluate the inside: \(g(-2)=(-2)^2=4\). Then \(f(4)=3(4)+2=14\).
- Use all of \(3x+2\) as g's input: \(g(f(x))=(3x+2)^2=9x^2+12x+4\). The domain is all real numbers.
- Substitution gives \(1/(x^2-9)\). The inner polynomial accepts every real number, but f cannot accept zero. Solve \(x^2-9=0\) to exclude \(x=-3,3\).
- The composition is \(1/\sqrt{x}\). The root requires \(x\ge0\), and its value must not be zero because it is the input to g. Together these conditions give \(x>0\).
Common mistakes
Do not replace composition with multiplication. A simplified expression still has to satisfy the original inside-to-outside domain conditions.
Related skills
Composition of Functions worksheets; Function Notation lesson; Multiplying and Dividing Functions lesson; Adding and Subtracting Functions lesson.

