Set TheoryTopic #14 of 40

Functions

Injective, surjective, bijective functions, composition, inverse functions, and function growth.

Definition

A function ff from AA to BB, written f:ABf: A \to B, is a relation where each element of AA is related to exactly one element of BB.

  • Domain: AA (input set)
  • Codomain: BB (output set)
  • Range/Image: {f(a)aA}B\{f(a) \mid a \in A\} \subseteq B (actual outputs)

Notation

  • f(a)=bf(a) = b means ff maps aa to bb
  • af(a)a \mapsto f(a) describes the mapping

Types of Functions

Injective (One-to-One)

Different inputs give different outputs: a1,a2A:f(a1)=f(a2)a1=a2\forall a_1, a_2 \in A: f(a_1) = f(a_2) \rightarrow a_1 = a_2

Equivalently: a1,a2A:a1a2f(a1)f(a2)\forall a_1, a_2 \in A: a_1 \neq a_2 \rightarrow f(a_1) \neq f(a_2)

Example: f(x)=2xf(x) = 2x on R\mathbb{R} is injective. Non-example: f(x)=x2f(x) = x^2 on R\mathbb{R} is not injective (f(1)=f(1)f(-1) = f(1)).

Surjective (Onto)

Every element in the codomain is mapped to: bB:aA:f(a)=b\forall b \in B: \exists a \in A: f(a) = b

Equivalently: range(f)=B\text{range}(f) = B

Example: f(x)=x3f(x) = x^3 from R\mathbb{R} to R\mathbb{R} is surjective. Non-example: f(x)=x2f(x) = x^2 from R\mathbb{R} to R\mathbb{R} is not surjective (1-1 is not in range).

Bijective (One-to-One Correspondence)

Both injective AND surjective.

f:AB is bijective    A=B and f is injectivef: A \to B \text{ is bijective} \iff |A| = |B| \text{ and } f \text{ is injective}

Example: f(x)=2x+1f(x) = 2x + 1 from R\mathbb{R} to R\mathbb{R} is bijective.

Cardinality Conditions

For finite sets AA and BB with A=m|A| = m and B=n|B| = n:

ConditionPossible if
f:ABf: A \to B injectivemnm \leq n
f:ABf: A \to B surjectivemnm \geq n
f:ABf: A \to B bijectivem=nm = n

Counting Functions

TypeCount
All functions ABA \to Bnmn^m
Injective functionsn(n1)(n2)(nm+1)=n!(nm)!n(n-1)(n-2)\cdots(n-m+1) = \frac{n!}{(n-m)!}
Bijective functionsn!n! (when m=nm = n)

Function Composition

If f:ABf: A \to B and g:BCg: B \to C, then gf:ACg \circ f: A \to C: (gf)(a)=g(f(a))(g \circ f)(a) = g(f(a))

Properties

  • Associative: (hg)f=h(gf)(h \circ g) \circ f = h \circ (g \circ f)
  • NOT commutative: gffgg \circ f \neq f \circ g in general
  • fgf \circ g injective \Rightarrow gg injective
  • fgf \circ g surjective \Rightarrow ff surjective
  • f,gf, g bijective \Rightarrow gfg \circ f bijective

Inverse Functions

If f:ABf: A \to B is bijective, its inverse f1:BAf^{-1}: B \to A satisfies: f1(f(a))=a for all aAf^{-1}(f(a)) = a \text{ for all } a \in A f(f1(b))=b for all bBf(f^{-1}(b)) = b \text{ for all } b \in B

Properties

  • (f1)1=f(f^{-1})^{-1} = f
  • (gf)1=f1g1(g \circ f)^{-1} = f^{-1} \circ g^{-1}
  • ff1=IBf \circ f^{-1} = I_B and f1f=IAf^{-1} \circ f = I_A

Identity Function

IA:AA,IA(a)=aI_A: A \to A, \quad I_A(a) = a

For any f:ABf: A \to B: fIA=f=IBff \circ I_A = f = I_B \circ f

Important Functions

Floor and Ceiling

x=largest integer x\lfloor x \rfloor = \text{largest integer } \leq x x=smallest integer x\lceil x \rceil = \text{smallest integer } \geq x

Properties:

  • xx<x+1\lfloor x \rfloor \leq x < \lfloor x \rfloor + 1
  • x1<xx\lceil x \rceil - 1 < x \leq \lceil x \rceil
  • x=x\lfloor x \rfloor = \lceil x \rceil iff xZx \in \mathbb{Z}
  • x=x\lfloor -x \rfloor = -\lceil x \rceil

Modulo Function

amodn=ana/na \mod n = a - n\lfloor a/n \rfloor

The remainder when aa is divided by nn.

Function Growth

Big-O Notation

f(n)=O(g(n))f(n) = O(g(n)) if there exist constants c>0c > 0 and n0n_0 such that: f(n)cg(n) for all nn0|f(n)| \leq c \cdot |g(n)| \text{ for all } n \geq n_0

Common Growth Rates

O(1)<O(logn)<O(n)<O(nlogn)<O(n2)<O(n3)<O(2n)<O(n!)O(1) < O(\log n) < O(n) < O(n \log n) < O(n^2) < O(n^3) < O(2^n) < O(n!)

Other Notations

  • f(n)=Ω(g(n))f(n) = \Omega(g(n)): ff grows at least as fast as gg
  • f(n)=Θ(g(n))f(n) = \Theta(g(n)): ff grows at the same rate as gg
  • f(n)=o(g(n))f(n) = o(g(n)): ff grows strictly slower than gg

Cardinality of Infinite Sets

Two sets have the same cardinality if there exists a bijection between them.

  • Countably infinite: Same cardinality as N\mathbb{N} (e.g., Z\mathbb{Z}, Q\mathbb{Q})
  • Uncountable: Larger than N\mathbb{N} (e.g., R\mathbb{R}, P(N)\mathcal{P}(\mathbb{N}))

N=Z=Q=0|\mathbb{N}| = |\mathbb{Z}| = |\mathbb{Q}| = \aleph_0 R=P(N)=20=c|\mathbb{R}| = |\mathcal{P}(\mathbb{N})| = 2^{\aleph_0} = \mathfrak{c}