This deck builds the algebraic ladder from magma to semigroup to monoid from the ground up, treating closure, associativity, and identity as separate axioms that you must actually check. It targets the misconceptions that closure comes for free, that every operation is associative or commutative, and that an identity element is the same thing as an absorbing element. The free monoid of strings and the monoid of function composition anchor the ideas in computer science.
Subject: Foundations of Higher Mathematics · 122 slides · symbolic lesson
Open the interactive version of this deck · Homework for this lesson
Objectives
This deck builds the first rung of abstract algebra: the ladder from a bare set-with-operation up to a monoid.
By the end you can:
1. Say exactly what a binary operation is, and check that a candidate operation is actually closed.
2. Test associativity and produce a counterexample when it fails.
3. Locate the identity element, prove it is unique, and separate it from an absorbing element.
4. Place a structure on the ladder magma to semigroup to monoid, and recognize the free monoid of strings and the composition monoid.
Warm-up
Discussion prompt
Before we open Binary Operations, Semigroups & Monoids: without looking back, what was the main idea of Cardinality II: Uncountability & the Continuum, and what could you do by the end of it that you could not do before?
Hint: One sentence for the idea, one for the skill. If the second one is blank, that is the part to revisit.
Answer:
That deck covers Cantor's diagonal argument that the reals are uncountable and Cantor's theorem that every set is strictly smaller than its power set, then the cardinal arithmetic of the continuum, the Continuum Hypothesis, and its independence from ZFC. It ends with the collision between set theory and computation: there are only countably many programs but uncountably many reals, so most reals must be uncomputable. It targets the misconceptions that the diagonal number is already in the list, that uncountable simply means infinite, that the Continuum Hypothesis is merely unproven rather than independent, and that a bijection between the line and the plane is impossible.
Concept
Addition takes two numbers and returns a number. Concatenation takes two strings and returns a string. Abstractly, a binary operation is a function that eats an ordered pair from a set and returns a single element of the same set.
\[ \ast : S \times S \longrightarrow S \]
binary operation — A total function from the set of ordered pairs of S back into S. It must be defined for every pair, and the result must land inside S. We write the output of the pair (a, b) in infix form.
\[ \ast(a, b) \;=\; a \ast b \]
Concept
The phrase to internalize is closure: applying the operation to two members of the set never takes you outside the set. This is baked into the codomain being S.
\[ \forall a, b \in S \;:\; a \ast b \in S \]
So when someone hands you a set and a rule, the first question is never assumed: does the rule stay inside the set? If not, it is not a binary operation on that set at all.
Counterexample
Discussion prompt
The phrase to internalize is closure: applying the operation to two members of the set never takes you outside the set. This is baked into the codomain being S.
That is stated as though it always holds. Do one of two things: produce a case where it fails, or say precisely what rules such a case out. "It just does" is not on the menu.
Hint: Hunt at the extremes first — zero, one, negative, empty, equal. If every extreme survives, the reason they survive is the proof.
Picture it
Figure (svg): A 3 by 3 operation table with row and column headers a, b, c and every one of the nine cells filled in.
Discussion prompt
Read the picture before the words. What is this showing, and what is the one thing it is built to make obvious? Commit to an answer, then read on.
Hint: Name the parts, then say what changes between them — and if nothing changes, say what is being held still.
Answer:
For a small finite set, a binary operation is just a fully filled grid: rows indexed by the left input, columns by the right input, and every cell holds the output.
Intuition
For a small finite set, a binary operation is just a fully filled grid: rows indexed by the left input, columns by the right input, and every cell holds the output.
Figure (svg): A 3 by 3 operation table with row and column headers a, b, c and every one of the nine cells filled in.
Closure says every cell contains an element that is also a row and column header. A blank cell, or an entry from outside the set, breaks it.
Analogy
Discussion prompt
Explain Picture the operation as a filled-in table by analogy to something with no Foundations of Higher Mathematics in it at all — a queue, a recipe, a map, a bank balance, whatever fits. Then say where your analogy breaks.
Hint: An analogy that never breaks is not an analogy, it is the same idea wearing a hat. Find the seam — that is the part that is actually new.
Answer:
For a small finite set, a binary operation is just a fully filled grid: rows indexed by the left input, columns by the right input, and every cell holds the output.
Ranking
Put in order
Put the moves of Worked example: is subtraction an operation on the naturals? into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. A binary operation must return an element of the same set for every pair.
Worked example
Take the natural numbers (here starting at 0) with ordinary subtraction as the candidate rule. Is it a binary operation on that set?
Write the closure requirement
Why: A binary operation must return an element of the same set for every pair.
\[ \forall a, b \in \mathbb{N} \;:\; a - b \in \mathbb{N} \;? \]
Probe a pair where the left input is smaller
Why: To break a universal claim you only need one counterexample; small minus large is the danger zone.
\[ 3 - 5 \;=\; -2 \;\notin\; \mathbb{N} \]
Conclude it is not closed on the naturals
Why: One pair escaped the set, so the rule is not a function into the naturals.
Subtraction is a binary operation on the integers, where the result always stays inside. The set you choose is part of the claim.
Verify the fix on the integers
Why: Check the boundary case again in the larger set to confirm closure is restored.
\[ 3 - 5 = -2 \in \mathbb{Z}, \quad 5 - 3 = 2 \in \mathbb{Z} \]
Picture it
Animation
Shows: Each line of the worked example "is subtraction an operation on the naturals?", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check the boundary case again in the larger set to confirm closure is restored.
Anomaly
Predict first
A student writes this, and it looks reasonable:
A strong student reads the naturals under subtraction and starts checking associativity, quietly assuming the operation is well defined.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: This treats closure as automatic, which is the whole error.
Check closure first, always. It is the entry ticket.
Why: This treats closure as automatic, which is the whole error.
Trap
A strong student reads the naturals under subtraction and starts checking associativity, quietly assuming the operation is well defined.
Skip straight to associativity
Why: This treats closure as automatic, which is the whole error.
\[ (a - b) - c \;\overset{?}{=}\; a - (b - c) \]
But the structure was already dead on arrival: subtraction leaves the naturals, so there is nothing to check.
Check closure first, always. It is the entry ticket.
Test membership of the output for a bad pair
Why: Closure is a universal statement, so one escaping pair settles it.
\[ 0 - 1 = -1 \notin \mathbb{N} \]
Verdict: not even a magma on the naturals. Only after closure passes do the deeper axioms become meaningful questions.
Notation
Annotate
From Trap: assuming closure comes for free — read this one piece at a time. What is each part doing?
On: \( (a - b) - c \;\overset{?}{=}\; a - (b - c) \)
Concept
We use a neutral star for a generic operation so nothing carries over from arithmetic. It might be addition, multiplication, concatenation, composition, maximum, or something exotic.
\[ a \ast b, \qquad a \cdot b, \qquad ab \]
Juxtaposition (writing ab) is the common shorthand once the operation is fixed. None of the familiar laws of numbers are assumed; each must be proved or refuted for the specific operation.
Explain it
Discussion prompt
Explain Notation: the operation is abstract, the symbol is a placeholder to a student a year behind you. No notation, no jargon they have not met — and it still has to be true.
Hint: If your explanation needs a symbol they have never seen, you are describing the notation rather than the idea.
Answer:
We use a neutral star for a generic operation so nothing carries over from arithmetic. It might be addition, multiplication, concatenation, composition, maximum, or something exotic.
Concept
Associativity is the law that lets you drop parentheses. It says the two ways of folding three inputs agree.
\[ \forall a, b, c \in S \;:\; (a \ast b) \ast c \;=\; a \ast (b \ast c) \]
It is a statement about grouping, not order. It never lets you swap inputs; it only lets you rebracket them.
Intuition
With associativity a long chain has an unambiguous value no matter how you parenthesize it, so you can write it with no brackets at all.
\[ a \ast b \ast c \ast d \]
For a programmer this is exactly what makes a fold or reduce well defined and safe to run in parallel: you can split the chain anywhere and combine the pieces. Without it, the grouping you pick changes the answer.
Step zero
Discussion prompt
Worked example: subtraction on the integers is not associative — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Write both bracketings for a concrete triple
Answer:
Worked example
Subtraction is closed on the integers, so it is a legitimate binary operation there. Is it associative?
Write both bracketings for a concrete triple
Why: One triple where the two sides differ refutes the universal law.
\[ (8 - 4) - 2 \quad\text{versus}\quad 8 - (4 - 2) \]
Evaluate the left grouping
Why: Innermost bracket first.
\[ (8 - 4) - 2 = 4 - 2 = 2 \]
Evaluate the right grouping
Why: The inner bracket is now on the right pair.
\[ 8 - (4 - 2) = 8 - 2 = 6 \]
Verify the two results disagree
Why: Two equals four minus two on the left but six on the right; a single counterexample is enough.
\[ 2 \neq 6 \;\Longrightarrow\; \text{subtraction is not associative} \]
Picture it
Animation
Shows: Each line of the worked example "subtraction on the integers is not associative", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Two equals four minus two on the left but six on the right; a single counterexample is enough.
Estimation
Predict first
On the rationals define the operation that returns the midpoint of its two inputs. It is closed and commutative. Is it associative?
Commit before you compute: what does Worked example: the averaging operation is not associative come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify the counterexample
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. Four versus two on the same triple confirms non-associativity directly.
Worked example
On the rationals define the operation that returns the midpoint of its two inputs. It is closed and commutative. Is it associative?
\[ a \ast b \;=\; \frac{a + b}{2} \]
Compute the left grouping on a test triple
Why: Take an easy triple to expose the asymmetry in weighting.
\[ (0 \ast 0) \ast 8 = 0 \ast 8 = \frac{0 + 8}{2} = 4 \]
Compute the right grouping
Why: The same three inputs, regrouped to the right.
\[ 0 \ast (0 \ast 8) = 0 \ast 4 = \frac{0 + 4}{2} = 2 \]
See why it fails structurally
Why: Averaging weights the earlier inputs less each time it is nested, so grouping shifts the weights.
\[ (a \ast b) \ast c = \tfrac{a}{4} + \tfrac{b}{4} + \tfrac{c}{2} \]
Verify the counterexample
Why: Four versus two on the same triple confirms non-associativity directly.
\[ 4 \neq 2 \;\Longrightarrow\; \text{averaging is not associative} \]
Picture it
Animation
Shows: Each line of the worked example "the averaging operation is not associative", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Four versus two on the same triple confirms non-associativity directly.
Trap
Because plus and times are associative, it is tempting to treat associativity as a property operations just have.
So a student writes a bracket-free chain for subtraction or exponentiation and evaluates left to right without justification.
\[ a - b - c - d, \qquad a \wedge b \wedge c \]
The written expression is ambiguous for these operations, and different groupings give different numbers.
Associativity is a property to be proved, and many everyday operations lack it: subtraction, division, averaging, exponentiation.
Keep the brackets until associativity is established
Why: Only an associativity proof licenses dropping them.
\[ 2^{(2^{3})} = 2^{8} = 256 \;\neq\; (2^{2})^{3} = 4^{3} = 64 \]
Verified: exponentiation gives 256 one way and 64 the other, so the unbracketed tower is meaningless.
Break the constraint
Discussion prompt
The rule this trap just fixed:
Only an associativity proof licenses dropping them.
Now break it on purpose. Build a case that violates it and follow the consequences until something visibly fails. Where does the failure first show up — and would you have noticed it if you had not been looking?
Hint: The dangerous rules are the ones whose violation still produces an answer. If yours fails loudly, try to find one that fails quietly.
Concept
Now we name the ladder. A set with a single closed binary operation, and nothing else required, is a magma.
magma — A set S together with a binary operation on S. The only axiom is closure. No associativity, no identity.
semigroup — A magma whose operation is associative. Closure plus associativity, and nothing more.
\[ \text{magma} \;\xrightarrow{\;+\text{ associativity}\;}\; \text{semigroup} \]
Definition probe
Sort into buckets
Every line below is part of the definition of binary operation or of magma — one or the other, never both. Put each where it belongs.
Concept
The next rung asks for a special element that does nothing when combined with anything. Combining it on either side returns the other input untouched.
\[ e \ast a \;=\; a \;=\; a \ast e \qquad \text{for all } a \in S \]
identity element — A two-sided identity e is an element satisfying e * a = a and a * e = a for every a in S. It is the do-nothing element of the operation.
Concept
The identity axiom has two halves, and they can come apart. An element might do nothing from the left but change things from the right, or the reverse.
\[ e_L \ast a = a \;\;(\text{left identity}), \qquad a \ast e_R = a \;\;(\text{right identity}) \]
Only when a single element is both a left and a right identity do we call it the identity. That two-sidedness is what the monoid axiom demands.
Intuition
A merely one-sided identity is fragile: it only helps you cancel from one direction, and an operation can even have many left identities at once while having no right identity.
A two-sided identity, by contrast, is unique the moment it exists. That uniqueness is what lets us speak of the neutral element and build everything above it, including inverses in the next deck.
Missing information
Discussion prompt
On the nonzero rationals, take division as the operation. It is closed. Does it have an identity?
What do you need to know — or decide — before the first line can be written? List everything the problem has to hand you.
Hint: Anything you would have to invent to get started is a thing the problem must supply.
Answer:
A right identity must satisfy a divided by it equals a.
Worked example
On the nonzero rationals, take division as the operation. It is closed. Does it have an identity?
Test the right side with the candidate 1
Why: A right identity must satisfy a divided by it equals a.
\[ a \div 1 = a \quad \text{for all } a \Rightarrow 1 \text{ is a right identity} \]
Now test 1 on the left
Why: A two-sided identity would also fix a from the left.
\[ 1 \div a = \tfrac{1}{a} \neq a \quad\text{unless } a = 1 \]
Search for any left identity
Why: A left identity e would need e divided by a to equal a for every a, forcing e to depend on a, which is impossible.
\[ e \div a = a \Rightarrow e = a^{2} \;\text{depends on } a \]
Verify the asymmetry on a number
Why: Plug in a equals 2: right side fixes it, left side does not, confirming there is no two-sided identity.
\[ 2 \div 1 = 2, \qquad 1 \div 2 = \tfrac{1}{2} \neq 2 \]
Picture it
Animation
Shows: Each line of the worked example "division has a right identity but no left identity", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Plug in a equals 2: right side fixes it, left side does not, confirming there is no two-sided identity.
Worked example
Claim: in any magma, if a two-sided identity exists, there is exactly one. This is why we may say the identity.
Assume two identities and combine them
Why: Suppose e and f are both two-sided identities; look at the single product e times f.
\[ e, f \text{ both satisfy } x \ast a = a = a \ast x \]
Read the product using f as an identity
Why: Because f is an identity, combining it on the right of e leaves e unchanged.
\[ e \ast f = e \]
Read the same product using e as an identity
Why: Because e is an identity, combining it on the left of f leaves f unchanged.
\[ e \ast f = f \]
Verify the two readings force equality
Why: The same element e times f equals both e and f, so e equals f; uniqueness holds, and no associativity was even needed.
\[ e = e \ast f = f \;\Longrightarrow\; e = f \]
Concept
Now the top rung of this deck. Add a two-sided identity to a semigroup and you have a monoid.
monoid — A set with a binary operation that is (1) closed, (2) associative, and (3) has a two-sided identity element. Three axioms, each independently checkable.
\[ \text{semigroup} \;\xrightarrow{\;+\text{ identity}\;}\; \text{monoid} \]
Intuition
Each step up the ladder adds exactly one requirement. Nothing is inherited automatically; you earn each rung with a proof.
Figure (svg): A ladder of four levels: magma with closure, semigroup adds associativity, monoid adds identity, group adds inverses, each level a box stacked above the previous.
This deck lives on the bottom three boxes. The next deck adds inverses to reach a group.
Fill the middle
Fill in the blanks
From Worked example: is the integers under a special rule a… — finish the line. Write what belongs on the right of the equals sign before you look.
a \ast b = a + b - ab
Why: Producing the right-hand side unprompted is the difference between recognising this line and being able to use it. Sums and products of integers are integers, so the output is always an integer.
Worked example
On the integers define a new operation and decide whether it is a monoid.
\[ a \ast b = a + b - ab \]
Closure is immediate
Why: Sums and products of integers are integers, so the output is always an integer.
\[ a + b - ab \in \mathbb{Z} \]
Find the identity by solving the identity equation
Why: Require a star e equals a and solve for e independent of a.
\[ a + e - ae = a \Rightarrow e(1 - a) = 0 \;\forall a \Rightarrow e = 0 \]
Confirm associativity by expanding both groupings
Why: Both bracketings expand to the same symmetric polynomial.
\[ (a \ast b)\ast c = a+b+c-ab-ac-bc+abc = a \ast (b \ast c) \]
Verify identity and associativity on numbers
Why: Check e equals 0 does nothing and a sample triple associates.
\[ 5 \ast 0 = 5, \quad (1\ast 2)\ast 3 = 1 = 1 \ast(2 \ast 3) \]
Picture it
Animation
Shows: Each line of the worked example "is the integers under a special rule a monoid?", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check e equals 0 does nothing and a sample triple associates.
Concept
Some monoids also contain an element that swallows everything it touches, returning itself no matter the partner. This is an absorbing or zero element.
\[ z \ast a = z = a \ast z \qquad \text{for all } a \in S \]
absorbing (zero) element — An element z such that combining it with anything returns z. It is the opposite of the identity: the identity preserves its partner, the absorber destroys it.
Matching
Match the pairs
Match each term to the definition this lesson gave it — not the one you would guess from the word.
Why: These are the working definitions of magma, semigroup, identity element, monoid, absorbing (zero) element as Binary Operations, Semigroups & Monoids uses them. Pairing them correctly is the test of whether you could state each one with the slide switched off.
Anomaly
Predict first
A student writes this, and it looks reasonable:
In ordinary multiplication a student points to 0 and calls it special, then blurs it together with the identity.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: This confuses does nothing with swallows everything.
Keep the two roles apart: the identity preserves, the absorber destroys.
Why: This confuses does nothing with swallows everything.
Trap
In ordinary multiplication a student points to 0 and calls it special, then blurs it together with the identity.
Claim 0 behaves like the neutral element
Why: This confuses does nothing with swallows everything.
\[ 0 \ast a \overset{?}{=} a \]
But zero times anything is zero, not the partner. Zero is the absorber; treating it as neutral corrupts every later computation.
Keep the two roles apart: the identity preserves, the absorber destroys.
State both roles side by side in the multiplicative monoid
Why: One is neutral, the other is absorbing; they are never the same element in a nontrivial monoid.
\[ 1 \ast a = a \;(\text{identity}), \qquad 0 \ast a = 0 \;(\text{absorber}) \]
Verified: 1 keeps a, 0 kills a. In a monoid with more than one element the identity and an absorber are always distinct.
Translation
\( 0 \ast a \overset{?}{=} a \)
Draw it
Translate both ways. First write the expression above as a sentence with no symbols in it at all. Then cover it, and write your sentence back as notation. If the two versions disagree, the disagreement is the thing to fix.
Step zero
Discussion prompt
Worked example: the naturals under addition form a monoid — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Associativity
Answer:
Worked example
Confirm the most familiar monoid rung by rung.
Closure
Why: The sum of two naturals is a natural.
\[ a + b \in \mathbb{N} \]
Associativity
Why: Addition of naturals regroups freely, a standard fact of arithmetic.
\[ (a + b) + c = a + (b + c) \]
Identity is 0
Why: Adding zero on either side changes nothing.
\[ 0 + a = a = a + 0 \]
Verify on a value
Why: Check the identity concretely and note it is also commutative.
\[ 0 + 7 = 7 = 7 + 0 \]
Picture it
Animation
Shows: Each line of the worked example "the naturals under addition form a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check the identity concretely and note it is also commutative.
Worked example
Same set, different operation, a different identity.
Closure and associativity
Why: Products of naturals are naturals and multiplication regroups freely.
\[ ab \in \mathbb{N}, \quad (ab)c = a(bc) \]
Identity is 1, not 0
Why: Multiplying by 1 preserves; multiplying by 0 absorbs.
\[ 1 \cdot a = a, \qquad 0 \cdot a = 0 \]
Verify the identity and spot the absorber
Why: Confirm 1 is neutral and 0 is the absorbing element of this monoid.
\[ 1 \cdot 9 = 9, \qquad 0 \cdot 9 = 0 \]
Picture it
Animation
Shows: Each line of the worked example "the naturals under multiplication form a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Confirm 1 is neutral and 0 is the absorbing element of this monoid.
Concept
None of magma, semigroup, or monoid requires the inputs to be swappable. When an operation happens to be symmetric in its two arguments, we flag it separately.
\[ a \ast b = b \ast a \qquad \text{for all } a, b \]
commutative monoid — A monoid whose operation also satisfies a * b = b * a for all elements. Addition on the naturals is commutative; string concatenation and matrix multiplication are not.
Intuition
Associativity is about grouping; commutativity is about order. They are independent: an operation can have either, both, or neither.
Matrix multiplication is associative but not commutative. The midpoint operation is commutative but not associative. Addition is both. Subtraction is neither.
Anomaly
Predict first
A student writes this, and it looks reasonable:
A student proves a fact about a monoid and freely swaps ab for ba mid-argument.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: This assumes commutativity, which the monoid axioms never grant.
Only swap order if you have proved the operation is commutative. Otherwise preserve it.
Why: This assumes commutativity, which the monoid axioms never grant.
Trap
A student proves a fact about a monoid and freely swaps ab for ba mid-argument.
Rewrite a product in the opposite order
Why: This assumes commutativity, which the monoid axioms never grant.
\[ AB \overset{?}{=} BA \]
For matrices this is generally false, so the argument collapses.
Only swap order if you have proved the operation is commutative. Otherwise preserve it.
Exhibit a non-commuting pair of matrices
Why: A single counterexample shows the swap is illegal in a general monoid.
\[ \begin{pmatrix}1&1\\0&1\end{pmatrix}\begin{pmatrix}1&0\\1&1\end{pmatrix} = \begin{pmatrix}2&1\\1&1\end{pmatrix}, \;\; \begin{pmatrix}1&0\\1&1\end{pmatrix}\begin{pmatrix}1&1\\0&1\end{pmatrix} = \begin{pmatrix}1&1\\1&2\end{pmatrix} \]
Verified: the two products differ, so order matters in this monoid.
Notation
Annotate
From Trap: silently assuming commutativity — read this one piece at a time. What is each part doing?
On: \( AB \overset{?}{=} BA \)
Concept
A separate flavor of element repeats harmlessly: combining it with itself gives it back. These are idempotent.
\[ a \ast a = a \]
The identity is always idempotent, but in operations like set union or logical and, every element is idempotent. Idempotence is the algebraic signature of absorb duplicates.
Intuition
Setting a flag you have already set changes nothing. Inserting an element already in a set changes nothing. Taking the maximum of a value with itself changes nothing.
That applying it again is free property is exactly idempotence, and it is why retries and re-runs of such operations are safe.
Hypothesis
Predict first
Worked example: the power set under union is a monoid is about to be worked. State your hypothesis first: which rule or definition decides this one, and what is the first move it forces? Then watch whether the example agrees with you.
Correct: Closure and associativity
Why: A union of subsets of X is a subset of X, and union regroups freely.
A hypothesis you wrote down is falsifiable; a vague sense of how it will go is not. If the example opens somewhere else, that gap is the thing worth chasing.
Worked example
Fix a set and take all its subsets, with union as the operation.
\[ (\,\mathcal{P}(X),\, \cup\,) \]
Closure and associativity
Why: A union of subsets of X is a subset of X, and union regroups freely.
\[ A \cup B \subseteq X, \quad (A \cup B)\cup C = A \cup (B \cup C) \]
Identify the identity
Why: Unioning with the empty set adds nothing.
\[ \varnothing \cup A = A = A \cup \varnothing \]
Verify identity and idempotence on a concrete set
Why: Check the empty set is neutral and every element repeats harmlessly.
\[ \varnothing \cup \{1,2\} = \{1,2\}, \quad \{1,2\}\cup\{1,2\} = \{1,2\} \]
Picture it
Animation
Shows: Each line of the worked example "the power set under union is a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check the empty set is neutral and every element repeats harmlessly.
Ranking
Put in order
Put the moves of Worked example: the power set under intersection is a monoid into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. An intersection of subsets of X is a subset of X and intersection regroups freely.
Worked example
Same subsets, now with intersection. The identity flips to the other extreme.
Closure and associativity
Why: An intersection of subsets of X is a subset of X and intersection regroups freely.
\[ A \cap B \subseteq X, \quad (A \cap B)\cap C = A \cap (B \cap C) \]
Identify the identity as the whole set
Why: Intersecting with the full ground set keeps everything.
\[ X \cap A = A = A \cap X \]
Verify identity and note the absorber
Why: The whole set is neutral, the empty set is absorbing, mirroring one and zero in multiplication.
\[ X \cap \{1\} = \{1\}, \qquad \varnothing \cap \{1\} = \varnothing \]
Picture it
Animation
Shows: Each line of the worked example "the power set under intersection is a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The whole set is neutral, the empty set is absorbing, mirroring one and zero in multiplication.
Estimation
Predict first
The two-element set of truth values gives two commutative monoids, dual to each other.
Commit before you compute: what does Worked example: the booleans under AND and under OR come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify neutrality on both values
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. Check true is neutral for and, false is neutral for or, on each input.
Worked example
The two-element set of truth values gives two commutative monoids, dual to each other.
Under logical and, the identity is true
Why: True and p returns p, so true does nothing; false is the absorber.
\[ \top \wedge p = p, \qquad \bot \wedge p = \bot \]
Under logical or, the identity is false
Why: False or p returns p, so false does nothing; true is the absorber.
\[ \bot \vee p = p, \qquad \top \vee p = \top \]
Verify neutrality on both values
Why: Check true is neutral for and, false is neutral for or, on each input.
\[ \top \wedge \bot = \bot, \quad \top \wedge \top = \top, \quad \bot \vee \top = \top \]
Picture it
Animation
Shows: Each line of the worked example "the booleans under AND and under OR", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check true is neutral for and, false is neutral for or, on each input.
Concept
The monoid a computer scientist meets first is strings. Fix an alphabet, and let the elements be all finite strings over it. The operation is concatenation: glue the second string onto the end of the first.
\[ u = ab, \; v = ba \;\Longrightarrow\; u \cdot v = abba \]
free monoid — The set of all finite strings over an alphabet, with concatenation as the operation and the empty string as the identity. Free means the only equations that hold are those forced by the monoid axioms.
Intuition
Concatenating the empty string onto either end of a word leaves the word exactly as it was. That is precisely the identity axiom, made of text.
\[ \varepsilon \cdot w = w = w \cdot \varepsilon \]
The empty string is easy to forget, but without it strings would be only a semigroup. It is the reason concatenation reaches the monoid rung.
Fill the middle
Fill in the blanks
From Worked example: strings under concatenation form a monoid — finish the line. Write what belongs on the right of the equals sign before you look.
(u \cdot v)\cdot w = u \cdot (v \cdot w)
Why: Producing the right-hand side unprompted is the difference between recognising this line and being able to use it. Gluing two finite strings yields a finite string over the same alphabet.
Worked example
Verify the three axioms for the free monoid on an alphabet.
Closure
Why: Gluing two finite strings yields a finite string over the same alphabet.
\[ u, v \in \Sigma^{*} \Rightarrow u \cdot v \in \Sigma^{*} \]
Associativity
Why: Concatenation only records the order of symbols, and regrouping does not change that order.
\[ (u \cdot v)\cdot w = u \cdot (v \cdot w) \]
Identity is the empty string
Why: Adding no symbols on either side changes nothing.
\[ \varepsilon \cdot w = w = w \cdot \varepsilon \]
Verify on concrete words
Why: Check associativity and the empty-string identity on short strings.
\[ (ab \cdot c)\cdot d = abcd = ab \cdot (c \cdot d), \quad \varepsilon \cdot ab = ab \]
Picture it
Animation
Shows: Each line of the worked example "strings under concatenation form a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check associativity and the empty-string identity on short strings.
Concept
The notation for all finite strings over the alphabet is the alphabet with a star. It collects strings of every length, including the length-zero empty string.
\[ \Sigma^{*} = \bigcup_{n \ge 0} \Sigma^{n} = \{\varepsilon\} \cup \Sigma \cup \Sigma^{2} \cup \cdots \]
Free has a precise meaning: every element is a unique sequence of alphabet symbols, so no surprise equations hold. This universal, relation-free quality is what makes it the model monoid.
Anomaly
Predict first
A student writes this, and it looks reasonable:
Because addition of lengths commutes, a student assumes the strings themselves commute.
It is wrong. Say what breaks — and say it before you turn the page.
Correct: This assumes concatenation is commutative, which it is not.
The free monoid is non-commutative for any alphabet with at least two symbols. Keep the order.
Why: This assumes concatenation is commutative, which it is not.
Trap
Because addition of lengths commutes, a student assumes the strings themselves commute.
Swap the order of two words
Why: This assumes concatenation is commutative, which it is not.
\[ ab \cdot ba \overset{?}{=} ba \cdot ab \]
The two gluings produce different strings, so the swap is invalid.
The free monoid is non-commutative for any alphabet with at least two symbols. Keep the order.
Compute both orders explicitly
Why: A single differing pair proves non-commutativity.
\[ ab \cdot ba = abba \;\neq\; baab = ba \cdot ab \]
Verified: abba is not baab. Length is the same but the strings differ, which is exactly why length forgets information.
Two truths and a lie
Sort into buckets
Some of these hold up and some are the exact mistakes this lesson is built to prevent. Sort them.
the naturals under subtraction and starts checking associativity, quietly assuming the operation is well defined.; Because plus and times are associative, it is tempting to treat associativity as a property operations just have.Concept
Once you have two monoids, you ask which maps respect their operations. A homomorphism sends products to products and identity to identity.
\[ \varphi(a \ast b) = \varphi(a) \star \varphi(b), \qquad \varphi(e_M) = e_N \]
monoid homomorphism — A function between monoids that carries the operation of the source to the operation of the target and sends the source identity to the target identity. It preserves the algebraic shape while possibly forgetting detail.
Intuition
Think of it as translating between two worlds so that combine, then translate always equals translate, then combine. The diagram commutes.
It may forget information (many inputs can map to the same output), but it never distorts the operation. This single idea returns for groups, rings, and vector spaces as the definition of a well-behaved map.
Step zero
Discussion prompt
Worked example: length is a monoid homomorphism — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Check the operation is preserved
Answer:
Worked example
Map each string to its number of symbols, sending the free monoid to the naturals under addition.
\[ \operatorname{len} : (\Sigma^{*}, \cdot, \varepsilon) \longrightarrow (\mathbb{N}, +, 0) \]
Check the operation is preserved
Why: The length of a concatenation is the sum of the lengths, so products go to products.
\[ \operatorname{len}(u \cdot v) = \operatorname{len}(u) + \operatorname{len}(v) \]
Check the identity is preserved
Why: The empty string has length zero, the identity of the target.
\[ \operatorname{len}(\varepsilon) = 0 \]
Verify both laws on a concrete pair
Why: Confirm the length of a glued word equals the sum of the pieces.
\[ \operatorname{len}(ab \cdot cde) = 5 = 2 + 3 = \operatorname{len}(ab) + \operatorname{len}(cde) \]
Picture it
Animation
Shows: Each line of the worked example "length is a monoid homomorphism", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: The length of a concatenation is the sum of the lengths, so products go to products.
Concept
Take all functions from a fixed set to itself, with composition as the operation. This is the monoid that secretly underlies most of computing: state transformers, string rewriters, and pipelines all live here.
\[ \operatorname{End}(X) = \{\, f : X \to X \,\}, \qquad (f \circ g)(x) = f(g(x)) \]
endomorphism monoid — The set of all self-maps of X under composition. It is a monoid for every X, with the identity function as its identity element, and it is non-commutative once X has at least two elements.
Intuition
Applying one transformation after another is itself a transformation, so composition is a genuine binary operation on self-maps. Chaining is associative because it just records do this, then that.
The do-nothing transformation, the identity map that returns its input unchanged, is the neutral element. Running it before or after any pipeline leaves the pipeline untouched.
Explain it
Discussion prompt
Explain Composition is the operation; the identity map does nothing to a student a year behind you. No notation, no jargon they have not met — and it still has to be true.
Hint: If your explanation needs a symbol they have never seen, you are describing the notation rather than the idea.
Answer:
Applying one transformation after another is itself a transformation, so composition is a genuine binary operation on self-maps. Chaining is associative because it just records do this, then that.
Worked example
Check the three axioms for composition on the self-maps of a set.
Closure
Why: The composite of two self-maps of X is again a self-map of X.
\[ f, g : X \to X \Rightarrow f \circ g : X \to X \]
Associativity
Why: Composition of functions is always associative because both sides send x to f(g(h(x))).
\[ (f \circ g)\circ h = f \circ (g \circ h) \]
Identity is the identity map
Why: Composing with the map that returns its input changes nothing.
\[ \mathrm{id}_X \circ f = f = f \circ \mathrm{id}_X \]
Verify the identity on a sample map
Why: Take f with f of 1 equal to 2 on a small set and confirm the identity map leaves it unchanged.
\[ (\mathrm{id}_X \circ f)(1) = \mathrm{id}_X(f(1)) = f(1) = 2 \]
Picture it
Animation
Shows: Each line of the worked example "self-maps under composition form a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Take f with f of 1 equal to 2 on a small set and confirm the identity map leaves it unchanged.
Fill the middle
Fill in the blanks
From Worked example: square matrices under multiplication form a… — finish the line. Write what belongs on the right of the equals sign before you look.
A, B \in M_n(\mathbbA(BC)) \Rightarrow AB \in M_n(\mathbb___), \quad (AB)C = ___
Why: Producing the right-hand side unprompted is the difference between recognising this line and being able to use it. A product of two n by n matrices is n by n, and matrix multiplication is associative.
Worked example
Fix a size and take all square matrices of that size over the reals, with matrix multiplication.
Closure and associativity
Why: A product of two n by n matrices is n by n, and matrix multiplication is associative.
\[ A, B \in M_n(\mathbb{R}) \Rightarrow AB \in M_n(\mathbb{R}), \quad (AB)C = A(BC) \]
Identity is the identity matrix
Why: Multiplying by the identity matrix on either side returns the original matrix.
\[ I_n A = A = A I_n \]
Note it is not commutative and not a group
Why: Order matters, and singular matrices have no inverse, so this is a monoid but not a group.
Verify the identity on a concrete matrix
Why: Multiply a sample two by two matrix by the identity and recover it.
\[ \begin{pmatrix}1&2\\3&4\end{pmatrix}\begin{pmatrix}1&0\\0&1\end{pmatrix} = \begin{pmatrix}1&2\\3&4\end{pmatrix} \]
Picture it
Animation
Shows: Each line of the worked example "square matrices under multiplication form a monoid", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Multiply a sample two by two matrix by the identity and recover it.
Missing information
Discussion prompt
Take the residue classes modulo a fixed n with addition carried out modulo n. Use n equal to 5 as the running case.
What do you need to know — or decide — before the first line can be written? List everything the problem has to hand you.
Hint: Anything you would have to invent to get started is a thing the problem must supply.
Answer:
Reducing a sum modulo n stays in the residue set, and addition inherits associativity.
Worked example
Take the residue classes modulo a fixed n with addition carried out modulo n. Use n equal to 5 as the running case.
\[ \mathbb{Z}/5\mathbb{Z} = \{0,1,2,3,4\} \]
Closure and associativity
Why: Reducing a sum modulo n stays in the residue set, and addition inherits associativity.
\[ (a + b) \bmod n \in \mathbb{Z}/n\mathbb{Z} \]
Identity is 0
Why: Adding the class of 0 changes nothing.
\[ 0 + a \equiv a \pmod{n} \]
Verify closure and identity modulo 5
Why: Check a sum wraps back into the set and that 0 is neutral.
\[ 3 + 4 = 7 \equiv 2 \pmod 5, \qquad 0 + 3 = 3 \]
Picture it
Animation
Shows: Each line of the worked example "integers modulo n under addition", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check a sum wraps back into the set and that 0 is neutral.
Concept
A subset can be a monoid in its own right, using the same operation, provided it holds together. It must contain the identity and be closed.
\[ e \in T \quad\text{and}\quad a, b \in T \Rightarrow a \ast b \in T \]
submonoid — A subset of a monoid that contains the identity element and is closed under the operation. Associativity is inherited automatically, so only these two conditions need checking.
Analogy
Discussion prompt
Explain A submonoid is a monoid living inside a monoid by analogy to something with no Foundations of Higher Mathematics in it at all — a queue, a recipe, a map, a bank balance, whatever fits. Then say where your analogy breaks.
Hint: An analogy that never breaks is not an analogy, it is the same idea wearing a hat. Find the seam — that is the part that is actually new.
Answer:
A subset can be a monoid in its own right, using the same operation, provided it holds together. It must contain the identity and be closed.
Estimation
Predict first
Inside the monoid of naturals under addition, take just the even numbers.
Commit before you compute: what does Worked example: the even naturals are a submonoid of… come out to? A rough magnitude and the right form is enough — the point is to have something concrete to be wrong about.
Correct: Verify with a concrete sum
Why: A prediction you can defend turns the computation into a check rather than a leap of faith — and an answer that contradicts it is caught on the spot. Check that 0 is inside and a sample sum of evens is even.
Worked example
Inside the monoid of naturals under addition, take just the even numbers.
\[ E = \{0, 2, 4, 6, \dots\} \]
Contains the identity
Why: Zero is even, so the identity of the parent monoid is present.
\[ 0 \in E \]
Closed under addition
Why: A sum of two even numbers is even, so the subset does not leak.
\[ 2m + 2k = 2(m + k) \in E \]
Verify with a concrete sum
Why: Check that 0 is inside and a sample sum of evens is even.
\[ 2 + 4 = 6 \in E, \qquad 0 \in E \]
Picture it
Animation
Shows: Each line of the worked example "the even naturals are a submonoid of addition", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check that 0 is inside and a sample sum of evens is even.
Step zero
Discussion prompt
Worked example: the naturals under maximum — before any calculation: what is the plan? Name the moves in order, in plain English, without doing the arithmetic.
Hint: It starts with: Closure, associativity, commutativity
Answer:
Worked example
Take the naturals with the operation that returns the larger of two inputs.
Closure, associativity, commutativity
Why: The maximum of naturals is a natural, and taking maxima regroups and reorders freely.
\[ \max(\max(a,b),c) = \max(a,\max(b,c)) \]
Find the identity
Why: The identity must not raise any value, so it is the least element.
\[ \max(a, 0) = a \Rightarrow e = 0 \]
Verify the identity and a non-trivial max
Why: Check that 0 is neutral and that maximum genuinely selects the larger input.
\[ \max(3, 0) = 3, \qquad \max(3, 5) = 5 \]
Picture it
Animation
Shows: Each line of the worked example "the naturals under maximum", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Check that 0 is neutral and that maximum genuinely selects the larger input.
Ranking
Put in order
Put the moves of Worked example: positive integers under gcd stop at semigroup into the order they have to happen.
Why: These are the moves of the worked example in the order it makes them, and each one is set up by the one before it. The gcd of positive integers is a positive integer, and gcd is associative and commutative.
Worked example
Take the positive integers with the greatest common divisor as the operation. How high up the ladder does it climb?
Closure and associativity
Why: The gcd of positive integers is a positive integer, and gcd is associative and commutative.
\[ \gcd(\gcd(a,b),c) = \gcd(a,\gcd(b,c)) \]
Hunt for an identity
Why: An identity e would need gcd of a and e to return a for every a, forcing e to be a multiple of every positive integer.
\[ \gcd(a, e) = a \;\forall a \Rightarrow a \mid e \;\forall a \]
See why no such positive integer exists
Why: No positive integer is divisible by every positive integer, so there is no identity; the candidate 1 fails at once.
\[ \gcd(a, 1) = 1 \neq a \quad (a \ge 2) \]
Verify the classification
Why: Closure and associativity hold but no identity exists, so this is a commutative semigroup that is not a monoid.
\[ \gcd(6, 1) = 1 \neq 6 \Rightarrow \text{no identity} \]
Picture it
Animation
Shows: Each line of the worked example "positive integers under gcd stop at semigroup", appearing one at a time.
The same working the example does, in the order a tutor would write it.
Takeaway: Closure and associativity hold but no identity exists, so this is a commutative semigroup that is not a monoid.
Concept
The reason monoids matter to a programmer: a monoid is precisely the structure you can fold or reduce a list with. Associativity lets you split the list anywhere, and the identity handles the empty list.
\[ \operatorname{fold}(\ast, e, [a_1, a_2, \dots, a_k]) = a_1 \ast a_2 \ast \cdots \ast a_k \]
Sum, product, string concatenation, maximum, and set union are all folds over their monoid. Associativity is exactly what makes the parallel or chunked version give the same answer as the sequential one.
Intuition
Folding an empty list has to return something, and the only sensible choice is the identity: nothing combined is the do-nothing element.
The empty sum is 0, the empty product is 1, the empty concatenation is the empty string, and the empty union is the empty set. Each is that monoid's identity. This is why the identity is not optional decoration but the base case of every accumulation.
Counterexample
Discussion prompt
Folding an empty list has to return something, and the only sensible choice is the identity: nothing combined is the do-nothing element.
That is stated as though it always holds. Do one of two things: produce a case where it fails, or say precisely what rules such a case out. "It just does" is not on the menu.
Hint: Hunt at the extremes first — zero, one, negative, empty, equal. If every extreme survives, the reason they survive is the proof.
Concept
Collecting the running examples makes the three axioms concrete. Read each row as does it clear closure, associativity, identity?
| set and operation | highest rung | identity |
|---|---|---|
| naturals, subtraction | not even a magma | none |
| integers, subtraction | magma only | none (not associative) |
| positive integers, gcd | commutative semigroup | none |
| naturals, addition | commutative monoid | 0 |
| strings, concatenation | monoid (non-commutative) | empty string |
| self-maps, composition | monoid (non-commutative) | identity map |
The pattern to carry forward: closure is the gate, associativity is the workhorse, and the identity is the base case. A group, in the next deck, adds inverses on top of all three.
Comparison
Comparison matrix
From The zoo, sorted by how far up the ladder it climbs: refill the highest rung column from what you know. The rest of the table is as it appeared.
| set and operation | highest rung | identity |
|---|---|---|
| naturals, subtraction | not even a magma | none |
| integers, subtraction | magma only | none (not associative) |
| positive integers, gcd | commutative semigroup | none |
| naturals, addition | commutative monoid | 0 |
| strings, concatenation | monoid (non-commutative) | empty string |
| self-maps, composition | monoid (non-commutative) | identity map |
Pattern
1. Test closure
Why: Confirm the operation is total and its output always lands back in the set. If a single pair escapes, stop: it is not even a magma.
2. Test associativity
Why: Prove the two bracketings always agree, or kill it with one counterexample triple. Passing here promotes it to a semigroup.
3. Find the identity
Why: Solve the identity equation for a single element that works on both sides for every input. Passing here promotes it to a monoid.
4. Record the extras
Why: Separately note commutativity, idempotence, and any absorbing element. These refine the description but are not required for monoidhood.
Real world
Discussion prompt
Outside this lesson: where does Binary Operations, Semigroups & Monoids actually turn up? Name one concrete situation — a job, a piece of software someone ships, a decision somebody has to make — and say which part of The recipe: is this set-with-operation a monoid? is doing the work in it.
Hint: Vague is the failure mode here. "Engineering" is not a situation; "deciding whether this build is fast enough to ship" is.
Answer:
Builds the algebraic ladder magma to semigroup to monoid from the ground up: closure, associativity, and identity as separate axioms you must actually check. Targets the misconceptions that closure is automatic, that every operation is associative or commutative, and that the identity is the same thing as an absorbing element.
Elimination
Eliminate the wrong options
On which set is subtraction NOT a binary operation because closure fails?
3 of these 4 are wrong. Strike them one at a time, and say what rules each one out before you strike the next. The survivor is the answer.
Survives elimination: C
Why: Subtraction on the naturals can produce a negative result, for example 0 minus 1 equals negative 1, which is not a natural number. That single escaping pair breaks closure, so subtraction is not a binary operation on the naturals.
Check
Subtraction is the operation. On which set does it fail to be a binary operation because the result can leave the set?
Check your understanding
On which set is subtraction NOT a binary operation because closure fails?
Answer: C
Why: Subtraction on the naturals can produce a negative result, for example 0 minus 1 equals negative 1, which is not a natural number. That single escaping pair breaks closure, so subtraction is not a binary operation on the naturals.
Prediction
Predict first
Under the operation a * b = a + b - ab on the integers, what is 2 * 3?
Answer it in your own words, now, with nothing to choose from. The options are on the next slide — and picking the right one off a list is an easier skill than producing it.
Correct: negative 1
Why: Substitute directly: 2 plus 3 minus the product 2 times 3 equals 5 minus 6, which is negative 1. The subtracted product term is what pulls the value below the plain sum.
Check
Use the operation from the earlier worked example.
\[ a \ast b = a + b - ab \]
Check your understanding
Under the operation a * b = a + b - ab on the integers, what is 2 * 3?
Answer: A
Why: Substitute directly: 2 plus 3 minus the product 2 times 3 equals 5 minus 6, which is negative 1. The subtracted product term is what pulls the value below the plain sum.
Check
Consider all finite strings over an alphabet, under concatenation.
Check your understanding
In the monoid of strings under concatenation, what is the identity element?
Answer: A
Why: Concatenating the empty string onto either end of any word leaves the word unchanged, which is exactly the identity axiom. So the empty string is the identity of the free monoid.
Commit first
Predict first
In the monoid of natural numbers under multiplication, which statement is correct?
Commit to an answer, then rate it — certain, fairly sure, or guessing — and write the rating down before you turn the page.
Correct: 1 is the identity and 0 is an absorbing element
Why: Multiplying by 1 returns the partner unchanged, so 1 is the identity, while multiplying by 0 always returns 0, so 0 absorbs. The two roles are distinct and opposite.
The rating matters as much as the answer: confident-and-wrong is the combination that survives revision, because nothing about it feels like it needs revisiting.
Check
Consider the natural numbers under ordinary multiplication.
Check your understanding
In the monoid of natural numbers under multiplication, which statement is correct?
Answer: A
Why: Multiplying by 1 returns the partner unchanged, so 1 is the identity, while multiplying by 0 always returns 0, so 0 absorbs. The two roles are distinct and opposite.
Prediction
Predict first
For length to be a monoid homomorphism, which equation must hold for all strings u and v?
Answer it in your own words, now, with nothing to choose from. The options are on the next slide — and picking the right one off a list is an easier skill than producing it.
Correct: length(uv) = length(u) + length(v)
Why: A homomorphism carries the source operation (concatenation) to the target operation (addition), so the length of a concatenation must equal the sum of the lengths. It also sends the empty string to 0.
Check
The length map sends strings to the naturals under addition.
Check your understanding
For length to be a monoid homomorphism, which equation must hold for all strings u and v?
Answer: A
Why: A homomorphism carries the source operation (concatenation) to the target operation (addition), so the length of a concatenation must equal the sum of the lengths. It also sends the empty string to 0.
Elimination
Eliminate the wrong options
The positive integers under gcd form which structure?
3 of these 4 are wrong. Strike them one at a time, and say what rules each one out before you strike the next. The survivor is the answer.
Survives elimination: A
Why: gcd is closed, associative, and commutative, but no positive integer is divisible by every positive integer, so there is no identity. That makes it a commutative semigroup that fails to be a monoid.
Check
Take the positive integers with the greatest common divisor as the operation.
Check your understanding
The positive integers under gcd form which structure?
Answer: A
Why: gcd is closed, associative, and commutative, but no positive integer is divisible by every positive integer, so there is no identity. That makes it a commutative semigroup that fails to be a monoid.
Connect it up
Draw it
One page, no notation unless you need it: draw how these connect — The recipe: is this set-with-operation a monoid? · A binary operation combines two inputs into one output · Closure is not a bonus, it is the definition · Picture the operation as a filled-in table · Notation: the operation is abstract, the symbol is a placeholder. Put an arrow wherever one of them is what makes another possible, and label the arrow with why.
Recap
You climbed the first algebraic ladder, one independently checkable axiom per rung: magma (closure), semigroup (adds associativity), monoid (adds a two-sided identity).
The three habits to keep: check closure first, never assume associativity or commutativity, and keep the identity distinct from an absorbing element.
| rung | new axiom | example |
|---|---|---|
| magma | closure | integers under subtraction |
| semigroup | associativity | positive integers under gcd |
| monoid | two-sided identity | strings under concatenation |
The identity is unique whenever it exists, the free monoid of strings is the CS-native model, and a homomorphism such as length is a map that preserves the whole structure. Next deck: add inverses to every element and the monoid becomes a group.
Want this taught 1-on-1? Alexander tutors Foundations of Higher Mathematics — $55/session, free consultation.