Composite functions in this visualization
A composite function chains two functions: the output of the first becomes the input of the second. Applying and then gives the function , read “ after ”. Here and are each one of five functions; three number lines carry an input to and on to , and a graph shows , so you can see where the chain breaks and compare the two orders.
Evaluate from the inside out: in , is worked out first, so means first even though is written first. The small circle is not multiplication. On the picture the middle line holds the value that goes into .
Where g ∘ f is defined
Working out needs two things: must be in the domain of , and must be in the domain of . So the domain of can be smaller than the domain of . With and , the middle value must not be negative, so is defined only for , though accepts every . The shaded part of the middle line is the domain of , and the chain stops at the step that fails.
Why the order matters
Swapping and usually gives a different function. and agree only at , because they differ by . Two functions are equal only when they have the same domain and the same value at every point of it, and the graph of laid over the graph of shows both conditions at once. Of the pairs of different functions on this page, only doubling and negating give the same composite in either order: .
Squaring and the square root show why the domain counts. Squaring first loses the sign, and the square root gives the non-negative number, so for every real . Taking the root first needs , and then . The two composites agree wherever both are defined, but is also defined for negative , so they are different functions.
Undoing a step
Negating twice returns every input to where it started: for all , so is the identity function, and negation is its own inverse. One order returning every input is not yet enough for two functions to undo each other. Taking the square root and then squaring returns every , but in the other order a negative input comes back as its absolute value. Two functions and are inverses of each other when for every in the domain of and for every in the domain of .
Controls
- Both handles for x, on the first number line and on the graph’s x-axis, move with the arrow keys, 0.1 at a time (0.01 with Shift).