Associativity and Commutativity of Binary Operations

# Associativity and Commutativity of Binary Operations

Recall from the Unary and Binary Operations on Sets that a binary operation on a set $S$ if a function $f : S \times S \to S$ that takes every pair of elements $(x, y) \in S \times S$ (for $x, y \in S$) and maps it to an element in $S$.

Sometimes these operations, which we will note denote by $*$ (as opposed to $f$) satisfy some useful properties which we define below.

 Definition: An operation $*$ on a set $S$ is said to be Associative or satisfy the Associativity Property if for all $a, b, c \in S$ we have that $a * (b * c) = (a * b) * c$, and otherwise, $*$ is said to be Nonassociative.

By definition, a binary operation can be applied to only two elements in $S$ at once. Therefore, an operation is said to be associative if the order in which we choose to first apply the operation amongst $3$ elements in $S$ does not affect the outcome of the operation.

For example, if we consider the set $\mathbb{R}$ then standard addition is associative since for all $a, b, c \in \mathbb{R}$ we have that:

(1)
\begin{align} \quad a + (b + c) = (a + b) + c \end{align}

Similarly, standard multiplication is associative on $\mathbb{R}$ because the order of operations is not strict when it comes to multiplying out an expression that is solely multiplication, i.e.,:

(2)
\begin{align} \quad a \cdot (b \cdot c) = (a \cdot b) \cdot c \end{align}

For an example of a nonassociative operation, consider the operation $*$ defined by $* : \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ and given for all $a, b \in \mathbb{R}$ as:

(3)
\begin{align} \quad a * b = (a + b)^2 \end{align}

Consider the elements $1, 3, 6 \in \mathbb{R}$. Then we have that:

(4)
\begin{align} \quad 1 * (2 * 3) = 1 * (2 + 3)^2 = 1 * 25 = (1 + 25)^2 = 676 \end{align}

We also have that:

(5)
\begin{align} \quad (1 * 2) * 3 = (1 + 2)^2 * 3 = 9 * 3 = (9 + 3)^2 = 12^2 = 144 \end{align}

Clearly $676 \neq 144$ and so $*$ is nonassociative on $\mathbb{R}$ since $a * (b * c) \neq (a * b) * c$ for $1, 3, 6 \in \mathbb{R}$.

 Definition: An operation $*$ on a set $S$ is said to be Commutative or satisfy the Commutativity Property if for all $a, b \in S$ we have that $a * b = b * a$, and otherwise, $*$ is said to be Noncommutative.

Once again, standard addition on $\mathbb{R}$ is commutative since for all $a, b \in \mathbb{R}$ we have that:

(6)
\begin{align} \quad a + b = b + a \end{align}

And similarly, standard multiplication on $\mathbb{R}$ is commutative since:

(7)
\begin{align} \quad a \cdot b = b \cdot a \end{align}

Consider the example $* : \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ given above as $a * b = (a + b)^2$. We saw this operation was nonassociative but it is also commutative since for all $a, b \in \mathbb{R}$ we have that:

(8)
\begin{align} \quad a * b = (a + b)^2 = (b + a)^2 = b * a \end{align}

A classic example of a noncommutative operation is the operation of matrix multiplication on $2 \times 2$ matrices. Let $* : M_{22} \times M_{22} \to M_{22}$ be the operation of standard matrix multiplication which we've already defined for all matrices $A, B \in M_{22}$ as:

(9)
\begin{align} \quad A * B = \begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22} \end{bmatrix} \begin{bmatrix} b_{11} & b_{12}\\ b_{21} & b_{22} \end{bmatrix} = \begin{bmatrix} a_{11}b_{11} + a_{12}b_{21} & a_{11}b_{12} + a_{12}b_{22}\\ a_{21}b_{11} + a_{22}b_{21} & a_{21}b_{12} + a_{22}b_{22} \end{bmatrix} \end{align}

Now consider the following matrices $A = \begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix}$ and $B = \begin{bmatrix} 0 & 1\\ 0 & 0 \end{bmatrix}$. We have that:

(10)
\begin{align} \quad A * B = \begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1\\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 1\\ 0 & 0 \end{bmatrix} \end{align}

And also:

(11)
\begin{align} \quad B * A = \begin{bmatrix} 0 & 1\\ 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0\\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 0 & 0\\ 0 & 0 \end{bmatrix} \end{align}

Clearly $A * B \neq B * A$ in general, and so matrix multiplication on $2 \times 2$ matrices is noncommutative.