Commutativity

Kapitoly: Commutativity, Associativity, Distributivity

Commutativity is a property of operations such as addition. We can notice that in addition, the order does not matter, so 3 + 5 is the same as 5 + 3. Whatever two real numbers we add a + b, the result will be the same even if we swap the numbers we add: b + a. If an operation satisfies this condition, we say it is commutative.

An example of another operation that is commutative is multiplication, because 2 · 6 has the same result as 6 · 2, and the same is true for any two numbers a, b:

$$\large a\cdot b = b\cdot a$$

An example of an operation that is not commutative is subtraction, because 7 − 4 is different from 4 − 7. In the first case we get the result 3, and in the second case we get −3. Another example is division, because 2 / 5 is different from 5 / 2.

But watch out for other properties of the operations, such as the priority of multiplication. If we have an expression 1 + 2 · 3, we cannot say that it is the same as 2 + 1 · 3. This is because the priority of multiplication takes precedence over addition. We can help ourselves with parentheses: the expression 1 + 2 · 3 is the same as 1 + (2 · 3). If we want to apply the commutativity law of addition, we can, but we have to take the whole parenthesis with us: 1 + (2 · 3) is equal to (2 · 3) + 1, and that is equal to (3 · 2) + 1, if we still apply commutativity of multiplication.

Multiplicative operations and commutativity

Commutative operations need not be only operations on numbers, but also operations on sets, for example. For example, the intersection of the sets A and B is a commutative operation. The intersection of two sets is "the elements that are in both sets", i.e.

$$\large A\cap B = B\cap A$$

It will work in exactly the same way for the union of the sets A and B, which results in "elements that are in at least one of the sets" and hence:

$$\large A\cup B = B\cup A$$

The commutative is not, for example, a set difference.

Vectors

One other commutative operation can be found among the operations on vectors, and that is vector addition - in general, addition is usually a commutative operation. In this case, if we have two vectors $\vec{u}$ and $\vec{v}$, then

$$\large\vec{u}+\vec{v}=\vec{v}+\vec{u}$$

This is shown graphically in the following figure:

Sum of two vectors

The summation $\vec{u}+\vec{v}$ shows the "upper path", where we first apply the red vector $\vec{u}$ and then the blue vector $\vec{v}$. The summation $\vec{v}+\vec{u}$ shows the "lower path", where we first take the path of the blue vector $\vec{v}$ and then the red vector $\vec{u}$. But the result is the same, the vectors end up at the same point.

You can think of it as coming out of a place and going fifty meters north and then twenty meters west. If you first went twenty meters west and then fifty meters north, you would end up in the same place. So this kind of walking is commutative.

Logic

Commutative operations also include the logical operators "and at the same time" (conjunction) and "or" (disjunction). This means that the statement "the number 5 is both odd and prime" has the same validity as the statement "the number 5 is both prime and odd". Similarly, for conjunction, "the number 6 is prime or even" has the same validity as the statement "the number 6 is even or prime".

But the commutative is not an implication, so the statement "if I win at sports, then I will be rich" is not the same as "if I am rich, then I will win at sports".