Discrete StructureUnit 118 min read
Functions, Composition & Inverses: Types, Properties & Applications
Unit 11 of Discrete Structure explores injective/surjective/bijective functions, function composition, inverse functions, and their real-world applications in algorithms, databases, and cryptography—with visual proofs, step-by-step examples, and exam-focused problem-solving techniques.
TAKEAWAYS:
- Injective vs. Surjective vs. Bijective: Master the definitions and visual tests (horizontal/vertical line tests) to classify functions.
- Composition ≠ Multiplication: Understand
(f∘g)(x)means "apply g first, then f"—trace with tables to avoid mistakes. - Inverses Exist Only for Bijective Functions: Learn how to algebraically derive
f⁻¹(x)and verify it usingf(f⁻¹(x)) = x. - Real-World Mappings: Functions model database joins (SQL), encryption (Khalti), and pathfinding (Pathao routes)—connect theory to apps.
- Proof Techniques: Use contradiction and direct substitution to prove injectivity/surjectivity.
- Exam Pitfalls: Avoid assuming
(f∘g)⁻¹ = g⁻¹∘f⁻¹without proof; always verify domains/codomains.
1. Types of Functions: Injective, Surjective, Bijective
Definitions with Visual Tests
A function f: A → B can be classified by how it maps elements of A to B:
| Type | Definition | Visual Test | Example |
|---|---|---|---|
| Injective | Distinct inputs map to distinct outputs (f(a) = f(b) ⇒ a = b). |
Horizontal line test: No two points share the same y-value. | f(x) = 2x + 1 (one-to-one). |
| Surjective | Every element in B is mapped by some a ∈ A (onto). |
Covered codomain: The graph "hits" every y-value in B. |
f: ℝ → ℝ, f(x) = x³ (onto). |
| Bijective | Both injective and surjective (one-to-one and onto). | Perfect pairing: Every x has a unique y, and every y is covered. | f: ℝ → ℝ, f(x) = eˣ (bijective). |
Worked Example: Classify and Prove
Problem: Show f: ℝ → ℝ, f(x) = 5x − 7 is bijective. Find f⁻¹(x).
Solution:
Injective Proof (Contradiction): Assume
f(a) = f(b). Then: Thus, injective.Surjective Proof (Existence): For any
y ∈ ℝ, solvey = 5x − 7: Thus, surjective.Inverse Function: Swap
xandyiny = 5x − 7: So,f⁻¹(x) = (x + 7)/5.
Verification:
Key Insight: Inverses undo the original function.
2. Function Composition: (f∘g)(x)
How It Works
Composition f∘g means "apply g first, then f":
Caution: Order matters! (f∘g) ≠ (g∘f) unless f and g commute.
Worked Example: Real-World Scenario
Problem: Pathao’s ride-hailing system uses two functions:
g(x): Estimates fare based on distancex(km):g(x) = 10x + 50.f(y): Adds a 10% surge fee:f(y) = 1.1y. Find(f∘g)(x)and interpret it.
Solution:
- Compute
(f∘g)(x): - Interpretation:
g(x): Base fare (e.g., 5 km → ₹100).f(g(x)): Total fare with surge (₹110).
Visual Trace:
flowchart TD
A["Distance (x km)"] -->|"g(x)"| B["Base Fare (₹10x+50)"]
B -->|"f(y)"| C["Total Fare (₹1.1y)"]
C --> D["(f∘g)(x) = 11x + 55"]3. Inverse Functions and Their Properties
When Does an Inverse Exist?
Only bijective functions have inverses. For non-bijective functions:
- Injective but not surjective: Restrict codomain to make it bijective (e.g.,
f(x) = x²on[0, ∞)). - Surjective but not injective: No inverse unless you allow relations (multivalued functions).
Worked Example: Bank Loan Interest
Problem: A bank offers a loan with interest calculated by f(P) = P(1 + 0.05t), where P is principal, t is time (years). Find f⁻¹ to determine principal from total repayment.
Solution:
- Rewrite
y = P(1 + 0.05t)asP = y / (1 + 0.05t). But to findf⁻¹, treattas fixed: - Verification:
Real-World Tie:
- Khalti’s Transaction ID: Acts like an injective function mapping user actions to unique IDs.
- NEPSE Stock Codes: Bijective mapping between company names and ticker symbols (e.g.,
NICASIA→NICASIA).
4. Composition of Inverses
Key Theorem
If f and g are bijective:
Proof:
graph LR
A["(f∘g)⁻¹"] -->|"Definition"| B["x such that (f∘g)(x) = y"]
B --> C["g(x) = f⁻¹(y)"]
C --> D["x = g⁻¹(f⁻¹(y))"]
D --> E["Thus, (f∘g)⁻¹(y) = g⁻¹(f⁻¹(y))"]Worked Example: Encryption (Khalti-Style)
Problem: Let f(x) = 3x + 2 (encrypt) and g(x) = x/2 (decrypt). Show (f∘g)⁻¹ = g⁻¹∘f⁻¹.
Solution:
- Compute
f⁻¹andg⁻¹:f⁻¹(x) = (x − 2)/3.g⁻¹(x) = 2x.
- Compute
(f∘g)⁻¹directly: Inverse:x = (3y/2) + 2 ⇒ y = (2x − 4)/3. - Compute
g⁻¹∘f⁻¹: Matches!
5. Common Mistakes and Pitfalls
- Assuming
(f∘g)⁻¹ = f⁻¹∘g⁻¹:- Wrong: Order matters! Correct:
(f∘g)⁻¹ = g⁻¹∘f⁻¹.
- Wrong: Order matters! Correct:
- Ignoring Domains/Codomains:
- Example:
f: [0,∞) → ℝ, f(x) = x²is bijective only if codomain is restricted to[0,∞).
- Example:
- Composition vs. Multiplication:
(f∘g)(x) ≠ f(x) * g(x). Always evaluate step-by-step.
In the Real World
Pathao’s Ride Matching:
- Function:
f(user_id) → driver_id(injective, since one user gets one driver). - Composition:
g(driver_id) → location∘f(user_id)maps a user to their driver’s location. - Inverse:
f⁻¹(driver_id) → user_id(used for dispute resolution).
- Function:
Khalti’s Transaction IDs:
- Bijective Function:
f(user_action) → unique_transaction_ID. - Why Bijective? Ensures no two actions share an ID (injective) and every action gets an ID (surjective).
- Inverse:
f⁻¹(ID) → user_action(used for refunds).
- Bijective Function:
Daraz’s Order Queue:
- Partial Order: Orders are processed based on time + priority (not a total order).
- Function Composition:
g(order) → delivery_status∘f(order) → warehouse_assignmenttracks order flow.
Exam Tip
For Proofs:
- Injective: Use contradiction (
f(a) = f(b) ⇒ a = b). - Surjective: Show for any
y ∈ B, there existsx ∈ Asuch thatf(x) = y. - Bijective: Combine both proofs or use the inverse.
- Injective: Use contradiction (
For Composition:
- Always substitute step-by-step. Example:
Given
f(x) = x² + 1,g(x) = 2x: - Never write
(f∘g)(x) = f(x) * g(x).
- Always substitute step-by-step. Example:
Given
Inverse Functions:
- To find
f⁻¹(x), solvey = f(x)forxin terms ofy. - Verify: Check
f(f⁻¹(x)) = xandf⁻¹(f(x)) = x.
- To find
Diagrams Save Marks:
- Draw mapping diagrams for injective/surjective functions.
- Use flowcharts for composition (e.g., Pathao’s fare calculation).
Real-World Questions:
- Expect problems like:
- "A bank charges interest as
f(P) = P(1 + r)². Ifr = 0.05, find the inverse to calculate principal from maturity amount." - "Pathao’s surge pricing is
f(x) = 1.2x. If base fare isg(d) = 10d + 50, express total fare as a composition."
- "A bank charges interest as
- Expect problems like:
Final Reminder:
"A function is like a vending machine: injective means no two inputs give the same output; surjective means every snack is available; bijective means every input gives a unique snack, and you can reverse the process." — Discrete Math Proverb
Based on the TU BCA syllabus for Discrete Structure (BCA151), unit 11.
Discussion
Loading…