Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspxSometimes a good example can instantly clarify something.
I recall back to my early school days when my math teacher explained that addition and multiplication were Commutative (a+b == b+a) and Associative ( a+(b+c) == (a+b) +c). We students didn'ten-USTelligent Evolution Platform Developer Build (Build: 5.6.50428.7875)re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#490540Wed, 09 Nov 2005 01:01:02 GMT91d46819-8472-40ad-a661-2c78acb4018c:490540lee it doesnt help u at all
<br><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=490540" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#470967Mon, 19 Sep 2005 01:09:43 GMT91d46819-8472-40ad-a661-2c78acb4018c:470967Mike Stall - MSFTDivya-
<br>You're right about subtraction. Generally, finding operations that are both Comm + Assoc or finding operations that are neither Comm nor Assoc are easy. It's more difficult to find intuitive operations that are one or the other.
<br>
<br>Note that division is not associative:
<br>((12 div 6) div 2) = ((2) div 2) = 1
<br>(12 div (6 div 2)) = (12 div (3)) = 4
<br><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=470967" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#470843Sun, 18 Sep 2005 14:05:03 GMT91d46819-8472-40ad-a661-2c78acb4018c:470843DivyaDon't subtraction or division count as operations ? Subtraction is neither commutative nor associative
<br>3-4 != 4-3 and
<br>((3-2)-1) != (3-(2-1))
<br>
<br>Division is associative, not commutative
<br>
<br>Or am I missing something very basic in this post ?<div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=470843" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#469159Fri, 16 Sep 2005 21:53:32 GMT91d46819-8472-40ad-a661-2c78acb4018c:469159Mike Stall - MSFTOliver - cute example!<div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=469159" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#468242Fri, 16 Sep 2005 10:55:06 GMT91d46819-8472-40ad-a661-2c78acb4018c:468242OliverI've got an about 8 month old son. Although it seems a little bit too early, I suppose I can show him the difference in quite some time using one of his toys: Some colorful, varying sized buckets that forms sort of a pyramidal pile if they are stacked correctly - and he loves to knock them over every time I do so.
<br>
<br>Sometimes - just to be somewhat faster than his attempt to knock it over - I stack one small pile first, than the other and finally put one pile on the other. You can guess that it does not last very long ;)
<br>
<br>As it turns out, the technique I use is exactly something like A + (B + C) = (A + B) + C, although more "variables" are involved. And it is easy to see - even for my son - that putting B on A does not turn out to be the same than putting A on B, because the result is rather boring.
<br>
<br>So here it is, everything in a game of a 8 month old baby :)<div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=468242" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#464717Tue, 13 Sep 2005 17:14:40 GMT91d46819-8472-40ad-a661-2c78acb4018c:464717Mike Stall - MSFTMich - I was tempted to use "xor" but I thought it may confuse some people. I suppose it's par for a technical blog. :)
<br>
<br>Raymond - great example, thanks! That's something 5th graders could understand.
<br>
<br>Wesner - you're right. That's the example our teacher used many years ago; but since we didn't know much about matrices at the time, we didn't really appreciate it. <div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=464717" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#464413Tue, 13 Sep 2005 10:33:56 GMT91d46819-8472-40ad-a661-2c78acb4018c:464413Wesner MoiseMatrix multiplication is associative not commutative.
<br>
<br><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=464413" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#464361Tue, 13 Sep 2005 08:20:31 GMT91d46819-8472-40ad-a661-2c78acb4018c:464361Raymond Chen - MSFTAnything involving function composition (or even more generally any semigroup) is associative though not necessarily commutative, eg matrix multiplication.
<br>
<br>Color blending is commutative but not associative:
<br>
<br>(white blend black) blend black = gray blend black = dark gray.
<br>white blend (black blend black) = white blend black = gray.
<br>
<br><div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=464361" width="1" height="1">re: Commutative vs. Associativehttp://blogs.msdn.com/b/jmstall/archive/2005/09/13/commutative-associative.aspx#464352Tue, 13 Sep 2005 07:35:04 GMT91d46819-8472-40ad-a661-2c78acb4018c:464352Michael S. KaplanI would have asked for operations that were commutative xor associative. :-)<div style="clear:both;"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=464352" width="1" height="1">