Rock, Paper, Scissors, Shoot!
This example (found on Wikipedia) is based on the game Rock, Paper, Scissors. (If you don't know how to play look here; if you want to get some practice in, play here.) Recall that Rock beats Scissors, Scissors beats Paper, and Paper beats Rock (for some reason). Let r, p, and s represent rock, paper, and scissors respectively, and let x * y mean "x is played against y." After a match is played, the match is equal to the winner of the match; in a tie, the winner is whatever hand was played. Some examples:
English Language Version | Notation |
"rock is played against paper and paper wins" | r * p = p |
"scissors is played against paper and scissors wins" | s * p = s |
"paper is played against paper and paper wins" | p * p = p |
Like before, we can keep all of our information organized by arraigning it as a table:
* | r | p | s |
r | r | p | r |
p | p | p | s |
s | r | s | s |
You can tell by the symmetry of the table that it's commutative (the order in which you evaluate expressions doesn't matter). However, it's non-associative:
(s * p) * r = s * r = r
but
s * (p * r) = s * p = s
It doesn't matter what order you evaluate terms, but it matters very much how you group them.
Conclusion
On this three part adventure (no, I don't think adventure is hyperbole) we've looked at structures that were commutative and associative, commutative and non-associative, non-commutative and associative, and non-commutative and non-associative. The table gives an example from all four categories:
Commutative | Non-Commutative | |
Associative | Addition | Triangle Transformations |
Non Associative | Rock, Paper, Scissors | Division |
This shows that commutativity and associativity are independent notions. If you have one, that doesn't say anything about whether you have the other.
No comments:
Post a Comment