Monday, May 2, 2011

Commutativity and Associativity

This is the first of a three part post on the commutative and associative properties (stay tuned for parts two and three).

Commutativity: Order Doesn't Matter
When you add two things, the order in which you add them doesn't matter (2+4 is the same as 4+2). The name of this property is the commutative property. Examples of commutative operations are [note 1]:
  • Multiplication: 2×3 is the same as 3×2
  • Preparing a bowl of Cereal: it doesn't matter what order you add the milk and the cereal
  • Putting on shoes: It doesn't matter what shoe you put on first
  • Rotation: rotate left then right or right  then left , you end up at the same place
  • The logical operator or: "Him or her" is the same as "Her or him."  
  • Vector addition: 
  • The intersection of sets: :
  • Multidimensional Integration:
    Sometimes the order of things do matter. For example, division: is not the same as (the first is 2 the second is one half). When an operation does not commute, we call it non-commutative (that's simple enough). Some examples of non-commutativity are:
    • Subtraction: 5-3 is 2, but 3-5 is -2
    • Division: 
    • Exponentiation: 
    • Matrix Multiplication: [see note 2]
    • Making a cake: mix ingredients and then bake, order matters
    • Putting your clothes on in the morning: underwear first, then pants
    • Material Implication:  is not the same as
    • Rotations on a Rubik's Cube: turning the top then the right is different than turning the right then the top:

    One important note on non-commutativity is that the operation doesn't have to be non-commutative on everything for it to be non-commutative. Take exponentiation for example, and are both 16. (Or if you're less mathematically inclined, use the examples of putting on your clothes: it doesn't matter if you put your pants on first, or your shirt.) An operation is still non-commutative if there's at least one pair of things that doesn't commute.

    Associativity: I Don't Care Who You Hang Out With
     When adding three (or more) numbers, it doesn't matter how you group those numbers. For example, if you wanted to add 2, 3 and 5, you could add 2 and 3, then add 5, or you could add 2 to 3 plus 5. This is much clearer with notation: 2+(3+5) is the same as (2+3)+5. The way you group the numbers doesn't change the answer. This is called this associativity. Other examples of associativity include:
    • Multiplication: 2×(3×4) is the same as (2×3)×4
    • Mixing trail mix: mixing raisins and granola then adding walnuts is the same as mixing raisins into a  granola/walnut mixture
    • Translations on a plane: going up 4, then going to the left 3 and down 2 is the same as going up 4 and left 3 then going down 2
    • Maximum function: max(a, max(b,c)) = max(max(a,b),c) 
    • The logical operator and: 
    • Composite functions:
    • Putting together a puzzle:

    You probably guessed it; some things are non-associative. The best example is division: is 1, but is 4. When dividing, the way you group things matters. Other non-associative examples include:
    • Subtraction : (8-5)-2 = 1 but 8-(5-2) = 5 
    • Exponentiation:  
    • Doing the dishes: Washing and drying dishes, then putting them away is definitely not the same as washing dishes that are dried and put away
    • English Expressions: A (smart dog) owner is someone that owns a smart dog, a smart (dog owner) is someone that is smart and owns a dog.
    • Material implication: is not the same as
    • The one dimensional distance formula d(x,y) = |x-y|:
    Conclusion
    Commutativity and associativity are important mathematical concepts. In part 2, we'll be looking at something associative and non-commutative. In part 3, We'll look at something commutative and non-associative.

    [Notes]
    [1] Some of my examples come from Wikipedia, some of them I heard before (in a classroom or in a conversation), some of them I just made up.
    [2]
     

    No comments:

    Post a Comment