# Some easy examples of operations that don't work like you'd expect them to, i.e. not being commutative or associative etc.

I'm currently teaching some undergrads in their first / second semester about fields, groups, rings and vector spaces. I often see them argue that something is definitely a field, since addition / multiplication is commutative, associative and distributive in general.

This argument obviously doesn't hold for arbitrary addition / multiplication but it's kinda hard to get them to see this if they only know these operations from the real numbers. There are obviously many counterexamples but I'm trying to find some that aren't just constructed as counterexamples but actually used in everyday mathematics.

I've gotten so far matrix multiplication and the composition of functions as non-commutative operations.

Do you know any basic examples of operations that aren't associative or distributive?

• Exponentiation is non-associative. $a^{(b^c)}\neq \left(a^b\right)^c$. the right hand is $a^{bc}$.
– lulu
Commented Dec 3, 2023 at 8:45
• Subtraction is not associative. Addition does not distribute over multiplication.
– mcd
Commented Dec 3, 2023 at 8:46
• As a slightly more complicated example, composition of functions is distributive (over addition) on the left, but not on the right. Commented Dec 3, 2023 at 8:49
• The title asks for operations that we expect to be associative. But the body does not ask for that, and none of the answers so far mention an operation which is expected to be associative but turns out to be non-associative. What is the goal of the question? Commented Dec 3, 2023 at 16:25

The binary operation of average of two real numbers ($$a\oplus b=\frac{a+b}{2}$$) is commutative but not associative.

• Commented Dec 3, 2023 at 22:43

The cross product of vectors is neither commutative nor associative.

• It is, however, distributive over vector addition.
– Joe
Commented Dec 3, 2023 at 17:14

The Lie bracket $$[A,B]=AB-BA$$ on the space of matrices $$M_n(K)$$ is neither commutative, nor associative in general. In the special case, for the Lie algebra $$\mathfrak{so}_3(K)$$, the cross product is an example.

• The Jacobi identity is a form of "Lie associativity". Commented Dec 3, 2023 at 22:39

A rock-paper-scissors tournament is not associative (but is commutative and idempotent).

Let $$x\vee y$$ be the winner of hand $$x$$ versus hand $$y$$. Then

\begin{align} (r\vee p)\vee s&=p\vee s\\ &=s\\ &\neq r \\ &=r\vee s \\ &=r\vee (p\vee s), \end{align}

where the hands are:

• $$r$$ for rock.
• $$p$$ for paper.
• $$s$$ for scissors.
• What is $r \vee r$? You say that $\vee$ is idempotent, but $r \vee r = r$ doesn't seem right. This should be a draw without a winner. Commented Dec 3, 2023 at 22:44
• I thought that was evident from "idempotency", @MartinBrandenburg; we're free to define operations how we like, right? Besides, I'm of the happy-go-lucky opinion that a draw is a kind of win. Commented Dec 4, 2023 at 3:32

The octonions (aka Cayley numbers) $$\mathbb O$$ are a noncommutative and nonassociative $$\mathbb R$$-algebra. This means that the multiplication on $$\mathbb O$$ is neither commutative nor associative.

• Octonions are probably a bit too abstract as an early example for undergrads. However, they could be an interesting bit of spice in the conversation. They aren't associative, but they are alternative, a weak associativity which, in my opinion, goes to show just how hard mathematicians will work to find associativeness! Commented Dec 3, 2023 at 16:53
• @CortAmmon I agree that it not really an adequate example for beginners. And the octonions are certainly not used in everyday mathematics. On the other hand, it is an example in which one tries to define a "nice" multplication on the vector space $\mathbb R^8$. This seems to be in the spirit of the question. Perhaps it can serve as a "pan shot to a distant area" after having introduced the real and complex numbers. Also the quarternions can be mentioned in this context (non-commutative but still associative multiplication). Commented Dec 3, 2023 at 17:06

Composition of functions is distributive (over addition) on the right, but not on the left.

The title asks for operations that we expect to be associative (or commutative, distributive, etc.). The other answers have operations where non-associativity comes without any surprise. Here is an example where non-associativity might be a surprise (if you have never seen it before, of course), and is certainly wanted.

We can concatenate paths (with values in any space) with each other. In the first half of the time, go the first path, in the second half, go the second path. The concatenation of paths is not associative. In fact, if we have three paths $$f,g,h$$ and look at $$f * (g * h)$$, then $$f$$ covers half of the time, $$g$$ the next quarter and $$h$$ the final quarter. But in $$(f * g) * h$$ the path $$f$$ only covers a quarter of the time, $$g$$ the next quarter, and $$h$$ the full second half. Therefore, the paths $$f * (g * h)$$ and $$(f * g) * h$$ only agree up to a reparametrization, and therefore also up to homotopy. When we look at paths up to homotopy, we get an associative operation, namely the fundamental groupoid of the space.

Here is an example of an operation (actually, a functor) that it is not commutative (up to isomorphism), and it really was surprising to me when I first encountered it: If $$M,N$$ are bimodules over a ring $$R$$, then the natural homomorphism $$M \otimes_R N \to N \otimes_R M$$, $$m \otimes n \mapsto n \otimes m$$ is ... well does not exist at all! The map $$(m,n) \mapsto n \otimes m$$ is not bilinear (notice that $$mr \neq rm$$ in general). Probably not very beginner-friendly, but I wanted to mention it in any case.

In a first course in algebra, I think that the best examples of binary operations and algebraic structures to start off with are ones that are already familiar to students, such as matrix multiplication. However, once the familiar examples have been given, I think it is worth transitioning to the more abstract ones. In this post, the examples have a common theme: building new algebraic structures out of old.

Given an abelian group $$G$$, there are two natural operations that we can define on the set $$G^G$$ of maps from $$G$$ to $$G$$:

• Function addition: if $$f,g\in G^G,$$ then $$f+g\in G^G$$ is defined "pointwise" as the map $$x\mapsto f(x)+g(x).$$ (It is worth mentioning that the $$+$$ in $$f+g$$ is a binary operation on $$G^G,$$ whereas the $$+$$ in $$f(x)+g(x)$$ is the binary operation of the group $$G.$$)
• Function composition: if $$f,g\in G^G,$$ then $$f\circ g$$ is defined as the map $$x\mapsto f(g(x)).$$

The set $$G^G$$, together with function addition, is itself an abelian group. We might expect that composition distributes over addition, i.e. if $$f,g,h\in G^G,$$ then $$(f+g)\circ h=(f\circ h)+(g\circ h)$$ and $$f\circ (g+h)=(f\circ g)+(f\circ h).$$ However, only the first equation holds in general. Thus, $$G^G$$, together with function addition and composition, does not form a ring.

On the other hand, the abelian group $$G^G$$ has a subgroup which does admit a natural ring structure. Consider the set $$\operatorname{End}(G)$$ of homomorphisms from $$G$$ to itself – such homomorphisms are known as endomorphisms of $$G$$. Since endomorphisms preserve the addition of $$G$$, it can be shown that composition of endomorphisms distributes over addition of endomorphisms. Thus, $$\operatorname{End}(G)$$ forms a ring, known as the endomorphism ring of $$G$$.

A perhaps more familiar version of the above example is given by the set $$\mathcal L(V)$$ of linear maps $$V\to V$$, where $$V$$ is some vector space over a field $$k$$. Again, due to the defining properties of linear maps, composition distributes over addition nicely.

• Why don't you just consider the subgroup of homomorphisms $G \to G$ in the 2nd paragraph? Commented Dec 3, 2023 at 22:47
• @MartinBrandenburg: I've added a paragraph about the endomorphisms of $G$, but I've kept in the linear maps example; I think the latter is perhaps more familiar to students who study linear algebra before abstract algebra.
– Joe
Commented Dec 4, 2023 at 0:16

Here is an example that is not accessible to beginning students, but it's a natural setting where something is not associative when things are not done carefully.

Differential geometers like to define the $$k$$-th symmetric and exterior power of a real vector space as subspaces of the $$k$$-th tensor power of the vector space, and their definition of multiplication on the symmetric and exterior algebras (direct sum of all symmetric or exterior powers) has strange factorials, whose only purpose is to make that multiplication operation associative. Without the factorials associativity is lost. See the last paragraph here.

By defining symmetric and exterior powers instead as quotient spaces of tensor powers, no ugly factorials are needed in the definition of multiplication on the symmetric and exterior powers, and that's how things are set up in that document I linked to above.

Here is an important example in mainstream mathematics.

On a smooth cubic curve (pick a concrete example, say $$y^2 = x^3 + 17$$), observe that the line through two points $$P$$ and $$Q$$ cuts the curve in a third point $$R$$, where we use the tangent line at $$P$$ when $$Q = P$$ (this is why we want the curve to be smooth). In case $$P \not= Q$$ and the line through them is tangent to the curve at $$P$$ or $$Q$$ (meeting the curve at that point "twice"), the line through $$P$$ and $$Q$$ has no third separate intersection point with the curve, but we reasonably declare the third intersection point to be the $$P$$ or $$Q$$ at which the line is tangent.

Now define a binary operation $$\oplus$$ where $$P \oplus Q$$ is the third point $$R$$ on the curve that's also on the line through $$P$$ and $$Q$$. This operation $$\oplus$$ is clearly commutative, but it is not associative.

Example. On the curve $$y^2 = x^3 + 17$$, let $$A = (-1,4)$$, $$B = (2,5)$$, and $$C = (-2,3)$$. Show $$A \oplus B = A$$ because the line through $$A$$ and $$B$$ is tangent to the curve at $$A$$, so the third intersection point is $$A$$ by our convention above. Then $$(A \oplus B) \oplus C = A \oplus C = (4,9)$$: the line through $$A$$ and $$C$$ meets the curve in $$(4,9)$$. And $$A \oplus (B \oplus C) = A \oplus (1/4,33/8) = (19/25,522/125)$$, which is not $$(4,9)$$. So $$(A \oplus B) \oplus C \not= A \oplus (B \oplus C)$$.

Letting $$+$$ denote actual addition on these elliptic curves, $$P \oplus Q = -(P+Q)$$, so having associativity not hold is comparable on real numbers to saying $$x \oplus y = -(x+y) = -x-y$$ being commutative and not associative, but that operation on real numbers seems silly, while on cubic curves $$\oplus$$ seems like a natural operation initially.

Remark. I ignored the issue where a line through $$P$$ and $$Q$$ is vertical, requiring throwing in an "ideal" extra point that would be the identity in an elliptic curve group law, but I suggest not mentioning this aspect unless a student in the class notices $$\oplus$$ as I described it does not make sense when the line through $$P$$ and $$Q$$ is vertical.