# Surjective function

A function $$f:A \to B$$ is surjective if every $$b \in B$$ has some $$a \in A$$ such that $$f(a) = b$$. That is, its codomain is equal to its image.

This concept is commonly referred to as being “onto”, as in “The function $$f$$ is onto.”

# Examples

• The function $$\mathbb{N} \to \{ 6 \}$$ (where $$\mathbb{N}$$ is the set of natural numbers) given by $$n \mapsto 6$$ is surjective. However, the same function viewed as a function $$\mathbb{N} \to \mathbb{N}$$ is not surjective, because it does not hit the number $$4$$, for instance.

• The function $$\mathbb{N} \to \mathbb{N}$$ given by $$n \mapsto n+5$$ is not surjective, because it does not hit the number $$2$$, for instance: there is no $$a \in \mathbb{N}$$ such that $$a+5 = 2$$.

Parents: