# 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)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)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)Consider the elements $1, 3, 6 \in \mathbb{R}$. Then we have that:

(4)We also have that:

(5)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)And similarly, standard multiplication on $\mathbb{R}$ is commutative since:

(7)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)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)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)And also:

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