On this page
"How many relations are there from A to B?" "How many onto functions?" These questions take thirty seconds if you know what is being counted and five minutes of listing if you do not. Every formula here comes from one idea: decide what the free choices are, then multiply. This post builds each count from that idea, checks it on a small case, and lists the traps.
Where is this in the syllabus?
Unit 1 of the JEE (Main) 2026 syllabus covers "Relations, type of relations, equivalence relations, functions; one-one, into and onto functions". The CBSE 2026-27 curriculum puts relations and functions in Class 11 and types of relations and one-one and onto functions in Class 12. NCERT's Class 11 chapter on relations and functions states the number of relations from A to B, and the Class 12 chapter on relations and functions counts one-one maps and equivalence relations in its examples. Both are reprint 2026-27. Check the documents for your exam year.
How many relations are there from A to B?
A relation from A to B is any subset of A × B. If n(A) = m and n(B) = n, then A × B has mn pairs, and each pair is either in or out. So there are 2^(mn) relations. NCERT's Example 9 uses A = {1, 2} and B = {3, 4}: A × B has 4 pairs, giving 2⁴ = 16 relations.
How many functions, one-one maps and onto maps?
Take A = {1, 2, 3, 4} and B = {a, b, c}, so m = 4 and n = 3.
Relations: 2^(4 × 3) = 2¹² = 4096.
Functions A → B: each of the 4 elements picks one of 3 images, so 3⁴ = 81. Only 81 of the 4096 relations are functions.
One-one A → B: 0, because 4 elements cannot have 4 different images in a 3-element set.
One-one B → A: 4 × 3 × 2 = 24, the formula n!/(n − m)! with the roles swapped.
Onto A → B: start with all 81, subtract maps missing a chosen element of B (3 × 2⁴ = 48), and add back those missing two (3 × 1⁴ = 3). That gives 81 − 48 + 3 = 36.
Check the onto count another way. One element of B must receive two elements of A: choose it (3 ways), choose its pair from A (C(4, 2) = 6 ways), and send the other two elements of A to the other two elements of B (2 ways). That gives 3 × 6 × 2 = 36.
How many relations on one set have a given property?
Now let A have n elements, so A × A has n² pairs: n diagonal pairs (a, a) and n² − n others.
All relations: 2^(n²).
Reflexive: every diagonal pair must be in, and the other n² − n are free: 2^(n² − n).
Symmetric: the n diagonal pairs are free, and the n(n − 1)/2 off-diagonal pairs come in matched couples that are in or out together: 2^(n + n(n − 1)/2) = 2^(n(n + 1)/2).
Reflexive and symmetric: only the couples are free: 2^(n(n − 1)/2).
For n = 3: 2⁹ = 512 relations, 2⁶ = 64 reflexive, 2⁶ = 64 symmetric, and 2³ = 8 both.
How do you count equivalence relations?
An equivalence relation splits the set into groups, so count the ways to split it. For {1, 2, 3}: all together; {1, 2} with {3}; {1, 3} with {2}; {2, 3} with {1}; or all separate. That makes 5. NCERT's Example 24 asks for equivalence relations on {1, 2, 3} containing (1, 2) and (2, 1) and finds two. The splitting view agrees: 1 and 2 must share a group, which leaves only "all together" or "{1, 2} with {3}". For a 4-element set, the count of such splits is 1 + 7 + 6 + 1 = 15.
Which mistakes cost marks?
Adding instead of multiplying. Relations from A to B number 2^(mn), not 2^(m + n).
Swapping base and exponent in n^m.
Subtracting only constant maps for onto counts. That works only when B has 2 elements.
Forgetting the empty relation. It counts as a relation, and it is symmetric and transitive but not reflexive on a non-empty set.
Treating (a, b) and (b, a) as one pair when counting all relations. They are separate except in the symmetric count.
For the definitions behind these counts, see our posts on sets and relations and counting without double counting.
A practice routine
Mixing problem types trains the choice of formula. In a study of 126 seventh-grade students over three months, Rohrer, Dedrick and Stershic (2015) found that interleaved practice gave higher test scores than blocked practice, both one day and 30 days later.
Small-case check (twice a week): for 2-element sets, list every relation or function by hand and confirm the formula.
Free-choice sentence: before using a formula, write one line on what is being chosen.
Two routes for onto: inclusion-exclusion and the grouping argument should agree.
Mixed set (weekly): combine these with permutation and probability questions.
If a count still feels like guesswork, the Fermi Concept Library covers every concept in physics, chemistry, biology, mathematics and computing, so you can go back to the definition of a relation.
Today, count the onto functions from a 5-element set to a 3-element set both ways. You should get 150.



