# commutative

Commutative Operation

Any operation for which ab = ba for all values of a and b. Addition and multiplication are both commutative. Subtraction, division, and composition of functions are not. For example, 5 + 6 = 6 + 5 but 5 – 6 ≠ 6 – 5.

More: Commutativity isn't just a property of an operation alone. It's actually a property of an operation over a particular set. For example, when we say addition is commutative over the set of real numbers, we mean that a + b = b + a for all real numbers a and b. Subtraction is not commutative over real numbers since we can't say that ab = ba for all real numbers a and b. Even though ab = ba whenever a and b are the same, that still doesn't make subtraction commutative over the set of all real numbers.

Further examples: In this more formal sense, it is correct to say that matrix multiplication is not commutative for square matrices. Even though AB = BA for some square matrices A and B, commutativity does not hold for all square matrices. It is also correct to say composition is not commutative for functions, even though one-to-one functions commute with their inverses.