Lesson 12 +30 XP

Functions: Types, Composition & Inverse

1. Definition

A function f : A → B is a relation from A to B in which every element of A is related to exactly one element of B.

  • A = domain, B = codomain, f(a) = image of a, and f(A) = {f(a) : a ∈ A} = range (⊆ B).

Is it a function? (arrow-diagram test)

  • every element of A has an arrow ✅ and no element of A has two arrows ✅ → function.
  • some a ∈ A has no image (3 maps nowhere) ❌ → not a function.
  • some a ∈ A has two images (2 → b and 2 → c) ❌ → not a function.

2. Types of Functions

One-one, onto, bijective and neither-arrow diagramsOne-one, onto, bijective and neither-arrow diagrams

TypeConditionAlso called
One-onef(a₁) = f(a₂) ⇒ a₁ = a₂injective
Ontoevery b ∈ B has some a with f(a) = b (range = codomain)surjective
Bijectiveone-one and ontoone-to-one correspondence
Constantf(a) = c for all a
IdentityIA(a) = a

Examples

  • f(x) = x² on R → R is not one-one (f(2) = f(−2) = 4) and not onto (no x gives −1).
  • f(n) = 2n from N to the set of even naturals is onto; from N to N it is not onto (3 has no pre-image).
  • f(x) = 2x + 3 on R → R is a bijection (inverse (x − 3)/2).

Proving one-one: assume f(a) = f(b) and show a = b. For f(x) = 2x + 3: 2a + 3 = 2b + 3 ⇒ a = b ✓ Proving onto: take any y, solve f(x) = y for x in the domain. x = (y − 3)/2 ∈ R ✓

3. Counting Functions (∣A∣ = m, ∣B∣ = n)

KindCountExample m = 3, n = 4
all functionsnᵐ64
one-one (needs m ≤ n)P(n, m) = n!/(n − m)!24
onto (needs m ≥ n)Σ (−1)ᵏ C(n, k)(n − k)ᵐ-
bijections (m = n)n!-

Onto functions from a 4-set to a 3-set: 3⁴ − 3·2⁴ + 3·1⁴ = 36 (inclusion-exclusion, Lesson 9).

4. Composition

For f : A → B and g : B → C, the composition g ∘ f : A → C is (g ∘ f)(x) = g(f(x)).

Example. f(x) = x + 2, g(x) = x² on R:

  • (g ∘ f)(x) = (x + 2)²
  • (f ∘ g)(x) = x² + 2

So composition is not commutative, but it is associative: h ∘ (g ∘ f) = (h ∘ g) ∘ f.

If f and g are…then g ∘ f is…
both one-oneone-one
both ontoonto
both bijectionsa bijection
g ∘ f one-onef must be one-one
g ∘ f ontog must be onto

5. Inverse Functions

f : A → B has an inverse f⁻¹ : B → A iff f is a bijection, and then f⁻¹(b) = a ⇔ f(a) = b.

  • f-1 ∘ f = IA and f ∘ f-1 = IB
  • (g ∘ f)⁻¹ = f⁻¹ ∘ g⁻¹ (reverse order - "socks and shoes")

Solved. f(x) = (3x − 2)/5 on R. Put y = (3x − 2)/5 ⇒ x = (5y + 2)/3, so f⁻¹(x) = (5x + 2)/3.

6. Floor, Ceiling and Characteristic Functions

  • ⌊x⌋ = greatest integer ≤ x; ⌈x⌉ = least integer ≥ x. ⌊3.7⌋ = 3, ⌈3.2⌉ = 4, ⌊−1.5⌋ = −2.
  • Characteristic function of S ⊆ U: χS(x) = 1 if x ∈ S, else 0. It turns set operations into arithmetic: the characteristic function of A ∩ B is χA · χB.
🎯 END-TERM EXAM PREP

📝 IPU End-Term Exam Corner (5-10 Marks)

  • Q1. Define one-one, onto and bijective functions with examples. Show f(x) = 2x + 3 on R is a bijection and find f⁻¹. (5 Marks)
  • Q2. If f and g are bijections, prove g ∘ f is a bijection and (g ∘ f)⁻¹ = f⁻¹ ∘ g⁻¹. (5 Marks)
  • Q3. How many one-one functions are there from a 3-element set to a 5-element set? How many onto functions from a 4-set to a 3-set? (5 Marks) → 60, 36.