# Maths – Functions (Part 2)

## Composition of Functions

Say we have 2 functions:

• fR ——> S1
• gS2 —–> T

These functions are only composable, or have an inter-relationship when

• S1S2

When these conditions are met, we can safely define the composite of the functions as:

• hg о f

This states that h is equal to f followed by g. This definition can also be written as:

• h(x) = g(f(x))

Therefore, we can see that g о f has source, or domain, R (which is the source of f), and has target, or co-domain, T. (which is the target of g). Therefore, we can now write:

• g о f :  R ——-> T

As you can see, the intermediate domain S is not detectable from the composite of this function.

OK, now consider the following 3 functions:

• fS ——-> L
• gL ——> R
• hR ——> T

These can be composed is various ways. So we can form:

• g о f: S ——-> R
• h о g: L ——-> T

These may then be further composed, to achieve:

• h о (g о f)S ——-> T
• (h о g) о fS ——-> T

This shows us that composition of functions is associative, meaning we can remove the brackets and write:

• h о g о f

Just to note, it is also possible to sometimes omit the ‘о’ and just right:

• hgf

The same can be done for the above functions as well. And thats it, end of Functions 🙂