A function where the sequence of elements or order of execution does not affect the result of the operation is said to be Associative in nature. The example of an Associative function is given below:
A + (B + C) = (A + B) + C ⇒ 4 + (5 + 3) = (5 + 4) + 3 = 12
- Image courtesy: boundless.com
As discussed before, a Commutative operation is based on the fact the operands do no not affect the result of the operation. For example, if a binary operation x is applied on two elements called A and B and A x B = B x A then the operation is so be commutative in nature.
All multiplication and addition operations in algebra or mathematics are commutative operations. For example when you have any two numbers A and B, the result will be the same irrespective of the sequence of the elements, which means:
A + B = B + A and A x B = B x A
5 + 4 = 4 + 5 and 5 x 4 = 4 x 5
Subtraction and division functions can never be Commutative in nature.
- Image courtesy: golem.ph.utexas.edu