6
$\begingroup$

Both laws say that for some operations the order in which the calculation happens does not affect the result. Where is the difference exactly?

$\endgroup$
4
  • 2
    $\begingroup$ One says the order of the parantheses doesn't matter, the other that the order of the terms doesn't matter. You can have associative non commutative laws but also commutative non associative laws. $\endgroup$ Oct 24, 2011 at 20:01
  • 2
    $\begingroup$ Does anyone know a nice minimal example for a commutative non-associative operation? $\endgroup$
    – Rasmus
    Oct 24, 2011 at 20:16
  • 8
    $\begingroup$ $x\circ y = xy+1$ is commutative but not associative. $\endgroup$ Oct 24, 2011 at 20:19
  • 6
    $\begingroup$ Pairwise averaging, $x\circ y:=(x+y)/2$, is also commutative but not associative. And matrix multiplication is associative but not commutative. $\endgroup$ Oct 24, 2011 at 20:24

2 Answers 2

15
$\begingroup$

The commutative law says that $X \circ Y = Y \circ X$ where $\circ$ is the operation under consideration (addition, multiplication, what have you). In words, you can swap the order of the two inputs of the operation and it won't matter.

The associative law says that $(X \circ Y) \circ Z = X \circ (Y \circ Z)$, where the parentheses tell you what you should be doing first. As you can tell, it's quite different: this is no longer about changing the order of the "things" you operate on, but rather the order of the operations themselves.

Suppose the "things" are permutations of 3 objects (so that "swap 1 and 2" and "move 1 to 2, 2 to 3 and 3 to 1" are legitimate "things"), and the "operation" is "do the first and then the other". You can see for yourself that the commutative law is not satisfied (try swapping 1 2 and then 2 and 3 vs doing it in the opposite order), but the associative law is.

$\endgroup$
0
$\begingroup$

These are really hard for me to keep straight. I like Alon's answer but I also like something really simple I can reference:

  • Associative: order of operations
  • Commutative: order of operands

The other trouble I have beyond this is coming up with a simple literal example versus an abstract. If I think of one, I'll add it here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.