Skip to content

Commutative (abelian): the order of the two operands does not matter

Level: 101 · one row of the table on the laws of an operation, on its own page

One line: Commutativity is the one law that is independent of the other three, so it names a flavour rather than a level: a commutative semigroup, monoid or group is one where a · b = b · a, and the examples that fail it, strings, permutations and matrices, are the ones where order is the whole point.

Laws required

any of the three, plus commutative, of the four on the parent page.

What it is, and the examples

An operation is commutative when a · b = b · a for all a and b. Unlike the other three laws, which stack (every group is a monoid, every monoid a semigroup), commutativity is independent of them: there are commutative semigroups that are not monoids (positive integers under +), non-commutative monoids (strings under concatenation), and non-commutative groups (the permutations of three objects, and invertible matrices). A commutative group is called abelian, after Niels Henrik Abel, and its operation is usually written +.

The program sorts the examples. Commutative: ℤ under + and ×, max, gcd, ∪ and ∩. Not commutative: string concatenation ("ab" ≠ "ba"), composition of permutations (the program finds the pair), and 2 × 2 matrices, where the order of two rotations in space, or of two moves of a Rubik's cube, matters.

Why a separate word: with commutativity the operation table is symmetric about its diagonal, sums can be reordered freely, and ℤ, ℚ, ℝ and ℂ are all abelian under +, which is why the laws of an operation page says the news in a new list is usually the law that is missing. The first structure most people meet where it is missing is matrix multiplication, in linear algebra.

What the program prints

Verified output of structure_commutative.py — regenerated by tools/run_examples.py, never hand-typed.

LAWS REQUIRED: any of the three, plus commutative
   integers under +                       commutative: True
   integers under ×                       commutative: True
   integers under max                     commutative: True
   ℕ under gcd                            commutative: True
   strings under concatenation            commutative: False   witness: 'a' · 'b' ≠ 'b' · 'a'
   permutations of 3 under composition    commutative: False   witness: (0, 2, 1) · (1, 0, 2) ≠ (1, 0, 2) · (0, 2, 1)
   commutativity is independent of the other laws: strings form a monoid and
   permutations a group, and neither is commutative.

Po polsku, w skrócie

Przemienność, a · b = b · a, jest niezależna od pozostałych trzech praw, więc nazywa odmianę, a nie poziom: półgrupa, monoid lub grupa mogą być przemienne albo nie. Grupa przemienna to grupa abelowa, od Nielsa Abela, z działaniem pisanym zwykle jako +. Przemienne: ℤ z + i ×, max, gcd, ∪, ∩. Nieprzemienne: sklejanie napisów, składanie permutacji, mnożenie macierzy; tam kolejność jest całą treścią.

Auf Deutsch: Stichwörter

Kommutativ (abelsch): die Reihenfolge der beiden Operanden ist gleichgültig; die Tafel ist symmetrisch zur Diagonale.

Stichwörter: Kommutativgesetz, abelsche Gruppe, symmetrische Verknüpfungstafel, Gegenbeispiel Matrizen.

See also