AP Exams (Advanced Placement) · Mathematics (JEE & NDA)
Sets, Relations and Functions
Set operations and algebra, types of relations, equivalence relations, and one one, onto and composite functions.
Seven concepts from counting through maps: inclusion-exclusion and power sets, the three relation axioms and equivalence, then injectivity, surjectivity, counting functions, composition and natural domain.
- AP Exams (Advanced Placement)
- Easy level
- 7 concepts
- 5 practice questions
1Inclusion-exclusion for two sets
For finite sets, the size of a union is not the sum of the sizes. Each element of the intersection would be counted twice if you added n(A) and n(B) alone, so n(A\cup B)=n(A)+n(B)-n(A\cap B). For three sets the same idea continues: add the singles, subtract the pairwise overlaps, then add back the triple overlap that was subtracted too often.
When a problem gives a universal set and asks how many elements lie in none of the named subsets, compute the union first and subtract from the total.
Figure. Partition of A\cup B into only A, the overlap A\cap B, and only B. Adding n(A)+n(B) counts the overlap twice, so subtract it once.
How it works
- Add the partsWrite n(A)+n(B). Every element of A\cap B has been counted twice.
- Subtract the overlap onceReplace the double count by a single count: subtract n(A\cap B).
- Neither, if askedIf a universe U is given, n(U)-n(A\cup B) is the count outside both sets.
Counting with two sets
In a class of 40 students, 25 play cricket, 20 play football and 10 play both. How many play neither game?
- n(C\cup F)=25+20-1035
- Neither =40-355
Pro tip. Always subtract the intersection once when adding two sets; forgetting it double-counts the overlap.
If n(A)=12, n(B)=9 and n(A\cup B)=15, then n(A\cap B) equals
- 6
- 3
- 21
Rearrange: n(A\cap B)=n(A)+n(B)-n(A\cup B)=12+9-15=6. The trap 21 adds instead of subtracting; 3 undercounts the overlap.
2Subsets of a finite set
A set with n elements has 2^n subsets: for each element there are two choices — include it or leave it out — and the choices multiply. That count includes the empty set and the set itself.
The number of non-empty subsets is therefore 2^n-1. "Proper subset" wording in a question needs a careful read: some papers exclude only the set itself, others also exclude the empty set — match the definition the paper is using.
Figure. A 4-element set has 2^4=16 subsets, one yes-or-no choice per element. Dropping the empty set leaves 16-1=15 non-empty subsets.
How it works
- One bit per elementLabel the elements 1,\ldots,n. A subset is a choice of yes/no for each label.
- MultiplyIndependent binary choices give 2\times 2\times\cdots\times 2=2^n subsets.
- Drop the empty set if askedNon-empty count is 2^n-1.
Power set of a 4-set
How many subsets does a set with 4 elements have? How many of them are non-empty?
- Total subsets =2^416
- Non-empty =16-115
Pro tip. Write 2^n first; subtract 1 only when the question has ruled out the empty set.
A set has 32 subsets. How many elements does it have?
- 5
- 16
- 32
2^n=32 forces n=5. Sixteen is half of 32, not the exponent; 32 confuses the subset count with the cardinality.
3Reflexive, symmetric, transitive
A relation R on a set A is a subset of A\times A. Three properties are examined constantly: R is reflexive if aRa for every a\in A; symmetric if aRb always forces bRa; transitive if aRb and bRc together force aRc.
Each property is independent of the others. A relation can be symmetric and not transitive, reflexive and not symmetric, and so on — the exam asks you to test the definition, not to guess from a name.
Check the three axioms on pairs: a loop at every element (reflexive), every arrow reversible (symmetric), and closed chains (transitive). The table in this concept lists all three.
How to test
- Fix the ground setWrite A explicitly. Reflexivity is meaningless until you know every element that must appear on the diagonal.
- Check each axiomFor a finite R, scan pairs for the symmetric and transitive failures; confirm every (a,a) for reflexivity.
- Name only what holdsReport each property that survives. Do not call it an equivalence until all three hold.
| Property | What you must check | Typical failure |
|---|---|---|
| Reflexive | aRa for every a\in A | A diagonal pair (a,a) is missing |
| Symmetric | aRb\Rightarrow bRa | (a,b) is in R but (b,a) is not |
| Transitive | aRb and bRc\Rightarrow aRc | A chain of two pairs with no closing pair |
On A=\{1,2,3\}, the relation R=\{(1,1),(2,2),(3,3),(1,2)\} fails to be
- Reflexive
- Symmetric
- A relation on A at all
Every diagonal pair is present, so R is reflexive, and it is a subset of A\times A. It fails symmetry because (1,2)\in R but (2,1)\notin R.
4Equivalence relations and partitions
A relation that is reflexive, symmetric and transitive is an equivalence relation. Equivalence relations are exactly the relations that partition the ground set into disjoint equivalence classes: a and b lie in the same class precisely when aRb.
Counting equivalence relations on a finite set is the same as counting partitions of that set — the Bell numbers. On a 3-element set there are exactly 5 equivalence relations.

How it works
- Confirm all three axiomsReflexive, symmetric and transitive — miss one and it is not an equivalence.
- Read the classesThe class of a is \{x: aRx\}. Distinct classes are disjoint and their union is A.
- Count via partitionsEach partition of A is the class set of exactly one equivalence relation. For |A|=3 the Bell number is 5.
| Partition shape | Number | Classes |
|---|---|---|
| One block of three | 1 | \{\{a,b,c\}\} |
| One pair and a singleton | 3 | \{\{a,b\},\{c\}\} and the two swaps |
| Three singletons | 1 | \{\{a\},\{b\},\{c\}\} |
The number of equivalence relations on a set with 3 elements is
- 5
- 3
- 8
Bell number B_3=5: one partition into a single triple, three into a pair-plus-singleton, and one into three singletons. Three counts only the pair-plus-singleton shape; eight is 2^3, the relation count with no axioms.
5One-one, onto and bijective
A function f:A\to B is one-one (injective) when distinct inputs give distinct outputs: f(x_1)=f(x_2) forces x_1=x_2. It is onto (surjective) when every element of B is an image. It is bijective when it is both.
Only bijections are invertible. When an inverse exists, f^{-1}(f(x))=x and f(f^{-1}(y))=y. A calculus shortcut for injectivity on an interval: if f' keeps a constant sign, f is strictly monotonic and therefore one-one.
Figure. y=x^3 is strictly increasing, hence one-one; y=x^2 fails injectivity because two x-values share each positive height. Onto depends on the chosen codomain.
How to test
- One-oneAssume f(x_1)=f(x_2) and deduce x_1=x_2, or show f' does not change sign on the interval.
- OntoFor an arbitrary y\in B, solve f(x)=y and show a solution in A always exists.
- InverseDeclare invertibility only after both tests pass.
| Type | Meaning | Inverse? |
|---|---|---|
| One-one | Distinct inputs → distinct outputs | Left inverse on the image |
| Onto | Every b\in B is f(a) for some a | Right inverse exists |
| Bijective | One-one and onto | Two-sided inverse f^{-1} |
A function f:A\to B has an inverse f^{-1}:B\to A if and only if f is
- One-one, but not necessarily onto
- Onto, but not necessarily one-one
- Bijective
A two-sided inverse needs every output hit exactly once: onto for existence of a pre-image, one-one for uniqueness. Either property alone is not enough.
6Counting functions and onto maps
The number of functions from a set of m elements to a set of n elements is n^m: each of the m inputs may land on any of n outputs. The number of one-one functions, when m\le n, is \dfrac{n!}{(n-m)!} — an injection is an ordered selection of m distinct images.
Onto maps are counted by inclusion-exclusion: \sum_{r=0}^{n}(-1)^r\binom{n}{r}(n-r)^m. For a two-element codomain the formula collapses to a shortcut — 2^m-2 — total maps minus the two constant functions.
Figure. Maps from a 4-set to a 2-set: 2^4=16 functions in all. Onto maps drop the two constant functions, leaving 16-2=14.
How it works
- Total mapsEach of m domain elements has n choices, so n^m functions.
- InjectionsChoose distinct images in order: n(n-1)\cdots(n-m+1)=\dfrac{n!}{(n-m)!} for m\le n.
- Onto to a 2-setSubtract the two constant maps from 2^m to leave 2^m-2.
Number of onto functions
How many onto functions are there from a set of 4 elements to a set of 2 elements?
- Total functions =2^416
- Subtract the two constant maps16-2
- Onto functions14
Pro tip. For a 2-element codomain, onto count is simply 2^m-2; only the two constant maps miss an element.
The number of one-one functions from a 3-element set to a 5-element set is
- 60
- 125
- 15
\dfrac{5!}{(5-3)!}=5\times 4\times 3=60. The option 125 is 5^3, the total function count; 15 is \binom{5}{3}, which forgets order.
7Composition and natural domain
Composition is (g\circ f)(x)=g(f(x)) — apply f first, then g. Composition is associative but generally not commutative: g\circ f and f\circ g need not even both be defined, let alone equal. Associativity still holds in the form (h\circ g)\circ f=h\circ(g\circ f) whenever both sides are defined.
The natural domain of a real function is the largest subset of \mathbb{R} on which the expression makes sense. Exclude values that make a denominator zero or a square-root argument negative. For f(x)=\sqrt{x} the domain is x\ge 0; for \log x it is x>0.
Figure. y=\sqrt{x} is drawn only for x\ge 0: the curve starts at the origin and never enters x<0. That missing half-line is the natural-domain cut.
How it works
- Read inside-outIn g\circ f, evaluate f(x) first; that output must lie in the domain of g.
- Do not swapCheck whether f\circ g is even defined before claiming equality with g\circ f.
- Carve the domainFor a formula, strike out points where a denominator vanishes or a root/log argument leaves its allowed set.
The natural domain of f(x)=\sqrt{x} is
- x>0
- x\ge 0
- All real x
A real square root needs a non-negative argument, and 0 is allowed: \sqrt{0}=0. The strict inequality x>0 is the domain of \log x, not of \sqrt{x}.
Notes
- Set operations and counting: For finite sets, n(A\cup B)=n(A)+n(B)-n(A\cap B) and for three sets the inclusion-exclusion principle adds back the triple overlap. A set with n elements has 2^n subsets and 2^n-1 proper non-empty subsets counted appropriately.
- Relations: A relation R on set A is reflexive if aRa for all a, symmetric if aRb\Rightarrow bRa, and transitive if aRb, bRc\Rightarrow aRc. A relation that is all three is an equivalence relation and partitions A into disjoint equivalence classes.
- Functions and their types: A function f:A\to B is one-one (injective) if distinct inputs give distinct outputs, onto (surjective) if every element of B is an image, and bijective if both. Only bijections are invertible, with f^{-1}(f(x))=x.
- Composition and counting maps: Composition (g\circ f)(x)=g(f(x)) is associative but generally not commutative. The number of functions from a set of m elements to one of n elements is n^m, and the number of one-one functions (m\le n) is \dfrac{n!}{(n-m)!}.
- Domain and range basics: The natural domain excludes values making a denominator zero or a square-root argument negative. For f(x)=\sqrt{x} the domain is x\ge0; for \log x it is x>0.
Formulas
- Inclusion-exclusion: n(A\cup B)=n(A)+n(B)-n(A\cap B)
- Subsets: number of subsets of an n-set =2^n
- Functions: total maps =n^m, injective maps =\dfrac{n!}{(n-m)!}
- Onto maps (m\to n): \sum_{r=0}^{n}(-1)^r\binom{n}{r}(n-r)^m
- Composition: (g\circ f)(x)=g(f(x))
- Inverse: f^{-1}\circ f=I (exists iff f is a bijection)
Exam traps & shortcuts
- To check if a function is one-one, either show f'(x) keeps a constant sign (monotonic) or verify f(x_1)=f(x_2)\Rightarrow x_1=x_2 algebraically.
- The number of equivalence relations on a set equals the number of ways to partition it (the Bell number); for a 3-element set there are 5.
- For onto functions from an m-set to a 2-set, the count is 2^m-2 (total minus the two constant maps) - a quick shortcut for small n.
Reference tables
Counts and composition identities used across the topic.
| Name | Statement | Watch |
|---|---|---|
| Inclusion-exclusion | n(A\cup B)=n(A)+n(B)-n(A\cap B) | Subtract the overlap once |
| Subsets | 2^n subsets of an n-set | Non-empty: 2^n-1 |
| All maps | n^m functions m\to n | Each input chooses freely |
| Injections | \dfrac{n!}{(n-m)!} for m\le n | Order matters |
| Onto (m\to n) | \sum_{r=0}^{n}(-1)^r\binom{n}{r}(n-r)^m | For n=2: 2^m-2 |
| Composition | (g\circ f)(x)=g(f(x)) | Associative, not commutative |
| Inverse | f^{-1}\circ f=I | Exists iff f is bijective |
Recap
Read only this the night before.
- Union
- n(A\cup B)=n(A)+n(B)-n(A\cap B). Neither is total minus the union.
- Subsets
- An n-set has 2^n subsets; drop one for non-empty.
- Relations
- Reflexive, symmetric, transitive — test each axiom. All three means equivalence, and that partitions the set.
- Bell
- Equivalence relations on a 3-set: five, one per partition.
- Maps
- One-one, onto, both. Only bijections invert. Total maps n^m; injections \dfrac{n!}{(n-m)!}; onto to a 2-set is 2^m-2.
- Compose
- (g\circ f)(x)=g(f(x)) is associative, not commutative. Domain of \sqrt{x} is x\ge 0; of \log x, x>0.
Practise Sets, Relations and Functions
Reading is free and needs no account. Practice, mocks and progress live in the app.
- 5 exam-style questions on this topic, with explanations
- A 6-question practice set that ends the chapter
- Timed mocks scored with the real marking scheme
- Readiness tracked per topic, kept on your device