Composition of Functions
Problem
If f(x)=x²+1 and g(x)=3x−2, find f(g(x)) and g(f(x)).
Explanation
What is function composition?
Composition means plugging one function into another. The notation (read "f of g of x") means: first apply to , then apply to the result. It's like a pipeline — input goes through first, then the output of goes through .
Important: and are generally NOT the same. Order matters!
Step-by-step solution
Given and .
Finding
Step 1 — Start with the outer function . .
Step 2 — Replace "something" with :
Step 3 — Expand:
Finding
Step 1 — Start with the outer function . .
Step 2 — Replace "something" with :
Step 3 — Simplify:
Comparison
They are different! For example, at : , but .
Numerical verification
Tracing through both compositions:
- : First . Then . ✓ Matches .
- : First . Then . ✓ Matches .
Common mistakes
- Confusing the order. In , apply FIRST, then . The inner function goes first.
- Not fully expanding. , not or .
Try it in the visualization
Both compositions are graphed. Trace a specific -value through the pipeline: see it enter , then the output enters . The two resulting curves are visibly different, proving composition isn't commutative.
They're different! Composition is not commutative.
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.