Function Types

Back

Loading concept...

🎯 Function Types: The Five Superpowers

Imagine you’re a mail carrier. Your job is to deliver letters from houses on one street to houses on another street. But not all mail carriers work the same way—some have special superpowers!


🏠 The Neighborhood Analogy

Throughout this guide, we’ll use two neighborhoods:

  • Neighborhood A = Houses where letters come FROM (the domain)
  • Neighborhood B = Houses where letters go TO (the codomain)

A function is like a mail carrier who takes each letter from Neighborhood A and delivers it to exactly ONE house in Neighborhood B. No letter stays undelivered, and no letter goes to two places at once!


1️⃣ Injective Function (One-to-One)

The Story

Meet Indy the Injective Mail Carrier. Indy has one simple rule:

“I NEVER deliver two different letters to the same mailbox!”

Every house in Neighborhood B that receives mail gets exactly one unique letter. No sharing allowed!

What It Means

A function f is injective (or one-to-one) if:

  • Different inputs ALWAYS give different outputs
  • If f(a) = f(b), then a MUST equal b

Simple Example

Neighborhood A: {Alice, Bob, Carol}
Neighborhood B: {House 1, House 2, House 3, House 4}

Indy delivers:
  Alice → House 1
  Bob   → House 2
  Carol → House 3

House 4 gets nothing (that's OK!)

Injective! Each house that got mail received from only ONE person.

NOT Injective Example

Alice → House 1
Bob   → House 1  ← PROBLEM!
Carol → House 2

Not injective! House 1 got letters from TWO people.

Quick Test 🧪

If two different people sent letters, did they go to DIFFERENT houses?

  • YES → Injective ✅
  • NO → Not Injective ❌
graph TD A1["Alice"] --> B1["House 1"] A2["Bob"] --> B2["House 2"] A3["Carol"] --> B3["House 3"] B4["House 4"] style B4 fill:#f0f0f0

2️⃣ Surjective Function (Onto)

The Story

Meet Suri the Surjective Mail Carrier. Suri has a different rule:

“EVERY house in Neighborhood B MUST receive at least one letter!”

No house is left out. Every mailbox gets something!

What It Means

A function f is surjective (or onto) if:

  • Every element in the codomain is “hit” by at least one input
  • No house is empty

Simple Example

Neighborhood A: {Alice, Bob, Carol, Dave}
Neighborhood B: {House 1, House 2, House 3}

Suri delivers:
  Alice → House 1
  Bob   → House 2
  Carol → House 3
  Dave  → House 1  ← Same house as Alice (that's OK!)

Surjective! Every house received at least one letter.

NOT Surjective Example

Neighborhood A: {Alice, Bob}
Neighborhood B: {House 1, House 2, House 3}

  Alice → House 1
  Bob   → House 2
  House 3 → 😢 Empty!

Not surjective! House 3 never got mail.

Quick Test 🧪

Did EVERY house in Neighborhood B receive at least one letter?

  • YES → Surjective ✅
  • NO → Not Surjective ❌
graph TD A1["Alice"] --> B1["House 1"] A2["Bob"] --> B2["House 2"] A3["Carol"] --> B3["House 3"] A4["Dave"] --> B1

3️⃣ Bijective Function (Perfect Match)

The Story

Meet Bibi the Bijective Mail Carrier—the ULTIMATE mail carrier! Bibi combines BOTH superpowers:

“Every person sends to a DIFFERENT house, AND every house gets EXACTLY one letter!”

This is a perfect pairing. Like matching dance partners—everyone has exactly one partner!

What It Means

A function is bijective if it is:

  • ✅ Injective (one-to-one) — no two inputs share an output
  • ✅ Surjective (onto) — every output is used

Simple Example

Neighborhood A: {Alice, Bob, Carol}
Neighborhood B: {House 1, House 2, House 3}

Bibi delivers:
  Alice → House 1
  Bob   → House 2
  Carol → House 3

Bijective!

  • Each person → different house (injective ✅)
  • Every house got exactly one letter (surjective ✅)

The Magic Property 🪄

When a function is bijective, you can reverse the arrows! You can figure out who sent the letter just by knowing which house received it.

graph TD A1["Alice"] <--> B1["House 1"] A2["Bob"] <--> B2["House 2"] A3["Carol"] <--> B3["House 3"]

4️⃣ Composition of Functions

The Story

What if we have TWO mail carriers working in a chain?

Imagine:

  1. Carrier f takes letters from Neighborhood A to Neighborhood B
  2. Carrier g then takes those same letters from B to Neighborhood C

This teamwork is called composition, written as g ∘ f (read: “g after f” or “g compose f”).

What It Means

  • First apply f, THEN apply g
  • The output of f becomes the input of g
  • Written as: (g ∘ f)(x) = g(f(x))

Simple Example

Step 1 - Function f (Double the number):
  f(x) = 2x

Step 2 - Function g (Add 3):
  g(x) = x + 3

Composition (g ∘ f):
  Start with x = 5
  f(5) = 2 × 5 = 10
  g(10) = 10 + 3 = 13

So (g ∘ f)(5) = 13

Real-Life Example 🎮

Player earns coins → f: Double bonus weekend!
Doubled coins → g: Convert to gems (÷10)

Player earns 50 coins:
  f(50) = 100 coins (doubled!)
  g(100) = 10 gems

(g ∘ f)(50) = 10 gems

⚠️ Order Matters!

g ∘ f is NOT the same as f ∘ g!

f(x) = 2x, g(x) = x + 3

(g ∘ f)(5):
  f(5) = 10 → g(10) = 13 ✓

(f ∘ g)(5):
  g(5) = 8 → f(8) = 16 ✓

13 ≠ 16 — Order changes the result!
graph LR A["Input x"] --> B["f: Apply first"] B --> C["Intermediate result"] C --> D["g: Apply second"] D --> E["Final output"]

5️⃣ Inverse Function

The Story

Remember Bibi the Bijective mail carrier? Because Bibi creates a perfect pairing, we can create an Inverse Mail Carrier who does the exact OPPOSITE job!

“Tell me the house, and I’ll tell you who sent the letter!”

This is the inverse function, written as f⁻¹.

What It Means

  • If f(a) = b, then f⁻¹(b) = a
  • The inverse “undoes” what the original function did
  • Only bijective functions have inverses!

Simple Example

Original function f:
  Alice → House 1
  Bob   → House 2
  Carol → House 3

Inverse function f⁻¹:
  House 1 → Alice
  House 2 → Bob
  House 3 → Carol

Math Example 🔢

Function f(x) = 2x + 3

To find inverse:
  y = 2x + 3
  y - 3 = 2x
  x = (y - 3) / 2

So f⁻¹(x) = (x - 3) / 2

Test it:
  f(5) = 2(5) + 3 = 13
  f⁻¹(13) = (13 - 3) / 2 = 5 ✓

It brings us back to where we started!

The Ultimate Test 🏆

For any inverse function:

  • f⁻¹(f(x)) = x — Apply f, then undo with f⁻¹, you get x back!
  • f(f⁻¹(x)) = x — Apply f⁻¹, then f, you get x back!
graph LR A["x = 5"] -->|f| B["13"] B -->|f⁻¹| C["5"] style A fill:#90EE90 style C fill:#90EE90

🎯 Quick Summary Table

Type Question to Ask Example
Injective Do different inputs give different outputs? Student IDs → Students
Surjective Is every output reached by some input? All seats filled in class
Bijective Both above? Perfect 1-to-1 matching? Dance partners
Composition Chain two functions together? Double then add 3
Inverse Can we reverse the function? Undo an encryption

🌟 Remember This!

🎯 Injective = No two arrows land on the same target

🎯 Surjective = Every target gets hit

🎯 Bijective = Perfect pairing (injective + surjective)

🎯 Composition = Teamwork (apply one, then the other)

🎯 Inverse = The “undo” button (only for bijective!)


You’ve now mastered the five function superpowers! Each one gives functions special abilities, and when you combine them, amazing things happen. Keep practicing, and soon you’ll spot these patterns everywhere in mathematics! 🚀

Loading story...

Story - Premium Content

Please sign in to view this story and start learning.

Upgrade to Premium to unlock full access to all stories.

Stay Tuned!

Story is coming soon.

Story Preview

Story - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.