# Does commutativity imply Associativity?

Does commutativity imply associativity? I'm asking this because I was trying to think of structures that are commutative but non-associative but couldn't come up with any. Are there any such examples?

NOTE: I wasn't sure how to tag this so feel free to retag it.

-
Commutative operations that are associative are the exception. But an important exception! Let $x\ast y=|x-y|$. – André Nicolas Jun 20 '12 at 20:41
Not even in the presence of an identity element and an opposite, see this. In fact, William's answer is already in that post ;) – Bruno Stonek Jun 20 '12 at 21:58
The interchange law $(x * y) \cdot (z * w) = (x \cdot z) * (y \cdot w)$, in the presence of a two-sided common unit element, implies commutativity and associativity of $*$ and $\cdot$. (In fact, they have to be the same operation!) – Zhen Lin Jun 20 '12 at 22:14
See my 3 February 2009 sci.math post A natural example of a commutative, non-associative operator (see Google archive version or Math Forum archive version) for some examples and references. – Dave L. Renfro Jun 22 '12 at 21:31

Consider the operation $(x,y) \mapsto xy+1$ on the integers.

-
@marlu Could you explain this some more please? It doesn't say why, or (for people like me who don't know much about maths), what that arrow even means. – user673679 Jan 12 '15 at 13:13
Well, associativity and commutativity are properties of maps $X\times X \to X$ for a set $X$. In other words, such a map takes two elements as an "input" and returns a single element. In my example, the set under consideration is the set of integers and the map sends each pair of integers $(x,y)$ to $xy+1$. Commutativity means $xy + 1 = yx + 1$ for all $x$ and $y$, which is satisfied. Associativity would mean $x(yz+1) + 1 = (xy+1)z+1$ for all $x$, $y$ and $z$, but it's easy to find examples where this equation does not hold, so the operation is not associative. – marlu Jan 14 '15 at 4:14
Short, sweet. Nice. – AJFarmar Mar 20 '15 at 20:55
But wait, this is unfair — you're considering commutativity under addition, but associativity under both addition and multiplication, they're different operations! ☹ – Hi-Angel Jan 14 at 18:28

A basic example is the "midpoint" binary operation: $a*b = \frac{a+b}{2}$

In general, if $P(u,v)$ is any polynomial in two variables with rational coefficients, then $x*y = P(x+y,xy)$ is rarely associative - I'd be curious under what conditions on $P$ this operation would be associative.

My example is $P(u,v)=\frac{u}{2}$ and Marlu's example is $P(u,v)=1+v$.

-
In general, a symmetric function $P(x,y)$ is rarely associative. You could take $P(x,y)=\arctan xy+e^{(x+y)^9}$, too. – Mariano Suárez-Alvarez Sep 14 '12 at 16:38

The easiest Jordan algebra is symmetric square matrices with the operation $$A \ast B = (AB + BA)/2,$$ similar to a Lie algebra but with a plus sign.

http://en.wikipedia.org/wiki/Jordan_algebra

-

Let $A = \{e,x,y\}$. Define $\cdot$ on $A$ to be $a\cdot e=a$ for all $a$, $e\cdot a= a$ for all a, and $a\cdot b=e$ for all $a$ and $b$ such that $a\neq e$ and $b\neq e$, (i.e. $a,b \in \{x,y\}$).

This operation is commutative, $e$ is the identity, (everything even has an inverse), but is not associative since $(x \cdot y) \cdot y = e \cdot y = y$ and $x \cdot (y \cdot y) = x \cdot e = x$.

-

Arguably the most important example of a commutative but non-associative structure is that of finite-precision floating point numbers under addition. (a + -a) + b is always equal to b but a + (-a + b) can differ from b since the sum -a + b can involve a loss of precision (this is especially true if a and b are nearly but not quite equal, -a + b could work out to 0 even though the corresponding real sum is nonzero). The lack of associativity of floating point arithmetic is a constant complicating factor in numerical analysis.

-
This is a nice example, because it reminds us how important these concepts are in practical life, even though we often do not think about them..(+1) – Björn Friedrich Jun 14 at 16:46

The simplest examples of commutative but nonassociative operations are the NAND and NOR operations (joint denial and alternative denial) in propositional logic. To quote from my answer to another question:

Namely, the $2$-element structure $\{a,b\}$, where $aa=b$ and $ab=ba=bb=a$, is commutative but not associative. This is the unique (up to isomorphism) binary operation on a $2$-element set which is commutative but not associative; it can be interpreted as either of the truth-functions NOR or NAND.

-