Composition: machines in a pipeline
Take and . The output of is a legal input for , so chain them: feed into , then feed into . The result is the composition , defined by
It's a single function — the whole pipeline collapsed into one machine.
Now the bomb everyone steps on — and I mean everyone, without exception, at least once: means " first, then ", even though is written first. The notation reads right-to-left because is the inner function — it touches first. Read as " after ". Get this backwards and every composition problem you ever do comes out wrong. The inner function fires first; the notation is deliberately counterintuitive, so train the damn reflex now, before it bites you in the eigenvalue lesson.
For the chain to be legal, the codomain of must match (or sit inside) the domain of — the pipe fittings have to connect. Output type of stage one = input type of stage two.
Associative yes, commutative almost never
Composition has one nice algebraic law and one infamous missing one.
Associative: stacking three machines, it doesn't matter how you group the bolting: Both sides are just ", then , then " — the pipeline is the pipeline regardless of which joint you mentally assemble first. So we drop parentheses and write .
Commutative? Almost never. In general Order matters, and this is your first sighting of noncommutativity — a property that will dominate the matrix stratum like a goddamn tyrant. Concrete proof: let and on . Then At : but . Different functions. "Square then add one" is not "add one then square" — obviously, once you see it, and yet people assume composition commutes constantly. It does not. Burn that in: the order of operations is part of the operation.
Composition preserves injectivity and surjectivity — with proof
Good news: the nice properties survive the pipeline. Let and .
Theorem (injectivity). If and are both injective, so is . Proof. Assume , i.e. . Since is injective, equal -outputs force equal inputs: . Since is injective, this forces . So is injective. (Peel the machines off one at a time, outermost first.)
Theorem (surjectivity). If and are both surjective, so is . Proof. Take an arbitrary . Since is surjective, there's a with . Since is surjective, there's an with . Then . So every has a preimage — surjective.
Corollary. The composition of two bijections is a bijection. (Both halves survive.) This is exactly why "same size" will be an equivalence relation in the cardinality lesson — bijections compose.
The identity function: the "1" of composition
Every set has a do-nothing machine — beautiful in its absolute boredom — the identity function defined by — input comes out untouched. It's the multiplicative- of the composition world: bolting it on changes nothing. Keep in mind — it's the yardstick that defines what an inverse is, and it will show up in proofs constantly from here to the end of this course.
Inverses: running the machine backwards
Now the climax. A function has an inverse if running then (and vice versa) gets you back where you started:
undoes : whatever did to , reverses it. And here is the theorem that ties the whole stratum together:
has an inverse if and only if is a bijection.
Let me show you why, because it's the payoff of the last two lessons. For to be a well-defined function that undoes :
- must be injective, or undoing is ambiguous. If with , then wouldn't know whether to return or — single-valuedness of dies. No collisions allowed.
- must be surjective, or isn't total. If some is never an output of , then has nothing to return — undefined. No orphans allowed.
No collisions and no orphans is exactly bijective. So bijection invertible. The injective/surjective/bijective machinery from last lesson wasn't bookkeeping — it was the precise diagnosis of which machines can be run backwards, and you've just collected the payoff. This is what rigor buys you: surprising connections that aren't surprising at all once you've defined everything correctly.
Finding in practice: solve for . For (which we proved bijective): , so . (That's the very expression the surjectivity proof coughed up last lesson — no accident.) Check it: . ✓ The machine, run backwards, lands you home. And inverses of bijections are themselves bijections — file that away, it makes "same cardinality" symmetric in the boss fight ahead.