Function Composition
Context: FIT1058_MOC Β· chains functions into a pipeline Β· needs codomain/domain to match Β· reverses on inversion Β· powers a Cryptosystem
Quick Revision
- π― Objective: feed one functionβs output into another β , βg after fβ.
- π¦ Core Components: matching (codom = dom ) β associative β identity neutral.
- β‘ Key Constraint: not commutative; inverting reverses order ().
π Core
1. Composition (g after f)
- Definition β , βΉ , .
- Order β right-hand function runs first (textual order reverses evaluation).
- Matching β defined only when codomain of = domain of .
2. Algebraic Properties
- Not commutative β in general.
- Associative β .
- Identity neutral β ; iteration β .
3. Inverses (Socks-and-Shoes)
- Cancel β , (Inverse Function).
- Reverse order β .
- Application β cascaded encryptions build a stronger Cryptosystem.
Key identities:
βοΈ Core Decision Matrix
| Property | Holds? | Statement |
|---|---|---|
| commutative | no | |
| associative | yes | |
| identity | yes | |
| bijection preserved | yes | bijective iff both are |
When It Flips: composition models multi-stage computation; non-commutativity means swapping stages changes the result. Cascading two ciphers gives key space and decryption (socks-and-shoes).
π Exam Execution Trace
Applied Exercise
Problem: Compute and at ; confirm non-commutativity. Derivation Proof / Hand-Calculation Walkthrough:
Final Extracted Output: , ; non-commutative.
β οΈ Common Mistakes
- π‘ Written order β evaluation order β in , runs first though is written first; to invert, reverse ().
π§ Active Recall
State the matching condition for and why written order reverses evaluation order.
- Hint: Codomain meets domain.
Answer
- Short answer: Requires codomain of = domain of ; applies first.
- Why: Last acts leftmost β the notation lists the final function on the left.
Justify the socks-and-shoes rule .
- Hint: Undo the last step first.
Answer
- Short answer: (associativity).
- Why: Reverse order β undo then , like shoes before socks.
Is composition commutative? Associative? What role does the identity play?
- Hint: Order matters, grouping doesnβt.
Answer
- Short answer: Not commutative; associative; identity is neutral ().
- Why: Unambiguous chains β associativity lets drop brackets.