# Where is the “relation” here?

Looking at the definition of a monoid it says that:

A monoid is a set that is closed under an associative binary operation and has an identity element $I \in S$ such that for all $a \in S$, $I a = a I =a$

But what does $I a$ mean here? I mean it's just one element from the set, followed by a space and another element of the set. Is it assumed that this means binary function of some sort?

I mean when I write $0+x$, I don't write $0\ x$...

Thanks, any help in understanding this is appreciated.

-
MathWorld at it again, there should not be a space. And they really should have given the operation a name, such as $\ast$. It can be omitted later. – André Nicolas Dec 19 '11 at 15:16

I'd say what is confusing about the definition above is that it doesn't make clear that the binary operation is part of the monoid - it only asserts the existence of the operation on the set. For example, the above definition would make $\mathbb N$ a monoid because there exists an associative binary operation blah blah blah. But there are many such associative binary operations on $\mathbb N$.

It should really say, "A monoid is a pair $(M,\star)$ where $M$ is a set and $\star$ is an associative binary operation $\star:M\times M\rightarrow M$, such that there exists an $i\in M$ statisfying $i\star m = m\star i = m$ for all $m\in M$.

In particular, when the definition above says: $Ia=aI=a$, that is shorthand for the operation $I\star a = a\star I = a$.

Oh, and the only reason we tend to write monoids in a "multiplicative form," rather than more like addition, is that addition, in almost all instances, is commutative: $a+b=b+a$. But multiplication in many instances is not - for instance, matrix multiplication is not commutative. So we usually think of the monoid operation as being "like" multiplication.

-

It doesn't matter whether you use additive notation "$+$" or multiplicative notation "$\cdot$" to denote the group (or in this case: monoid) operation. The notation $Ia$ really is the lazy version of of writing $I \cdot a$.

But you could equally well write $I + a$. See for example here for notational conventions for abelian groups.

-
And the $\cdot$ is a function composition? – drozzy Dec 19 '11 at 15:24
Hm... what is abelian groups? And why would I write a $+$? That would make no sense for like multiplication function. I only used plus as an example for some integers... (Sorry I'm a programmer not mathematician). – drozzy Dec 19 '11 at 15:26
Hm.. yeah wikipedia definition is much better: en.wikipedia.org/wiki/Monoid#Definition – drozzy Dec 19 '11 at 15:28
Hi @drozzy: No, the $\cdot$ is not a function decomposition, it denotes the group operation. An example of a group where the group operation is denoted in a multiplicative way would be the reals together with multiplication: $G = (\mathbb{R}, \cdot)$. – Rudy the Reindeer Dec 19 '11 at 16:05
An example of a group where you'd denote the operation using additive notation $+$ would be $G = (\mathbb{Z}, +)$. A group is like a monoid with one additional requirement: the requirement that every element must have an inverse i.e. for every $g \in G$ you can find a $-g$ (note that I'm using additive notation here) such that $g + (-g) = e = (-g) + g$. – Rudy the Reindeer Dec 19 '11 at 16:07

Perhaps it's helpful to look at some usual examples.

• The set of natural numbers including $0$, together with addition, forms a monoid: the binary operation is $\lambda (a,b).a\!+\!b$ and the identity element is $0$, for $$a+0 = 0+a = a.$$ In Haskell, this translates to the Sum instance of Monoid with mempty = Sum 0 and mappend a b = Sum (getSum a + getSum b).
• The same set, with multiplication as the relation and $1$ as the identity. Here, it is common in mathematics to just omit the multiplication sign, $$a\cdot 1 = 1\cdot a = 1a = a.$$ In Haskell, mempty = Product 1 and mappend a b = Product (getProduct a * getProduct b).
• The set of matrices on e.g. $\mathbb{R}^2$ together with matrix multiplication. Here, the identity is $(\begin{smallmatrix}1&0\\0&1\end{smallmatrix})$, $$(\begin{smallmatrix}1&0\\0&1\end{smallmatrix})\cdot (\begin{smallmatrix}a&b\\c&d\end{smallmatrix}) = (\begin{smallmatrix}a&b\\c&d\end{smallmatrix})\cdot(\begin{smallmatrix}1&0\\0&1\end{smallmatrix}) = (\begin{smallmatrix}a&b\\c&d\end{smallmatrix})$$
• The set of lists of letters together with list concatenation. The identity is the empty list. That one's rather a bit un-mathematic, I shall again omit excplicitly writing the binary operator or the "promotion" of characters to single-element lists and write it this way: $${{}''}\mathrm{Word} = \mathrm{Word}'' = \mathrm{Word}$$ (and also $= \mathrm{W{{}''}ord} = \mathrm{Wor{{}''}d} = \mathrm{{{}''}Wo{{}''}r{{}''}{{}''}{{}''}{{}''}d}$.) In Haskell, it's the more general [] instance of Monoid, with mempty=[] (that is, for strings, mempty="") and mappend a b = a++b.
-
"Sum instance of Monoid" interesting. Do you have a link to docs by any chance? I tried looking but couldn't find a mention of monoid in Sum docs. – drozzy Dec 19 '11 at 19:00
You couldn't? Funny that, instance Num a => Monoid (Sum a) (from the Data.Monoid page). For more on monads in Haskell, it's good to consider the LYAH chapter on them. – leftaroundabout Dec 20 '11 at 1:15
Oh I thought a "type" that was a monoid would have to define the operator and the identity element. That's why I didn't identify it in the docs. P.S.: yeah, I'm already reading the LYAH book presently :-) – drozzy Dec 20 '11 at 1:44