Mathwords logoMathwords

Surjection (Surjective Function) — Definition, Formula & Examples

A surjection is a function where every element in the codomain is mapped to by at least one element in the domain. In other words, the function 'hits' every possible output value — nothing in the codomain is left out.

A function f:ABf: A \to B is surjective (onto) if for every bBb \in B, there exists at least one aAa \in A such that f(a)=bf(a) = b. Equivalently, the range of ff equals its codomain: f(A)=Bf(A) = B.

Key Formula

bB,  aA   such that   f(a)=b\forall\, b \in B,\; \exists\, a \in A \;\text{ such that }\; f(a) = b
Where:
  • AA = The domain of the function
  • BB = The codomain of the function
  • ff = The function from A to B

How It Works

To show a function is surjective, pick an arbitrary element bb in the codomain and demonstrate that you can solve f(a)=bf(a) = b for some aa in the domain. If you can always find such an aa, the function is onto. To show a function is not surjective, find a single element in the codomain that no input maps to. The distinction between codomain and range is critical here: a surjection is precisely a function whose range and codomain coincide.

Worked Example

Problem: Let f:RRf: \mathbb{R} \to \mathbb{R} be defined by f(x)=2x+3f(x) = 2x + 3. Prove that ff is surjective.
Pick an arbitrary element in the codomain: Let bb be any real number in the codomain R\mathbb{R}. We need to find an aRa \in \mathbb{R} such that f(a)=bf(a) = b.
f(a)=2a+3=bf(a) = 2a + 3 = b
Solve for a: Rearrange the equation to isolate aa.
a=b32a = \frac{b - 3}{2}
Verify the solution is in the domain: Since bb is any real number, b32\frac{b-3}{2} is also a real number, so aRa \in \mathbb{R}. Therefore, for every bRb \in \mathbb{R}, we found an aa with f(a)=bf(a) = b.
f ⁣(b32)=2b32+3=bf\!\left(\frac{b-3}{2}\right) = 2\cdot\frac{b-3}{2} + 3 = b
Answer: Since every real number bb has a preimage a=b32a = \frac{b-3}{2}, the function f(x)=2x+3f(x) = 2x+3 is surjective.

Why It Matters

Surjectivity is essential in linear algebra (determining whether a linear transformation spans the target space) and in abstract algebra (classifying homomorphisms). In discrete math and computer science, proving that a function is both injective and surjective (bijective) is the standard technique for showing two sets have the same cardinality.

Common Mistakes

Mistake: Confusing range with codomain and concluding every function is surjective because it maps to its range.
Correction: Surjectivity depends on the specified codomain, not just the range. For example, f:RRf: \mathbb{R} \to \mathbb{R} defined by f(x)=x2f(x) = x^2 is not surjective because negative numbers in the codomain have no preimage, even though the range [0,)[0, \infty) is fully covered.