Counting Relations

Why this section exists. Boards ask you to prove properties; JEE Main asks you to count — how many relations, how many functions of each type, how many equivalence relations. Nearly every JEE question from this chapter is a counting question, and they all reduce to a handful of formulas derived below.

The master count: all relations

A relation on a set AA with nn elements is any subset of A×AA \times A, which has n2n^2 ordered pairs. Each pair is independently in or out:

Number of relations on an n-element set=2n2\text{Number of relations on an } n\text{-element set} = 2^{n^2}

For n=3n = 3: 29=5122^9 = 512 relations.

Reflexive relations

Reflexivity forces the nn diagonal pairs (a,a)(a, a) in; the remaining n2−nn^2 - n off-diagonal pairs stay free:

Reflexive relations=2n2−n\text{Reflexive relations} = 2^{n^2 - n}

For n=3n = 3: 26=642^6 = 64.

Symmetric relations

Symmetry ties each pair (a,b)(a, b) to its mirror (b,a)(b, a) — they enter or leave together. The free choices are the nn diagonal pairs plus the n2−n2\frac{n^2 - n}{2} mirror-couples, a total of n(n+1)2\frac{n(n+1)}{2} independent decisions:

Symmetric relations=2n(n+1)2\text{Symmetric relations} = 2^{\frac{n(n+1)}{2}}

For n=3n = 3: 26=642^6 = 64 (equal to the reflexive count only by coincidence at n=3n = 3).

Reflexive AND symmetric

Diagonal forced in, mirror-couples free: n(n−1)2\frac{n(n-1)}{2} decisions,

Reflexive and symmetric relations=2n(n−1)2\text{Reflexive and symmetric relations} = 2^{\frac{n(n-1)}{2}}

For n=3n = 3: 23=82^3 = 8.

Equivalence relations = partitions (Bell numbers)

An equivalence relation is a partition of the set, so counting equivalence relations means counting partitions. These counts are the Bell numbers:

nn 1 2 3 4
equivalence relations 1 2 5 15

For {1,2,3}\{1, 2, 3\} the five are: {1}{2}{3}\{1\}\{2\}\{3\} (the identity relation), three of shape {1,2}{3}\{1,2\}\{3\} (choose which pair merges), and {1,2,3}\{1,2,3\} (the universal relation). There is no closed formula — for JEE, memorise 1,2,5,151, 2, 5, 15.

Warning — transitive relations have no formula either. Questions about "how many transitive relations" are always constrained ones (containing given pairs), solved by hand as in the Board section. Any option pattern suggesting a neat formula for transitive relations is a trap.

Counting Functions

All functions

A function from an mm-element set AA to an nn-element set BB makes a free choice of image for each of the mm inputs:

Number of functions A→B=nm\text{Number of functions } A \to B = n^m

(Memory aid: (co-domain size)domain size(\text{co-domain size})^{\text{domain size}} — the exponent counts the decisions.)

One-one functions

Distinct inputs need distinct images: the first input has nn choices, the next n−1n - 1, and so on —

One-one functions A→B=nPm=n!(n−m)!(m≤n);0 if m>n\text{One-one functions } A \to B = {}^{n}P_{m} = \frac{n!}{(n - m)!} \quad (m \leq n); \qquad 0 \text{ if } m > n

The zero case is a favourite trap: there is no one-one function from a bigger set into a smaller one (pigeonhole).

Onto functions (inclusion–exclusion)

Onto functions A→B=∑k=0n(−1)k(nk)(n−k)m=nm−(n1)(n−1)m+(n2)(n−2)m−⋯\text{Onto functions } A \to B = \sum_{k=0}^{n} (-1)^k \binom{n}{k} (n - k)^m = n^m - \binom{n}{1}(n-1)^m + \binom{n}{2}(n-2)^m - \cdots

Subtract the functions missing at least one target, add back the double-subtracted, and so on. Special cases worth memorising:

onto A→B with ∣B∣=2:2m−2\text{onto } A \to B \text{ with } \vert B \vert = 2: \quad 2^m - 2 onto with m=n:n!onto with m<n:0\text{onto with } m = n: \quad n! \qquad \text{onto with } m < n: \quad 0

Worked count. Onto functions from a 4-element set to a 3-element set: 34−(31)24+(32)14=81−48+3=363^4 - \binom{3}{1}2^4 + \binom{3}{2}1^4 = 81 - 48 + 3 = 36

Bijections

Bijections of an n-element set=n!\text{Bijections of an } n\text{-element set} = n!

and these are simultaneously the one-one self-maps and the onto self-maps (the finite-set collapse).

The summary card

What Count
relations on nn-set 2n22^{n^2}
reflexive 2n2−n2^{n^2 - n}
symmetric 2n(n+1)/22^{n(n+1)/2}
reflexive and symmetric 2n(n−1)/22^{n(n-1)/2}
equivalence relations Bell: 1,2,5,15,…1, 2, 5, 15, \ldots
functions m→nm \to n nmn^m
one-one m→nm \to n nPm^{n}P_{m} (0 if m>nm > n)
onto m→nm \to n ∑(−1)k(nk)(n−k)m\sum (-1)^k \binom{n}{k}(n-k)^m (0 if m<nm < n)
bijections n→nn \to n n!n!

Common mistakes to avoid

Mistake 1 — swapping the exponent: functions m→nm \to n number nmn^m, not mnm^n. The domain size is the exponent.

Mistake 2 — using nPm^nP_m when m>nm > n: the count is 0, not undefined or negative.

Mistake 3 — counting onto with a product: onto needs inclusion-exclusion; simple products overcount.

Mistake 4 — "symmetric" halving done wrong: the diagonal pairs are their own mirrors — they contribute nn free choices, not n2\frac{n}{2}.

JEE-Pattern Worked Examples

Example 1 — All relations

How many relations can be defined on the set A={a,b,c}A = \{a, b, c\}?

Step 1 — count the pairs: ∣A×A∣=32=9\vert A \times A \vert = 3^2 = 9.

Step 2 — each subset of A×AA \times A is a relation: 29=5122^9 = 512.

Answer: 512512.

Example 2 — Reflexive, symmetric, and both

For A={1,2,3}A = \{1, 2, 3\}, count the relations that are (i) reflexive, (ii) symmetric, (iii) both.

Step 1 — (i): the 3 diagonal pairs are forced; the 9−3=69 - 3 = 6 others are free: 26=642^6 = 64.

Step 2 — (ii): free choices are the 3 diagonal pairs and the 3 mirror-couples {(1,2),(2,1)},{(1,3),(3,1)},{(2,3),(3,2)}\{(1,2),(2,1)\}, \{(1,3),(3,1)\}, \{(2,3),(3,2)\}:  23+3=64\ 2^{3+3} = 64.

Step 3 — (iii): diagonal forced, 3 mirror-couples free: 23=82^3 = 8.

Answer: (i) 6464, (ii) 6464, (iii) 88.

Example 3 — All equivalence relations on a 3-set

Count and list the equivalence relations on {1,2,3}\{1, 2, 3\}.

Step 1 — count partitions instead: each equivalence relation is a partition.

Step 2 — enumerate by shape: all separate: {1}{2}{3}\{1\}\{2\}\{3\} — 1 way. One pair together: choose the pair in (32)=3\binom{3}{2} = 3 ways. All together: {1,2,3}\{1,2,3\} — 1 way.

Answer: 1+3+1=51 + 3 + 1 = 5 equivalence relations (the Bell number B3B_3). The smallest is the identity relation, the largest the universal relation.

Example 4 — Functions of each kind, 3→53 \to 5

Let ∣A∣=3\vert A \vert = 3 and ∣B∣=5\vert B \vert = 5. Count (i) all functions A→BA \to B, (ii) one-one functions A→BA \to B, (iii) onto functions A→BA \to B.

Step 1 — (i): 53=1255^3 = 125.

Step 2 — (ii): 5P3=5×4×3=60^5P_3 = 5 \times 4 \times 3 = 60.

Step 3 — (iii): a 3-element domain cannot cover a 5-element co-domain: 00.

Answer: 125125,  60\ 60,  0\ 0 — the three standard counts side by side.

Example 5 — Onto by inclusion-exclusion

Find the number of onto functions from A={1,2,3,4}A = \{1, 2, 3, 4\} to B={a,b,c}B = \{a, b, c\}.

Step 1 — start from all functions and subtract those missing a target: 34−(31)⋅24+(32)⋅143^4 - \binom{3}{1} \cdot 2^4 + \binom{3}{2} \cdot 1^4

Step 2 — compute: 81−3(16)+3(1)=81−48+3=3681 - 3(16) + 3(1) = 81 - 48 + 3 = 36.

Answer: 3636. (Cross-check by direct construction: one target receives two inputs, the others one each — (42)×3!=6×6=36\binom{4}{2} \times 3! = 6 \times 6 = 36 ✓.)

Example 6 — Onto a two-element set

Show that the number of onto functions from an mm-element set onto {0,1}\{0, 1\} is 2m−22^m - 2.

Step 1 — all functions: 2m2^m.

Step 2 — remove the non-onto ones: exactly two functions miss a target — the constant function 0 and the constant function 1.

Answer: 2m−22^m - 2. For m=5m = 5:  32−2=30\ 32 - 2 = 30.

Example 7 — Permutations with a forbidden value

How many one-one functions f:{1,2,3}→{1,2,3}f : \{1, 2, 3\} \to \{1, 2, 3\} satisfy f(1)≠1f(1) \neq 1?

Step 1 — all one-one self-maps: 3!=63! = 6.

Step 2 — subtract those with f(1)=1f(1) = 1: the other two elements permute freely: 2!=22! = 2.

Answer: 6−2=46 - 2 = 4. (Complementary counting — subtract the violators — is the standard JEE move for restricted permutations.)

Example 8 — Building a transitive closure count

On A={1,2,3}A = \{1, 2, 3\}, what is the smallest relation containing (1,2)(1, 2) and (2,3)(2, 3) that is both reflexive and transitive, and how many ordered pairs does it have?

Step 1 — reflexivity contributes (1,1),(2,2),(3,3)(1,1), (2,2), (3,3).

Step 2 — transitivity applied to (1,2)(1,2) and (2,3)(2,3) forces (1,3)(1,3), and no further chains produce anything new.

Step 3 — assemble: R={(1,1),(2,2),(3,3),(1,2),(2,3),(1,3)}R = \{(1,1), (2,2), (3,3), (1,2), (2,3), (1,3)\}.

Answer: 6 ordered pairs. (This "smallest relation with given properties" construction is the engine behind all the counting-with-constraints questions of the Board section.)