The codomain of a function *f*:**A** → **B** is {`x` : there is some `a` in **A** such that *f*(`a`) = `x`}, or, in Eindhoven notation, (∪ : `a` ∈ **A** : {*f*(`a`)}).

If the codomain of a function *f*:**A** → **B** is **C**, and **B** = **C** (i.e. if the range is equal to the codomain), then *f* is surjective. If **B** ≠ **C**, then there is a function *g*:**A** → **C** such that *g*(`x`) = *f*(`x`), and *g* is surjective.

Compare with domain and range.