Skip to main content

Surjective Function

A surjective function in combinatorics is a function whose range equals its codomain, so every output value is hit by at least one input. It shows up often in pigeonhole principle problems and counting distributions.

Last updated July 2026•Fiveable Content Team

What is Surjective Function?

A surjective function in Combinatorics is a function that hits every element of the codomain at least once. Another name for this is an onto function. If a function f: A -> B is surjective, then for every b in B, there is some a in A with f(a) = b.

That sounds simple, but it matters because combinatorics often asks whether a set of objects can cover a set of choices with no gaps. Surjectivity is the condition that says, “yes, every target gets used.” If even one codomain element is never produced, the function is not surjective.

A good way to think about it is as a distribution problem. The domain is the set of things you are assigning, and the codomain is the set of destinations or labels. Surjective means every destination gets at least one assignment, even if some get more than one. That is very different from one-to-one behavior, where you try to avoid repeats.

Here is a compact example. Suppose A = {1, 2, 3} and B = {red, blue}. A function from A to B can be surjective if, say, 1 maps to red, 2 maps to blue, and 3 maps to red. Both colors appear, so the codomain is fully covered. But if all three inputs mapped to red, the function would fail to be surjective because blue never appears.

In combinatorics, surjectivity often shows up when you count functions with a condition attached, especially when you want every box, category, or label to be used. It also connects directly to the Pigeonhole Principle. If the domain is smaller than the codomain, a surjective function is impossible, because there are not enough inputs to hit every output at least once.

A common mistake is mixing up codomain and range. The range is what the function actually reaches, while the codomain is the full set of allowed outputs. Surjective means those two sets match. If you only check where a few inputs go, you might miss a codomain element that never gets used.

Why Surjective Function matters in COMBINATORICS

Surjective functions matter in Combinatorics because they turn a counting problem into a coverage problem. Instead of asking only how many functions exist, you ask how many functions hit every output at least once. That extra condition changes the structure of the problem and is often the whole point of the question.

This comes up any time you are distributing items into labeled groups. If you are assigning students to project topics, placing objects into bins, or mapping elements into categories, surjectivity tells you whether every category is represented. That makes it a natural fit for counting arguments, where you need to decide whether a situation is possible before you even count it.

It also gives a clean way to use the Pigeonhole Principle. If there are fewer inputs than outputs, a surjection cannot exist. If there are enough inputs, you still have to check whether the assignment actually covers every output. That back-and-forth between possibility and counting is a big part of combinatorics reasoning.

Surjective functions also show up in problems involving probabilities or distributions, especially when every outcome must appear at least once. If you see language like “each box must get an object” or “every category must be used,” surjectivity is probably hiding underneath.

Keep studying COMBINATORICS Unit 4

Official unit cheatsheet

open one-pager

How Surjective Function connects across the course

Injective Function

An injective function avoids collisions, meaning different inputs never land on the same output. A surjective function is the opposite kind of condition in a different direction: it cares about whether every codomain element gets hit. In combinatorics, you often compare the two because one is about uniqueness and the other is about coverage.

Bijective Function

A bijective function is both injective and surjective, so it is a perfect one-to-one matching between domain and codomain. In counting, bijections are powerful because they let you translate one set of objects into another without losing or duplicating anything. Surjectivity is one half of that story.

Codomain

You cannot decide whether a function is surjective unless you know the codomain. That is because surjectivity depends on whether every allowed output is actually reached. A lot of confusion comes from checking only the range and forgetting that the codomain is the full target set.

Strong Pigeonhole Principle

The Strong Pigeonhole Principle is a sharper version of the basic idea that if you spread items across boxes, some box must contain many items. Surjective functions sit near this idea because they describe when every box gets at least one item. When the numbers force coverage or repetition, the two ideas work together.

Is Surjective Function on the COMBINATORICS exam?

A problem set question may ask you to decide whether a function is surjective, or to count the number of surjections from one finite set to another. The move is simple: check the codomain first, then show every output is hit or give a reason one output cannot be reached. If the domain has fewer elements than the codomain, you can rule out surjectivity immediately.

You may also see surjective functions in counting questions about labeled boxes or categories. In those problems, you are usually checking whether every label appears at least once, often before using a counting argument or a distribution method. If the question uses words like “onto,” “covers all outputs,” or “no category is left empty,” that is your clue to think surjective.

Surjective Function vs Injective Function

These get mixed up because both describe how a function behaves with inputs and outputs, but they test different things. Injective means no two inputs share the same output, while surjective means every codomain element is reached by at least one input. A function can be one, the other, both, or neither.

Key things to remember about Surjective Function

  • A surjective function is onto, which means every element of the codomain has at least one preimage in the domain.

  • To check surjectivity, compare the function’s actual outputs to its codomain, not just to a few sample values.

  • Surjective functions show up in combinatorics when you need every box, label, or category to be used at least once.

  • If the domain has fewer elements than the codomain, a surjective function cannot exist.

  • The range is the set of outputs the function actually reaches, and surjectivity means the range equals the codomain.

Frequently asked questions about Surjective Function

What is surjective function in Combinatorics?

A surjective function in Combinatorics is a function that hits every element of the codomain at least once. In other words, no allowed output is left unused. This matters in counting and distribution problems where every category or box has to be filled.

How do you know if a function is surjective?

Check whether every element of the codomain is reached by some input. If even one codomain element never appears as an output, the function is not surjective. A fast shortcut is to notice whether the domain is too small to cover the codomain at all.

What is the difference between surjective and injective?

Injective functions avoid duplicate outputs, while surjective functions avoid missing outputs. Injective is about uniqueness, and surjective is about coverage. A function can satisfy one condition without satisfying the other.

Why does surjective function matter for the Pigeonhole Principle?

Surjectivity connects to the Pigeonhole Principle because both describe how items land in boxes or outputs. If there are too few inputs, you cannot hit every codomain element, so a surjection is impossible. That gives you a clean counting contradiction in many combinatorics proofs.