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 🙂

Advertisements

About Badgerati
Computer Scientist, Games Developer, and DevOps Engineer. Fantasy and Sci-fi book lover, also founder of Cadaeic Studios.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: