1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Commutativity vs Associativity

  1. May 7, 2009 #1
    Commutativity: a + b = b + a

    Associativity: (a + b) + c = a + (b + c)

    To me these two say the exact same thing: Order does not matter.

    How are they different? Surly it is more than the number of values being added, otherwise we would need a new rule for 4 elements, yet another for 5 and so on.

  2. jcsd
  3. May 7, 2009 #2


    User Avatar
    Gold Member

    They also say that ab=ba and (ab)c = a(bc) infact. The first one says that you can reverse the order of operations and receive the same result. The second says that you can switch around items in the parenthesis and return the same result.

    A laymen's explanation as to why this is important is that you can deal with things such as operators where if you define operators A, B, and C, associativity and commutativity may not hold. In fact, with operators, AB in general does NOT equal BA. You can also deal with things called Grassmann numbers which don't commute. Someone else can probably give you a more thorough explanation.
  4. May 7, 2009 #3
    Sure, but let us stick to addition. The laws are used all over the place, but it is easier to just discuss one specific case.

    But "switching around items in the parenthesis" is the same as altering the order.

    a + (b + c) = b + c + a = a + b + c

  5. May 7, 2009 #4
    Yes, both commutativity and associativity tell you that the order does not matter in a sense, but there is a difference.

    The statement (a + b) + c = a + (b + c) implicitly says that we can first add a and b, then add c (giving us the left hand side) or alternatively, we can first add b and c, then add a (the right hand side). Either way, the resulting expressions are equal, so we might as well remove parentheses altogether and just denote the sum a + b + c. So again, associativity of addition tells us that no matter how we group the different possible ways of summing 3 or more numbers using parentheses (grouped in a way as to indicate which two numbers should be added first), we get the same sum, so we can just do without the parentheses.

    Commutativity is more of a direct statement about the placement of the numbers. It doesn't matter which of the two numbers are added first, what matters is that if we have a + b, then reversing the order of these two numbers gives b + a, and these two expressions are equal.

    So while associativity tells us that instead of (a + b) + c, we could have added b + c first, commutativity tells us that if we switch the order of (a + b) + c, we get c + (a + b), and these last two expressions are equal.
  6. May 7, 2009 #5


    User Avatar
    Homework Helper

    Actually it's not... take matrix multiplication as an example:

    [tex]\left(\begin{matrix}2 & 1 \\ 1 & 0\end{matrix}\right) \left(\begin{matrix}-2 & -1 \\ 1 & 0\end{matrix}\right) = \left(\begin{matrix}-5 & -2 \\ 2 & 1\end{matrix}\right)[/tex]
    [tex]\left(\begin{matrix}-2 & -1 \\ 1 & 0\end{matrix}\right) \left(\begin{matrix}2 & 1 \\ 1 & 0\end{matrix}\right) = \left(\begin{matrix}-3 & -2 \\ -2 & -1\end{matrix}\right)[/tex]
    So multiplication of matrices is not commutative. But:
    [tex]\left(\begin{matrix}2 & 1 \\ 1 & 0\end{matrix}\right) \left(\left(\begin{matrix}-2 & -1 \\ 1 & 0\end{matrix}\right) \left(\begin{matrix}1 & 1 \\ 1 & -1\end{matrix}\right)\right) = \left(\begin{matrix}-3 & -7 \\ -1 & -3\end{matrix}\right)[/tex]
    [tex]\left(\left(\begin{matrix}2 & 1 \\ 1 & 0\end{matrix}\right) \left(\begin{matrix}-2 & -1 \\ 1 & 0\end{matrix}\right)\right) \left(\begin{matrix}1 & 1 \\ 1 & -1\end{matrix}\right) = \left(\begin{matrix}-3 & -7 \\ -1 & -3\end{matrix}\right)[/tex]
    Thus matrix multiplication is associative. (Of course, just because this particular product is associative doesn't mean matrix multiplication is always associative, but it's possible to prove that it is in general.) This should at least show you that commutativity is not the same thing as associativity; if it were, then the fact that matrix multiplication is associative would automatically mean that it would be commutative as well.

    Note that the operation of addition (on numbers, matrices, vectors) happens to be commutative and associative. So if you say "let's stick to addition" you'll never be able to convince yourself that commutativity and associativity are not the same thing.
  7. May 7, 2009 #6
    But doesn't this come from commutativity? If the order in which you add values does not matter, then parentheses have no meaning.

    I'm sorry I'm so slow, I just cant see why associativity is needed :/ (or how it is different from commutativity for that matter).

  8. May 7, 2009 #7
    No, you're not being slow, my explanation wasn't clear enough. Rather, I danced around the usage of the word order. Note that associativity is a statement about the order of operations. Yes, in the end, we might as well denote a + b + c as the 6 different possible ways of writing the sum of three numbers. But these are axioms, so we are really working with obvious statements, but ensuring that the conceivable difficulties are taken care of.

    So for associativity, we are worried about how the terms are grouped together. Which numbers should be added first? The answer is that the order of OPERATIONS does not matter as long as the order of the operands are not changed (think about what this means for a minute). Keeping my previous explanation in mind, we simply place parentheses around the terms that we indicate should be added first. The problem is that if we add b and c first, and then a, then this sum is conceivably different from adding a and b first and then c. Of course, our axiom tells us that the sum is the same. So that adding b and c first then adding a is a + (b + c) and this is the same as adding a and b first, then c. Notice that we write this as a + (b + c) = (a + b) + c, so we are simply placing parentheses around the terms in which we think should be added first, but we are NOT changing the sequence of the actual operands. We are not saying that a + (b+c) = (b+c) + a because this is reversing the order (or changing the sequence) of the operands a and (b + c). Associativity only allows us to place parentheses around terms in which we think should be added first, and tells us that it doesn't matter where we place the parentheses as long as the sequence of the operands is not changed. In other words, it justifies a change in the order of operations, provided that the order of the operands is not changed.

    On the other hand, commutativity is concerned with the conceivable problem that reversing the sequence of operands in a sum might give us a different number, but this is not true. Hence, adding a pair of numbers does not depend on the order in which we add them. We are no longer talking about the order of operations, but rather the order of the operands. In the above case for commutativity, we can't really say anything about the order of operations, since we only have two numbers (for instance, it doesn't make sense to say "add a first and then b"). But we can talk about the sequence of the operands, specifically, if we reverse the order of the two numbers, our sum will not change, i.e. a + b, where a comes before b in the sequence of operands, is equal to b + a, where the sequence of operands has been reversed (b now comes before a).
    Last edited: May 7, 2009
  9. May 7, 2009 #8
    Aha. That's a good point, thank you.

    I appreciate the example with the matrices, even though I do not know how to operate on those yet.

    Do you happen to have a more basic example where one holds and the other does not?

    From Wikipedia:

    "The associative property is closely related to the commutative property. The associative property states that the order in which operations are performed does not affect the final result as long as the order of terms is not changed. In contrast, the commutative property states that the order of the terms does not affect the final result."

    I think I am perhaps starting to see the difference. Associativity = the order of the operators. Commutativity = the order of the values. When you alter the parentheses of an expression, you are changing the order in which the operators are executed.

    So, let me test myself and please let me know if I am wrong.

    a + b = b + a .. by commutativity
    a + b + c = c + b + a .. by commutativity
    (a + b) + c = c + (a + b) .. by commutativity
    c + (a + b) = (c + a) + b .. by associativity
    c + (a + b) = c + a + b = a + b + c .. by associativity, then by commutativity
    (a + b) + (c + d) = a + b + c + d = a + d + b + c = (a + d) + (b + c) .. by associativity, then by commutativity, then by associativity again.

  10. May 7, 2009 #9
    Yep, that was the part I never got. I appreciate the help, your explanation added a lot and the difference between the two finally sunk in :)

    Thanks again,

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Commutativity vs Associativity
  1. Commutative matrices (Replies: 9)