# Math Insight

### Image: Function machines composed and combined into a new function machine

The composition of two functions is represented by a large function machine that is composed of a pair of function machines where the output of the first is dumped into the second. The first inner function machine represents a function $g$ and the second represents a function $f$. The large combined function machine is the composition $f \circ g$ whose input is the sphere and output is the faceted ball.

If the sphere represents an input value $x$, then the cube coming out of $g$ represents the output $g(x)$ obtained after applying $g$ to $x$. The cube $g(x)$ is then the input to the second function machine $f$. In response to the cube input, $f$ spits out the faceted ball, which represents $f(g(x))$. The successive application of $g$ and then $f$ to the input $x$ is equivalent to the application of the composition $f \circ g$ to $x$, which we can write as $(f \circ g)(x) = f(g(x))$.

Image file: function_machines_composed_combined.png