- 1. What is a relation, really?
- 2. Types of relations: empty, universal, reflexive, symmetric, transitive
- 3. When is a relation an equivalence relation?
- 4. Sorting a set into boxes: equivalence classes
- 5. How many relations? Counting with pairs
- 6. Different inputs, different outputs: one-one (injective) functions
- 7. Is every output used? Onto (surjective) functions
- 8. Both at once: bijective functions, and the finite vs infinite surprise
- 9. How many functions? Counting maps between finite sets
- 10. One function after another: composition of functions
- 11. Running a function backwards: invertible functions
- Review
9 of 11·NCERT §1.3·5 min
How many functions? Counting maps between finite sets
The big ideaFrom a set of m elements to a set of n elements there are \( n^m \) functions, because each input picks its output independently; one-one, bijective and onto functions are counted with permutations and a little care.
In simple words
Three children each choose an ice cream from two flavours. Each child has 2 choices, and the choices don't affect each other, so there are 2 × 2 × 2 = 8 ways. A function is exactly this: every input picks one output. If no two children may pick the same flavour, the count is smaller. If every flavour must be picked by someone, it changes again.
Not in the current textbook, but JEE asks it: NCERT counts one case (the one-one functions from {1, 2, 3} to itself are its 3! = 6 rearrangements) and asks for the onto functions from {1, 2, …, n} to itself. JEE asks the general counts below, using the permutations and combinations from Class 11.
Guess first: which way round?
A = {1, 2, 3} and B = {a, b}. Guess: how many functions are there from A to B: \( 3^2 = 9 \), \( 2^3 = 8 \), or \( 3 \times 2 = 6 \)?
See what happens
The counts
Let A have \( m \) elements and B have \( n \) elements.
| Kind of function A → B | Count | Why |
|---|---|---|
| All functions | \( n^m \) | each of the m inputs picks one of n outputs |
| One-one (needs m ≤ n) | \( ^n\text{P}_m = \frac{n!}{(n-m)!} \) | first input: n choices, next: n − 1, …, no repeats allowed |
| One-one when m > n | 0 | more inputs than outputs: two must share |
| Bijective (needs m = n) | \( n! \) | a rearrangement of n things |
| Onto a 2-element set | \( 2^m - 2 \) | all functions minus the 2 constant ones |
| Many-one | \( n^m - {}^n\text{P}_m \) | all minus one-one |
| Into (not onto) | \( n^m - \) (number onto) | all minus onto |
For onto in general, JEE uses inclusion-exclusion (subtract the functions that miss an output, add back those that miss two, and so on):
\[ \text{onto}(m \to n) = n^m - \binom{n}{1}(n-1)^m + \binom{n}{2}(n-2)^m - \cdots \]
Here \( \binom{n}{k} \) is the same as \( ^n\text{C}_k \), the number of ways to choose which k outputs to leave out.
Try it: guess first, then see every function at once and check each term of the onto count.
Worked examples
- A = {1, 2, 3}, B = {a, b, c, d}. All functions: \( 4^3 = 64 \). One-one: \( 4 \times 3 \times 2 = 24 \). Onto: 0, since 3 inputs can't cover 4 outputs. Many-one: \( 64 - 24 = 40 \).
- Onto functions from a 4-set to a 3-set. Inclusion-exclusion: \( 3^4 - 3 \cdot 2^4 + 3 \cdot 1^4 = 81 - 48 + 3 = 36 \). Check another way: exactly one output is hit twice. Choose which 2 of the 4 inputs share: \( ^4\text{C}_2 = 6 \). Now there are 3 "groups" to match with 3 outputs: \( 3! = 6 \). Total \( 6 \times 6 = 36 \).
- Onto functions from {1, 2, …, n} to itself. On a finite set onto means one-one (previous page), so these are exactly the bijections: \( n! \).
- Onto functions from a 5-set to a 3-set. \( 3^5 - 3 \cdot 2^5 + 3 \cdot 1^5 = 243 - 96 + 3 = 150 \).
All of these were checked by listing every function by computer.
Don't mix these up
- Functions A → B: \( n^m \), outputs to the power inputs. Relations A → B: \( 2^{mn} \).
- One-one needs m ≤ n; onto needs m ≥ n; bijective needs m = n.
- Onto ≠ "all minus the constant ones" except when the co-domain has 2 elements.
Try it. A has 2 elements and B has 5. How many functions from A to B are one-one? How many are onto?
Answer
- \( n^m \)
- The number of functions from an m-element set to an n-element set.
- \( ^n\text{P}_m \)
- Ordered choices of m different things from n: the one-one count.
- \( n! \)
- n × (n − 1) × … × 1: the number of bijections of an n-set.
- Constant function
- Sends every input to the same output.
- Inclusion-exclusion
- Subtract overlaps, add back double-subtractions, and so on.
Words to know
How many functions are there from {1, 2, 3} to {p, q, r, s}?
- 81
- 64
- 12
How many onto functions are there from {1, 2, 3, 4} to {x, y}?
- 14
- 16
- 6
How many one-one functions are there from {1, 2, 3} to {1, 2, 3, 4, 5}?
- 125
- 10
- 60
Picture and video credits