Map

Basis
Last updated: Tags: Set Theory

Prerequisites

A map is the precise mathematical name for a rule that sends each element of one set to exactly one element of another. Every function you write in a programming language is a map in this sense. Getting comfortable with the formal definition — and the vocabulary around it — unlocks a large part of modern mathematics.

Definition

Let AA and BB be sets. A map ff from AA to BB, written

f ⁣:AB,f \colon A \to B,

is a rule that assigns to every element aAa \in A exactly one element f(a)Bf(a) \in B.

  • AA is the domain of ff.
  • BB is the codomain of ff.
  • f(a)f(a) is the image of aa under ff (also called the value of ff at aa).

The notation af(a)a \mapsto f(a) (read: ”aa maps to f(a)f(a)”) specifies what ff does to a single element. A complete map specification combines both:

f ⁣:AB,af(a).f \colon A \to B, \quad a \mapsto f(a).

Example. The squaring map on the integers:

f ⁣:ZZ,nn2.f \colon \mathbb{Z} \to \mathbb{Z}, \quad n \mapsto n^2.

Here f(3)=9f(3) = 9, f(2)=4f(-2) = 4, f(0)=0f(0) = 0.

Terminology note. The words map, function, and mapping are used interchangeably in most of mathematics. In analysis, “function” often implicitly carries a notion of continuity, while “map” is the neutral general term.

Image and preimage of sets

You can extend a map from individual elements to whole subsets.

The image of a subset SAS \subseteq A under ff is the set of all values ff produces on SS:

f(S)    {f(a)aS}    B.f(S) \;\coloneqq\; \{f(a) \mid a \in S\} \;\subseteq\; B.

The image of the entire domain, f(A)f(A), is called the range of ff. The range is always a subset of the codomain — but it need not equal the codomain.

The preimage (or inverse image) of a subset TBT \subseteq B is the set of all elements in AA that map into TT:

f1(T)    {aAf(a)T}    A.f^{-1}(T) \;\coloneqq\; \{a \in A \mid f(a) \in T\} \;\subseteq\; A.

Note that f1(T)f^{-1}(T) is well-defined for any map ff — it does not require ff to have an inverse.

Injective, surjective, bijective

These three adjectives classify how a map relates its domain to its codomain.

Injective (one-to-one)

A map f ⁣:ABf \colon A \to B is injective when distinct inputs always produce distinct outputs:

f(a1)=f(a2)    a1=a2.(1)f(a_1) = f(a_2) \;\Rightarrow\; a_1 = a_2. \tag{1}

Equivalently (the contrapositive): a1a2f(a1)f(a2)a_1 \neq a_2 \Rightarrow f(a_1) \neq f(a_2).

An injective map embeds AA inside BB without collisions.

Example. f ⁣:ZZ,  n2nf \colon \mathbb{Z} \to \mathbb{Z},\; n \mapsto 2n is injective: if 2n1=2n22n_1 = 2n_2 then n1=n2n_1 = n_2.

Non-example. g ⁣:ZZ,  nn2g \colon \mathbb{Z} \to \mathbb{Z},\; n \mapsto n^2 is not injective: g(2)=g(2)=4g(2) = g(-2) = 4 but 222 \neq -2.

Surjective (onto)

A map f ⁣:ABf \colon A \to B is surjective when every element of BB is hit by at least one element of AA:

bB,  aA such that f(a)=b.(2)\forall b \in B,\;\exists a \in A \text{ such that } f(a) = b. \tag{2}

Equivalently, the range equals the entire codomain: f(A)=Bf(A) = B.

Example. f ⁣:ZZ,  nn+1f \colon \mathbb{Z} \to \mathbb{Z},\; n \mapsto n + 1 is surjective: for any bZb \in \mathbb{Z}, take a=b1a = b - 1.

Non-example. g ⁣:ZZ,  n2ng \colon \mathbb{Z} \to \mathbb{Z},\; n \mapsto 2n is not surjective: 11 is never in the range, since 2n=12n = 1 has no integer solution.

Bijective

A map that is both injective and surjective is bijective. A bijection pairs every element of AA with exactly one element of BB, with no element of BB left out and none doubled up.

Bijections are the correct notion of “same size” between sets. Two sets AA and BB have the same cardinality if and only if there exists a bijection f ⁣:ABf \colon A \to B. This definition works even for infinite sets.

The identity map

For any set AA, the identity map idA ⁣:AA\mathrm{id}_A \colon A \to A is defined by

idA(a)    afor all aA.\mathrm{id}_A(a) \;\coloneqq\; a \quad \text{for all } a \in A.

It is trivially bijective and serves as the neutral element for composition.

Composition

Given maps f ⁣:ABf \colon A \to B and g ⁣:BCg \colon B \to C, their composition gf ⁣:ACg \circ f \colon A \to C is defined by

(gf)(a)    g(f(a)).(g \circ f)(a) \;\coloneqq\; g(f(a)).

The notation reads right-to-left: apply ff first, then gg. The types must align — the codomain of ff must equal the domain of gg.

Composition satisfies:

  • Associativity: (hg)f=h(gf)(h \circ g) \circ f = h \circ (g \circ f) whenever the types match.
  • Identity laws: fidA=ff \circ \mathrm{id}_A = f and idBf=f\mathrm{id}_B \circ f = f.

Compositions of injections are injective; compositions of surjections are surjective; compositions of bijections are bijective.

Inverse map

If f ⁣:ABf \colon A \to B is bijective, its inverse f1 ⁣:BAf^{-1} \colon B \to A is the unique map satisfying

f1f=idAandff1=idB.f^{-1} \circ f = \mathrm{id}_A \qquad \text{and} \qquad f \circ f^{-1} = \mathrm{id}_B.

Concretely, f1(b)f^{-1}(b) is the unique element aAa \in A with f(a)=bf(a) = b.

A map has an inverse if and only if it is bijective. This is why bijections are also called invertible maps.

Summary

  • A map f ⁣:ABf \colon A \to B assigns each element of the domain AA exactly one element in the codomain BB.
  • f(a)Bf(a) \in B is the image of aa; the set f(A)f(A) is the range of ff (a subset of the codomain).
  • f1(T)f^{-1}(T) is the preimage of TBT \subseteq B and is defined for any map.
  • Injective (1)(1): distinct inputs give distinct outputs — no collisions.
  • Surjective (2)(2): every element of the codomain is hit — the range fills BB.
  • Bijective: both; the map is invertible and witnesses that A=B|A| = |B|.
  • Composition gfg \circ f applies ff then gg; it is associative and respects injectivity/surjectivity/bijectivity.
  • A bijection has a unique inverse f1 ⁣:BAf^{-1} \colon B \to A.