mindstair

Home / Courses / Intro to Proofs / Unit 8

Intro to Proofs Unit 8: Functions: Injective, Surjective, Bijective

Functions are the links between sets. This unit defines injective, surjective and bijective functions, shows how to prove each property, and connects them to composition, inverses and counting.

Covers: Domain, codomain and range, Injective functions, Surjective functions, Bijections and inverse functions, Composition of functions, Images and preimages of sets, Counting functions between finite sets

Study guide

A function f: A → B assigns to each element of the domain A exactly one element of the codomain B. The range or image f(A) = {f(a) : a ∈ A} is the set of outputs actually produced, which may be smaller than B. The same rule can have different properties depending on the domain and codomain: x² is neither injective nor surjective as a map ℝ → ℝ, surjective as a map ℝ → [0, ∞), and bijective as a map [0, ∞) → [0, ∞). So always state the domain and codomain before asking whether a function is one-to-one or onto.

f is injective (one-to-one) if f(a₁) = f(a₂) implies a₁ = a₂: distinct inputs give distinct outputs. To prove it, assume f(a₁) = f(a₂) and use algebra to show a₁ = a₂. To disprove it, give two different inputs with the same output. f is surjective (onto) if for every b ∈ B there is some a ∈ A with f(a) = b. To prove it, take an arbitrary b, find a candidate a (often by solving f(a) = b), check that a is in the domain, and verify f(a) = b. To disprove it, name a b that is never hit.

f is bijective if it is both injective and surjective, and exactly then it has an inverse f⁻¹: B → A with f⁻¹(f(a)) = a and f(f⁻¹(b)) = b. Find the inverse by solving y = f(x) for x. Composition (g ∘ f)(x) = g(f(x)) applies f first. Compositions of injections are injective and of surjections are surjective. Going backward, if g ∘ f is injective then f is injective, and if g ∘ f is surjective then g is surjective. If g ∘ f = id_A, then f is injective and g is surjective, but neither need be a bijection.

For S ⊆ A, the image is f(S) = {f(x) : x ∈ S}, and for C ⊆ B the preimage is f⁻¹(C) = {x ∈ A : f(x) ∈ C}. The preimage makes sense even when f has no inverse. Preimages respect unions, intersections and complements exactly, but images only satisfy f(S ∩ T) ⊆ f(S) ∩ f(T). For finite sets with |A| = m and |B| = n there are nᵐ functions and n(n − 1)⋯(n − m + 1) injections, and surjections are counted by inclusion-exclusion. When |A| = |B| is finite, injective and surjective are equivalent.

Key ideas

Formulas and rules

Injective: f(a₁) = f(a₂) ⇒ a₁ = a₂
Surjective: ∀b ∈ B ∃a ∈ A, f(a) = b
(g ∘ f)(x) = g(f(x))
f⁻¹(C) = {x ∈ A : f(x) ∈ C}
Number of functions A → B: |B|^|A|; injections: n!/(n − m)!
Surjections from 4 elements onto 3: 3⁴ − 3·2⁴ + 3·1⁴ = 36

Common mistakes

Before the test, make sure you can

Words to know

Function
A rule f: A → B giving each element of A exactly one element of B.
Domain
The set A of allowed inputs of f: A → B.
Codomain
The set B in which outputs of f: A → B must lie.
Range (image)
f(A) = {f(a) : a ∈ A}, the set of outputs actually produced.
Injective
One-to-one: f(a₁) = f(a₂) implies a₁ = a₂.
Surjective
Onto: every element of the codomain equals f(a) for some a.
Bijective
Both injective and surjective; a one-to-one correspondence.
Inverse function
f⁻¹: B → A with f⁻¹(f(a)) = a and f(f⁻¹(b)) = b; exists iff f is bijective.
Composition
(g ∘ f)(x) = g(f(x)): apply f, then g.
Identity function
id_A(a) = a for every a ∈ A.
Image of a set
f(S) = {f(x) : x ∈ S}.
Preimage
f⁻¹(C) = {x : f(x) ∈ C}, defined for every function.
Left inverse
A function g with g ∘ f = id; exists exactly when f is injective (for nonempty domain).
Pigeonhole principle
If m > n objects go into n boxes, some box gets two; no injection exists from a larger finite set to a smaller one.

Sample practice questions

30 more questions like these, from level 1 to 5, are in the practice set.

Question 1 (level 1)

A function f: A → B is a rule that:

  1. Assigns each element of A exactly one element of B
  2. Assigns each element of A at least one element of B
  3. Uses every element of B as an output
  4. Assigns each element of B exactly one element of A
Show the answer and steps

Answer: A) Assigns each element of A exactly one element of B

  1. A function needs one and only one output for every input in its domain A.
  2. Elements of B may be used once, many times, or not at all.
  3. Using every element of B is surjectivity, an extra property.
Question 2 (level 1)

A function f: A → B is injective (one-to-one) when:

  1. Every b ∈ B equals f(a) for some a
  2. f(a₁) = f(a₂) implies a₁ = a₂
  3. a₁ = a₂ implies f(a₁) = f(a₂)
  4. f(a) = a for every a ∈ A
Show the answer and steps

Answer: B) f(a₁) = f(a₂) implies a₁ = a₂

  1. Injective means different inputs give different outputs.
  2. The contrapositive form is: a₁ ≠ a₂ implies f(a₁) ≠ f(a₂).
  3. 'a₁ = a₂ implies f(a₁) = f(a₂)' holds for every function, so it says nothing.
Question 3 (level 3)

How many injective functions are there from {1, 2, 3} to {1, 2, 3, 4, 5}?

  1. 10
  2. 60
  3. 15
  4. 125
Show the answer and steps

Answer: B) 60

  1. The image of 1 has 5 choices, then 2 has 4 remaining choices, then 3 has 3.
  2. 5 × 4 × 3 = 60.
  3. 125 = 5³ counts all functions, and 10 = C(5, 3) ignores which input goes where.