· Siblings

Consider a binary operation, such as addition, that combines two inputs, such as two numbers, into one result. Associativity and commutativity both involve changing an order, but they change the order of different things. An associative operation gives the same result when the order in which the operations are performed changes, while the inputs stay in place, as in $(a \ast b) \ast c = a \ast (b \ast c)$: on the left, $a \ast b$ is computed first; on the right, $b \ast c$ is computed first. A commutative operation gives the same result when the order of the inputs changes, as in $a \ast b = b \ast a$: $a$ and $b$ trade places. An operation can have either property without the other.

Definitions

associative

Elementary

A way of combining numbers is associative if, when you combine three numbers in a row, it doesn’t matter which pair you combine first, such as $(2 + 3) + 4 = 2 + (3 + 4)$.

Undergraduate (abstract algebra)

Consider a set $S$ with a binary operation $\ast$. The operation $\ast$ is associative if

\[(a \ast b) \ast c = a \ast (b \ast c) \quad \text{for all } a, b, c \in S.\]
Examples
  • Addition $+$ on $\reals$
    Addition on $\reals$ is associative: for example, $(2 + 3) + 4 = 2 + (3 + 4) = 9$.
  • Multiplication $\times$ on $\reals$
    Multiplication on $\reals$ is associative: for example, $(2 \times 3) \times 4 = 2 \times (3 \times 4) = 24$.
  • Multiplication of $2 \times 2$ real matrices
    Multiplication of $2 \times 2$ matrices is associative, because $(A B) C$ and $A (B C)$ both represent the composition of the same three linear maps. For example, multiplying the first two matrices first and multiplying the last two matrices first give the same product: \[\left( \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} \right) \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 4 & 1 \\ 2 & 1 \end{bmatrix},\] \[\begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \left( \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} \right) = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 2 & 1 \end{bmatrix} = \begin{bmatrix} 4 & 1 \\ 2 & 1 \end{bmatrix}.\]
Non-examples
Properties
  • Addition and multiplication of real numbers are associative, and so are composition of functions and multiplication of matrices.
  • Subtraction is not associative: $(5 - 3) - 1 = 1$, but $5 - (3 - 1) = 3$.
  • Associativity is different from commutativity: matrix multiplication is associative, but $A B$ and $B A$ can differ.

commutative

Elementary

A way of combining two numbers is commutative if the order of the numbers doesn’t matter, such as $2 + 3 = 3 + 2$.

Undergraduate (abstract algebra)

Consider a set $S$ with a binary operation $\ast$. The operation $\ast$ is commutative if

\[a \ast b = b \ast a \quad \text{for all } a, b \in S.\]
Examples
Non-examples
  • Subtraction $a - b$ on $\reals$
    Subtraction on $\reals$ is not commutative, because $5 - 3 = 2$, but $3 - 5 = -2$.
  • Multiplication of $2 \times 2$ real matrices
    Multiplication of $2 \times 2$ matrices is not commutative, because multiplying the same two matrices in opposite orders can give different products: \[\begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ 1 & 1 \end{bmatrix}, \qquad \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 1 & 2 \end{bmatrix}.\]
Properties
  • Addition and multiplication of real numbers are commutative.
  • Subtraction, division, composition of functions, and multiplication of matrices are not commutative: for example, $5 - 3 = 2$, but $3 - 5 = -2$.
  • A group whose operation is commutative is called abelian.

Examples

Example associative commutative Why
Addition $+$ on $\reals$ ✓✓
Multiplication $\times$ on $\reals$ ✓✓
Multiplication of $2 \times 2$ real matrices ✓✗ Multiplication of $2 \times 2$ matrices shows that an associative operation need not be commutative.
Missing example: average_of_two_numbers
Subtraction $a - b$ on $\reals$ ✗✗

Notes

  • A quick test: in the equation for associativity, $(a \ast b) \ast c = a \ast (b \ast c)$, the letters appear in the same order $a, b, c$ on both sides, and only the parentheses move. In the equation for commutativity, $a \ast b = b \ast a$, there are no parentheses, and the letters trade places.

  • If an operation is both associative and commutative, then the elements of a finite list can be combined in every grouping and every order with the same result, which is why sums such as $\sum_{i=1}^{n} a_i$ need no parentheses.

All distinctions · All definitions