For functions *f: A -> B* and *g: B -> C*, the functional composition of function f and function *g* is the function *(g o f): A -> C*, defined by *(g o f)(x) = g(f(x))*. For example, if *f : {1,2,3} -> {A,B,C,D}* and *g : {A,B,C,D} -> {4,5}*, the composition of *g(y)=y2* and *f(x)=x+1* is *(g o f)(x)=(x+1)2*.

Function composition is applying a function to the results of another function. So, in *(g o f)(x) = g(f(x))*, first apply *f()*, and then *g()*. Some functions can be decomposed into two (or more) simpler functions.