3.1 Function Mappings: Injective, Surjective & Bijective Classifications
π‘ Core Intuition: The 3-Second Mental Modelβ
π³ The Everyday Analogy: Hotel Room Key Allocationβ
Think of a function as an automated hotel check-in kiosk assigning guests to hotel rooms:
- The Function Contract: Every arriving guest (element in the Domain) must receive a key, and no guest can be assigned two different rooms at the same time. However, multiple guests could be booked into the same presidential suite, and some rooms in the hotel (the Codomain) might remain vacant.
- Injective (One-to-One): Strict private rooms! Every guest gets their own exclusive room. No two distinct guests ever share a room.
- Surjective (Onto): 100% hotel occupancy! Every single room in the hotel has at least one guest sleeping in it. Zero vacant rooms left.
- Bijective (One-to-One & Onto): Perfect one-to-one pairing! Every guest has their own exclusive private room, and every room in the hotel is occupied. Guest count equals room count ().
π» Bridging to Computer Science: Hash Functions, Compilers & Cryptographyβ
In computer science, functions govern computation:
- Hash Tables: A hash function maps search keys to bucket indices. If is injective, it is a perfect hash function with zero collisions.
- Relational Databases & Primary Keys: Primary key lookups are strictly injective; foreign keys form general functions.
- Cryptography & Block Ciphers: Encryption algorithms like AES must be strictly bijective so that ciphertext can be uniquely decrypted back to plaintext without data loss.
π Mathematical Formalism of Functionsβ
A function is a special type of binary relation with two strict operational invariants: every input must participate, and each input must produce exactly one deterministic output.
Let and be non-empty sets. A function (or mapping) from to , denoted:
is a binary relation satisfying two fundamental axioms:
- Total Existence (Totality): Every element in the domain must participate in the mapping:
- Uniqueness (Deterministic Output): No element in the domain can map to multiple distinct elements in the codomain:
If , we write , where is the image of , and is the pre-image of .
Core Anatomical Sets:
- Domain (): The source set of all permissible inputs.
- Codomain (): The declared target universe where outputs land.
- Range / Image (): The subset of actual outputs hit by inputs:
Fundamental Invariant: .
Diagnostic: Relation vs Valid Functionβ
To determine whether an arbitrary binary relation qualifies as a valid function, we test it against the two axioms:
| Relation Instance | First Coordinate Invariant | Second Coordinate Invariant | Function Verdict | Operational Reason |
|---|---|---|---|---|
| on | Every appears exactly once | Exactly 1 target per input | Valid Function | Satisfies both Totality and Uniqueness. Notice is untouched (). |
| on | Elements are missing | Input maps to both and | Invalid Function | Fails Totality (unmapped inputs) AND fails Uniqueness (one-to-many branching). |
| on | Every appears exactly once | All inputs share target | Valid Function | Many-to-one is completely legal! Range is . |
β‘ High-Yield Invariants: Set Images & Pre-Imagesβ
A frequent source of errors in discrete exams is assuming that set operations distribute identically across forward function images and inverse pre-images. The following invariants govern subsets and under :
Let be an arbitrary function. For any subsets and :
- Union commutes with forward image:
- Intersection does NOT in general commute with forward image: Equality holds for all subsets if and only if is injective (one-to-one)!
- Pre-images commute unconditionally with both Union and Intersection:
- Cardinality Inequalities:
Let and . Define and (a non-injective function).
Choose disjoint subsets and :
- Left Side: .
- Right Side: and .
- Notice that . Therefore, .
When is injective, elements cannot share images, restoring strict equality!
π Injective, Surjective & Bijective Classificationsβ
Injective (One-to-One) vs Surjective (Onto) Mappings
The two foundational orthogonality dimensions of mathematical functions
Injection (One-to-One)
- β’Distinct domain elements map to distinct codomain elements.
- β’Formal: f(xβ) = f(xβ) βΉ xβ = xβ (Contrapositive: xβ β xβ βΉ f(xβ) β f(xβ)).
- β’Pre-images are unique: Every y β B has at most one pre-image.
- β’Necessary Cardinality Bound: |A| β€ |B|.
Surjection (Onto)
- β’Every element of the codomain is the image of at least one domain element.
- β’Formal: βy β B, βx β A such that f(x) = y.
- β’Full coverage: Range(f) = Codomain(B). Zero untouched elements.
- β’Necessary Cardinality Bound: |A| β₯ |B|.
A function is bijective (or a bijection, or a one-to-one correspondence) if and only if it is simultaneously:
- Injective (One-to-One), and
- Surjective (Onto).
Cardinality Invariant for Finite Sets: If and are finite sets, a bijection exists between and if and only if:
When , every injective function is automatically surjective, and every surjective function is automatically injective!
π Master Function Feasibility & Cardinality Matrixβ
For finite sets with and with , mapping feasibility is strictly determined by cardinality:
| Cardinality Condition | Injective | Surjective | Bijective | Core Intuition & Governing Invariant |
|---|---|---|---|---|
| () | Possible | Impossible () | Impossible () | Plenty of targets for distinct assignments; impossible to cover targets with only domain elements. |
| () | Impossible () | Possible | Impossible () | By Pigeonhole Principle, collisions are inevitable; sufficient domain elements exist to cover all targets. |
| () | Possible | Possible | Possible | Equivalence Theorem: For finite sets of equal size, . |
π Step-by-Step Worked Examplesβ
Example 1: Verifying Function Invariants on Discrete Setsβ
Problem Statement: Let and . Determine whether each of the following relations is a function, and if so, classify whether it is injective, surjective, or bijective:
Step-by-Step Solution:
-
Analysis of :
- Totality: Every element in () appears as the first coordinate.
- Uniqueness: No first coordinate is repeated. Thus, is a valid function .
- Injectivity: . All images are distinct. Hence, is Injective.
- Surjectivity: The codomain is , but the range is . Since , it is NOT Surjective.
- Classification: Injective but not surjective.
-
Analysis of :
- Element appears twice with different outputs: and .
- Violates the Uniqueness Axiom.
- Classification: Not a function.
-
Analysis of :
- Element does not appear as a first coordinate.
- Violates the Totality Axiom.
- Classification: Not a function (merely a partial function).
-
Analysis of :
- Totality: Every element in () has an image.
- Uniqueness: Each has exactly one image (). Thus, is a valid function.
- Injectivity: , yet . Not injective.
- Surjectivity: Range is . Not surjective.
- Classification: Neither injective nor surjective (Many-to-one into function).
Key Takeaway: A valid function requires every element of the domain to have exactly one outgoing arrow.
Example 2: Analyzing Real-Valued Functionsβ
Problem Statement: Determine whether the function defined by is bijective.
Step-by-Step Solution:
-
Step 1: Test for Injectivity (One-to-One)
- Assume for arbitrary :
- Add to both sides:
- Divide by :
- Since , the function is strictly Injective.
-
Step 2: Test for Surjectivity (Onto)
- Let be an arbitrary element in the codomain. We must find an such that :
- Since , is also a well-defined real number ().
- Verifying the image:
- Every real number has a pre-image in the domain. Hence, is strictly Surjective.
-
Step 3: Conclusion
- Because is both injective and surjective, is a Bijective function.
Key Takeaway: For algebraic functions, injectivity is proven by equating and solving for ; surjectivity is proven by solving for and verifying that the resulting expression is defined for all in the codomain.
π― Exam & Interview Pitfall Checkβ
Question 1: If a function is injective, does altering the codomain to equal always turn it into a bijection? Key Focus Points: Yes! By definition, an injection only fails to be surjective if there are elements in . If we restrict the codomain to , the mapping becomes both injective and surjective, hence a bijection.
Question 2: Can an infinite set have an injection into a proper subset of itself? Key Focus Points: Yes! This is Dedekind's definition of an infinite set. For example, defined by maps all natural numbers to the even natural numbers (a strict proper subset), and is strictly injective. For finite sets, this is impossible.
Trap 1: Assuming is always non-injective Why it fails: Injectivity depends strictly on the Domain, not just the algebraic rule! If where , it is NOT injective because . However, if (positive real numbers only), is strictly injective because negative values do not exist in the domain! Always check the domain and codomain boundaries first.
Trap 2: Confusing Codomain with Range Why it fails: In function notation , set is the Codomain, NOT necessarily the Range. The Range is the actual set of outputs . Confusing the two causes errors in surjectivity proofs.