On this page
Every relations-and-functions chapter has this question somewhere: if A has m elements and B has n elements, how many relations are there from A to B? The answer is 2ᵐⁿ, and once you see why, you will not need to memorise it.
What is a relation from A to B?
Start with the Cartesian product. NCERT's Class 11 Mathematics textbook defines A × B as the set of all ordered pairs (a, b) with a in A and b in B, and notes that if n(A) = p and n(B) = q, then n(A × B) = pq (NCERT Class 11 Mathematics, Chapter 2).
A relation from A to B is a subset of the Cartesian product A × B, according to Definition 2 in the same chapter (NCERT, Chapter 2). You pick some of the pairs, and the pairs you picked are the relation; no neat rule is required.
If the pairs themselves feel shaky, our explainer on what the Cartesian product A × B contains walks through them first.
How many relations are there from A to B?
Counting relations is the same as counting subsets of A × B. Here is the argument in three steps.
List the pairs. A × B has m × n of them.
Build a relation by going down the list and deciding, for each pair, "in" or "out". That is two choices per pair.
The choices are independent, so multiply: 2 × 2 × ... × 2, with one factor for each of the mn pairs.
So the number of relations from A to B is 2ᵐⁿ. NCERT states the same result in a note in Chapter 2: if n(A) = p and n(B) = q, then n(A × B) = pq and the total number of relations is 2^pq (NCERT, Chapter 2).
The same in-or-out reasoning is behind why a set with n elements has 2ⁿ subsets.
Worked example: A = {1, 2} and B = {a, b, c}
Here m = 2 and n = 3, so A × B has 6 pairs: (1, a), (1, b), (1, c), (2, a), (2, b), (2, c). Each is in or out, so there are 2⁶ = 64 relations.
You can check 64 another way by sorting the relations by how many pairs they contain. Choosing k pairs out of 6 can be done in ⁶Cₖ ways:
0 pairs: 1 relation (the empty relation)
1 pair: 6 relations
2 pairs: 15 relations
3 pairs: 20 relations
4 pairs: 15 relations
5 pairs: 6 relations
6 pairs: 1 relation (A × B itself)
The total is 1 + 6 + 15 + 20 + 15 + 6 + 1 = 64, which matches. NCERT's own Example 9 is smaller: with A = {1, 2} and B = {3, 4}, A × B has 4 pairs and there are 2⁴ = 16 relations (NCERT, Chapter 2).
The same lens answers the variants examiners like. How many relations contain the pair (1, a)? Fix that pair as in and choose freely for the other 5: 2⁵ = 32, exactly half. How many relations have exactly 3 pairs? ⁶C₃ = 20. For a closer look at the two extreme cases, read our post on empty and universal relations with examples.
Why is the answer not mn, or 2ᵐ × 2ⁿ?
mn counts pairs, not relations. It is the size of A × B, one step before the answer.
2ᵐ × 2ⁿ = 2ᵐ⁺ⁿ counts a subset of A together with a subset of B. A relation chooses pairs, and there are mn of them, not m + n. For m = 2 and n = 3 this gives 32 instead of 64.
nᵐ counts functions from A to B, where each element of A must pick exactly one partner in B. Every function is a relation, but most relations are not functions: with m = 2 and n = 3 there are 3² = 9 functions among the 64 relations.
The same rule covers relations on A (from A to A): A × A has m² pairs, so there are 2^(m²) relations, and a 3-element set has 2⁹ = 512.
A 30-second check before you write the answer
Find n(A) and n(B).
Multiply to get the number of pairs in the product asked about (A × B, B × A or A × A).
Read what is being counted: all relations, relations containing a given pair, relations of a given size, or functions.
Use 2^(pairs), 2^(pairs − 1), C(pairs, k) or nᵐ accordingly.
Sanity-check with a tiny case, such as m = n = 1: one pair, so two relations.
If you get stuck on a variant, try it in the Fermi Problem Library, where a step-by-step solver explains the reasoning rather than printing an answer. To revise sets, Cartesian products and relations as connected ideas, the Fermi Concept Library gives each concept its own lesson and its place in the map.



