Does associativity imply commutativity?

Well done - you've essentially rediscovered free objects. In particular, what you've observed is that in the semigroup freely generated by one element (call it $1$), addition happens to be commutative.

In other words: you've essentially explained why addition in $\mathbb{Z}_{\geq 1}$ is commutative.

But, I wouldn't say that associativity implies commutativity in general. For instance, multiplication of $2 \times 2$ matrices provides a fundamental example of an associative operation that isn't commutative. Furthermore, the non-equivalence of associativity and commutativity is clear even if we stick to free algebras:

  • in the semigroup freely generated by two elements (call them $A$ and $B$), commutativity fails in a big way. For example, $A + B \neq B+A$ in this context.

  • in the commutative magma freely generated by one element (call it $1$), associativity fails in a big way. For example $(1+1)+(1+1) \neq ((1+1)+1)+1$ in this context.

Free algebras are pretty tricky, so don't feel discouraged if you don't 'get' them right away - nobody ever does. It can take a year or two before the idea truly 'sinks in,' and almost discovering them yourself will only help a little in this regard.

You may find this question helpful to get you started.


Clever observation. This is called a cyclic group (or the generalized version, free object). $ G $ is said to be cyclic, if there is some set $ s $, called the "generating element", such that

$$ G = \langle s \rangle = \{ n \in \mathbb{Z} : s^n \} = \{e, s, s^2, s^3, \ldots s^{-1}, s^{-2}, s^{-3}, \ldots \} $$

That is, all elements can be "generated" from a single element.

In this case $ s = 1 $, but let's forget that for a moment, and consider the general case:

  1. Are cyclic objects always abelian?

  2. Are all groups cyclic?

To 1., the answer is relatively simple: Yes. To verify this, we simply observe that $$ s^n s^m = \underbrace{sss\ldots s}_{n + m} = s^{n + m} = s^{m + n} = s^m s^n $$

Thus $ ab = ba $ in $ G $.

Now, for 2., the easiest way to prove that not all algebraic objects are cyclic, is to construct an object that isn't cyclic nor abelian. The simplest example is the group, $ G $, of bijective functions, $ \mathbb{R} \to \mathbb{R} $, under composition.

You can easily see that it is associative, at the same time it is relatively easy to verify that this is in fact not abelian (I will let you do that). Therefore it cannot be cyclic.

Another (more funky) way we can see that it is not cyclic is by Cantor's diagonal argument: Define $ \mathbb{R} $ as $ \{ f \in G : f(0) \} $. If $ G $ was cyclic, we would be able to enumerate the real numbers, by $ \mathbb{R} = \{ n \in \mathbb{Z} : s^n(0) \} $, which is not possible, as shown by the diagonal argument.

A bonus: Often people mistakenly believe that commutativity implies associativity, but that's in fact not true! Consider $ a * b = ab + 1 $. This is obviously commutative, but it isn't associative.


using only associativity we prove commutativity

Well, not really. You also used your knowledge that any natural number (but not zero or negative numbers!) can be expressed as a sum of 1s. And you didn't prove "commutativity" in general; you proved "commutativity of addition (of natural numbers)", which you already knew to be true anyway.

A simple example of an operation that is associative but not commutative is "addition of strings" as defined in most programming languages — that is, string concatenation. Concatenation is associative:

("abc" + "def") + "ghi" = "abcdefghi"
"abc" + ("def" + "ghi") = "abcdefghi"

However, obviously, it's not commutative:

"abc" + "def" = "abcdef"
"def" + "abc" = "defabc"

And vice versa: an example of an operation that is commutative but not associative is $x\star y = xy+1$.

$ (1 \star 2) = 3 \\ (2 \star 1) = 3 \\ \text{but} \\ (1 \star 2) \star 3 = 3 \star 3 = 10 \\ 1 \star (2 \star 3) = 1 \star 7 = 8 $