[Math] How does a set of functions form a monoid

abstract-algebra

While I now understand what monoids are I am still not sure how a set of functions, under composition defines a monoid.

The main difficulty I am having is understanding how you can define composition. I mean for integers under $+$ it's easy. Define our binary operator to be plus, so:

$x \cdot y = x + y$

and we know what $x+y$ means…

But for functions:

$f \cdot g = f(g)$ <—????

Clearly we can't write $f(g)$ because it then makes no sense to write: $f(g)(x)$

I'm probably completely wrong about something…

References:

  1. http://reperiendi.wordpress.com/2007/09/12/monoids/

Best Answer

Given two functions $f, g : X \rightarrow X$, their composition $f \circ g$ is a new function $X \rightarrow X$. When $f \circ g$ is given an argument $x \in X$, it first applies $g$ to produce an element $g(x)$, and then applies $f$ to that. The result is $f(g(x))$, and this element is defined to be the value of $f \circ g$ in $x$.

Summing up, we get what Srivatsan wrote in a comment:

$$ (f \circ g)(x) = f(g(x)). $$

Since we defined an operation that takes two functions $f$ and $g$ and produces a new function $f \circ g$, it makes sense to check if the operation makes the set $X^X$ of functions $X \rightarrow X$ into a monoid.

To do so, we need to prove that composition is associative, i.e.:

$$ (f \circ g) \circ h = f \circ (g \circ h) $$

for any choice of $f, g, h$, and also that there exists a special function $i : X \rightarrow X$, such that, for all $f$:

$$ f \circ i = i \circ f = f. $$

All of this is extremely easy to verify, just keep in mind that to check if two functions are equal is it sufficient to check that they have the same value on every possible argument.

Related Question