= Function composition
{title2=$\circ$}
{wiki}
For <functions> $f:X\to Y$ and $g:Y\to Z$, their <function composition> is $g\circ f:X\to Z$, defined by $(g\circ f)(x)=g(f(x))$. The rightmost <function> is applied first. Matching the intermediate <codomain> and <domain of a function> makes the expression well-defined.
For <self-maps> of the <real numbers>, take $f(x)=x+1$ and $g(x)=2x$. Then $(g\circ f)(x)=2x+2$, whereas $(f\circ g)(x)=2x+1$. Thus <function composition> need not be <commutative>. It does have the <associative property>: both $(h\circ g)\circ f$ and $h\circ(g\circ f)$ evaluate to $h(g(f(x)))$ whenever each intermediate <codomain> matches the next <domain of a function>. The <identity function> leaves composition unchanged, making <self-maps> particularly useful as a <monoid> of transformations.
Back to article page