0

I am rather new to mathematics, so the question is probably a bit stupid.

I've been thinking about non-commutativity as "when the order matters", but then this makes it hard to get the difference between that situation and non-associativity which also seem to be about the order of operations. Can someone help me clear up what probably is a misunderstanding?

Thank you :)

Enik
  • 1
  • 1
    Hi, welcome to Math SE. A binary operator $\circ$ is commutative if $x\circ y=y\circ x$, and associative if $(x\circ y)\circ z=x\circ(y\circ z)$. Is there anything else you'd like clarified? – J.G. Feb 06 '23 at 22:00
  • 3
    To understand the difference, think more about examples where associativity or commutativity each hold or fail. You can find some with a google search, some even on this site. That's likely to be more helpful than relying on short everyday phrases like "order matters". (Looking at lots of examples is good mathematical advice in most situations.) – Ethan Bolker Feb 06 '23 at 22:03
  • 1
    If @EthanBoiker's suggestion would be helpful, matrix multiplicative is associative but not commutative. Here's an example of a commutative but not associative operation: given choices $x,,y$ in rock-paper-scissors, define $x\circ x:=x$, and $x\circ y$ as the winner between $x$ and $y$ if $x\ne y$. – J.G. Feb 06 '23 at 22:05

2 Answers2

2

Commutivity is about the order of the operands: $x \circ y = y \circ x$.

Associativity is about the order of the operators: $x \circ (y \circ z) = (x \circ y) \circ z$. Note that although the operators will be performed in a different sequence, the operands are in the same sequence.

As mentioned in the examples, matrix multiplication is associative but not commutative. Non-commutative operations are frequently studied but non-associative ones are more rarely studied.

badjohn
  • 8,204
0

Let just start with the basic four operations.

  • $+$ is commutative because $a+b=b+a$ and associative because $(a+b)+c=(a+b)+c$

This is the same for multiplication $\times$.

The commutativity deals with the order of the input elements, while associativity deals with parenthesising (the order stays the same).

Note that for an associative law $\circ$, parenthesis can then be omitted and we have no problem talking about expressions like this $a\circ b\circ c\circ d$.

  • $-$ and $\div$ are neither commutative nor associative.

$2-1=1$ is not the same as $1-2=-1$

and $(3-2)-1=0$ is not the same as $3-(2-1)=2$.

  • An example of a low which is not commutative but still associative are for instance projectors.

In simple language take the operation of painting. If I paint in blue then in red the result is red, this is not commutative as painting in red first then blue, the result will be blue.

But it is associative as the result only depends on the last applied color, therefore $(a\circ b)\circ c=a\circ c=a$ and $a\circ(b\circ c)=a\circ b=a$ as well.

A more interesting example than projection is matrix multiplication for instance.

  • A simple example of non associativity but still commutativity would be the geometric midpoint.

It is obviously commutative since the midpoint of $A$ and $B$ is the same as the midpoint of $B$ and $A$.

But for $3$ points $A=0,B=2,C=4$ then $\begin{cases}mid(mid(A,B),C)=mid(1,4)=2.5\\ mid(A,mid(B,C))=mid(0,3)=1.5\end{cases}\quad$ so it is not associative.

zwim
  • 28,563
  • Thank you! I think I get it now. Can I think of commutativity as linked to whether or not there exsists an inverse operation? – Enik Feb 12 '23 at 12:38
  • No, if you take for instance the logical OR this operation is commutative but since it is destructive of data (i.e. $a\lor 1=1$ and information on $a$ is lost, contrary to xor) it has no inverse. – zwim Feb 12 '23 at 14:37
  • Ah, exactly. Ok, thank you :) – Enik Feb 12 '23 at 15:49