Q.Let A={1,2,3,…n} and B={a,b}. Then the number of surjections from A into B is
(A) nP2
(B) 2n−2
(C) 2n−1
(D) none of these
🔒You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
🔒 Start your 14-day free trial to unlock the full solution →Concept understanding — Inclusion Exclusion Principle
The Inclusion–Exclusion Principle
Thirty students play cricket and twenty-five play football — so does "cricket or football" total 55? Not if some play both. If ten play both, they have been counted twice, so the real total is 30+25−10=45. That single correction is the whole principle: add everything, then subtract what you double-counted.
Why "Inclusion" and "Exclusion"
- Include every set by adding its size.
- Exclude the overlaps counted more than once by subtracting the intersections.
For three or more sets the signs keep alternating, because each correction slightly over-corrects and must itself be fixed.
The General Statement
For finite sets A1,A2,…,An,
∣⋃i=1nAi∣=∑i∣Ai∣−∑i<j∣Ai∩Aj∣+∑i<j<k∣Ai∩Aj∩Ak∣−⋯+(−1)n+1∣A1∩⋯∩An∣.
Add all singles, subtract all pairwise intersections, add all triples, and so on — the sign alternates, starting with +.
Why It Works
An element lying in exactly m of the sets is counted (1m) times among the singles, subtracted (2m) times among the pairs, added (3m) times among the triples, and so on. Its net count is
(1m)−(2m)+(3m)−⋯+(−1)m+1(mm)=1,
using (1−1)m=0 from the binomial theorem. So every element is counted exactly once.
A Three-Set Example
Of 100 students: 40 take Physics, 30 Chemistry, 25 Biology; 15 take P and C, 10 P and B, 8 C and B; 5 take all three.
∣P∪C∪B∣=(40+30+25)−(15+10+8)+5=95−33+5=67.
So 67 take at least one subject and 33 take none. …
The key idea is the Inclusion-Exclusion Principle: total functions minus those that miss at least one element of B.
Step 1: Total functions from A (size n) to B (size 2) is 2n.
Step 2: A surjection must hit both a and b. Functions that miss a are all maps to {b} — exactly 1n=1 function. Similarly, functions that miss b are all maps to {a} — also 1 function. …
The number of surjections from an n-element set onto a 2-element set is found by counting all functions and subtracting the two constant functions. The answer is 2n−2, which corresponds to option (B).
A surjection (onto function) from set A to set B means every element of B must have at least one preimage in A. Here B has exactly two elements: a and b. So we need every function from A to B where both a and b appear in the range at least once.
The total number of functions from A to B is 2n, because each of the n elements in A can independently map to either a or b.
Among these, the functions that are not surjective are exactly those that miss at least one element of B. Since B has only two elements, a function misses a if it maps every element of A to b — that's exactly one function (the constant function f(x)=b). Similarly, a function misses b if it maps everything to a — that's one function. There is no function that misses both a and b simultaneously (that would require mapping to nothing), so these two are the only non-surjective functions.
Thus the number of surjections is:
Total functions−Functions that miss a−Functions that miss b=2n−1−1=2n−2. …
Method: Counting Onto (Surjective) Functions
Use this whenever you must count how many functions from a set of size n onto a set of size m actually use every element of the codomain.
Steps
Step 1: Count all functions, ignoring the onto requirement.
Each of the n inputs can independently map to any of the m outputs, so there are mn functions in total.
Step 2: Remove the functions that miss at least one output.
A function fails to be onto when one or more codomain elements are never hit. Subtract those 'bad' maps by inclusion-exclusion: …
Common Mistakes
Mistake 1: Subtracting only one constant function, giving 2n−1.
Why it's wrong: with a two-element codomain {a,b} there are two functions that fail to be onto — the all-a map and the all-b map. Correct approach: subtract both, giving 2n−2.
Mistake 2: Confusing surjections with the count of all functions. …
Showing the 12 most recent of 22 on this concept.
- AP EAPCET 2026Set eng-2026-05-12-FN1 markMCQQ.Let A be a set of n(≥3) distinct elements. For x,y,z∈A, if A3 is the set of all ordered triplets (x,y,z), then the number of triplets of A3 in which at least two among x,y,z are equal is (A) nP3 (B) n2−nP3 (C) 3n2−2n (D) 3n2(n−1)
›Reveal solutionSolution
Use the complement: (at least two equal) = (total triples) − (all three distinct) = n3−nP3=3n2−2n.
Concept and Intuition
"At least two among three equal" is the complement of "all three distinct." Counting the complement is much easier here: the total number of ordered triples is simply n3 (each coordinate independently chosen from n elements), and the number with all distinct entries is the permutation count nP3.
Step-by-Step Solution
- Total ordered triples (x,y,z)∈A3 with x,y,z∈A (repetition allowed): n×n×n=n3.
- Triples where x,y,z are all pairwise distinct: choose and arrange 3 distinct elements from n, which is nP3=n(n−1)(n−2).
- "At least two equal" is the complement of "all distinct":
n3−nP3=n3−n(n−1)(n−2).
- Expand n(n−1)(n−2)=n(n2−3n+2)=n3−3n2+2n. …
- AP EAPCET 2022Set eng-2022-07-07-AN1 markMCQQ.In a plane there are 37 straight lines of which 13 pass through point A and 11 pass through the point B. Moreover, no three lines (apart from the lines passing through A and B) pass through same point and no two are parallel. What is the number of points of intersection of the straight lines? (A) 37C2 (B) 37C2−13C2−11C2 (C) 37C2−13C2−11C2+2 (D) 37C2−2
›Reveal solutionSolution
Counting intersection points when some lines are deliberately concurrent; correct for the "collapsed" points at A and B by subtracting the extra pairs and adding back 1 point each.
Concept and Intuition
In general position (no two parallel, no three concurrent), every pair of lines meets at its own
distinct point, so the number of intersection points equals the number of pairs, (2n).
Here, though, 13 lines are forced through one common point A and 11 through another point B — this
is a controlled violation of "general position." Each bundle of concurrent lines still contributes
only ONE point (not one per pair), so we must remove the over-count: each bundle of k concurrent
lines was "supposed" to contribute (2k) distinct points under general position, but actually
contributes only 1, so the correction per bundle is −((2k)−1).
Step-by-Step Solution
- Under naive general position, pairs of lines =(237), giving that many points.
- The 13 lines through A form (213) pairs, but instead of (213) distinct points they give exactly 1 point (A itself). Correction: subtract (213)−1 from the naive count, i.e. subtract (213) and add back 1. …
- AP EAPCET 2022Set eng-2022-07-05-FN1 markMCQQ.In an examination, the maximum marks for each of three subjects is n and that for the fourth subject is 2n. The number of ways in which candidates can get 3n marks is (A) 61(n+1)2(5n2+10n+6)2 (B) 61(n+1)(5n2+10n+6)2 (C) 61(n+1)2(5n2+10n+6) (D) 61(n+1)(5n2+10n+6)
›Reveal solutionSolution
This is a classic generating-function counting problem: count non-negative integer solutions of x1+x2+x3+x4=3n with 0≤x1,x2,x3≤n and 0≤x4≤2n; the closed form works out to 61(n+1)(5n2+10n+6).
Concept and Intuition
Each subject's mark is an integer between 0 and its maximum, and we want the number of ways the four marks can add up to exactly 3n. This is exactly the coefficient-extraction problem: build a generating function where each subject contributes a factor (1+x+x2+⋯+xmax), multiply the four factors together, and the coefficient of x3n in the product counts the number of ways to hit that total.
Step-by-Step Solution
- Three subjects have max marks n each, contributing factor (1+x+⋯+xn)3=(1−x1−xn+1)3.
- The fourth subject has max marks 2n, contributing (1+x+⋯+x2n)=1−x1−x2n+1.
- The generating function for the total is (1−x)4(1−xn+1)3(1−x2n+1), and we want the coefficient of x3n.
- Expand the numerator: (1−xn+1)3(1−x2n+1)=1−3xn+1−x2n+1+3x2n+2+(higher-power terms beyond x3n, which don’t contribute).
- Using (1−x)−4=∑k(3k+3)xk, the coefficient of x3n in the full product is:
(33n+3)−3(32n+2)−(3n+2)+3(3n+1)
(each term's binomial index is 3n minus the power of x being subtracted, plus 3).
6. This expression simplifies (standard algebra) to 61(n+1)(5n2+10n+6). …
- AP EAPCET 2022Set eng-2022-07-04-FN1 markMCQQ.A person writes letters to 6 friends and addresses the corresponding envelopes. In how many ways can the letters be placed in the envelopes so that at least two of them are in the wrong envelopes? Notation: Dn=n!(∑i=0ni!(−1)i) (A) 6C4.D2 (B) ∑r=366C6−r.Dr (C) ∑r=266C6−r.Dr (D) 6C1D5+6C0.D6
›Reveal solutionSolution
This tests building "at least k wrong" counts from derangement numbers by conditioning on exactly how many letters end up wrong. The answer is r=2∑66C6−r⋅Dr.
Concept and Intuition
If exactly r of the 6 letters are placed in the wrong envelope (and the remaining 6−r are correctly placed), we first choose WHICH r letters are the wrong ones — (r6) ways — and then those r chosen letters must be deranged among themselves (no letter in its own envelope), which is Dr ways. So exactly-r-wrong count =(r6)Dr=(6−r6)Dr (since (r6)=(6−r6)). "At least two wrong" means r ranges from 2 to 6 (note: exactly 1 wrong is impossible, since if 5 letters are correctly placed the 6th is forced correct too, so that case contributes zero and doesn't need excluding separately).
Step-by-Step Solution
- Let r = number of letters actually in the wrong envelope. Possible values: 0,2,3,4,5,6 (r=1 is impossible).
- Number of ways with exactly r wrong =(r6)Dr (choose the r "wrong" letters, derange just those; the other 6−r go correctly).
- "At least two wrong" means summing over r=2,3,4,5,6: total =r=2∑6(r6)Dr=r=2∑6(6−r6)Dr. …
- AP EAPCET 2024Set eng-2024-05-22-FN1 markMCQQ.The number of ways of distributing 15 apples to three persons A, B, C such that A and C each get at least 2 apples and B gets at most 5 apples is (A) 57 (B) 131 (C) 156 (D) 251
›Reveal solutionSolution
After shifting for the minimums on A and C, this becomes a stars-and-bars count with an upper bound on B, solved by inclusion–exclusion to give 57.
Concept and Intuition
Minimum-value constraints are handled by substituting shifted variables (subtracting off the minimum), turning the problem into a standard non-negative-integer-solutions count; an upper bound is then handled by subtracting the "bad" cases where that bound is violated.
Step-by-Step Solution
- Let A=A′+2, C=C′+2 with A′,C′≥0. Then A+B+C=15⇒A′+B+C′=11, with 0≤B≤5.
- Total non-negative solutions of A′+B+C′=11 (ignoring the upper bound on B): (211+2)=(213)=78. …
- AP EAPCET 2024Set eng-2024-05-22-AN1 markMCQQ.If there are 6 alike fruits, 7 alike vegetables and 8 alike biscuits, then the number of ways of selecting any number of things out of them such that at least one from each category is selected, is (A) 504 (B) 336 (C) 503 (D) 335
›Reveal solutionSolution
This tests selection counting with identical (alike) objects, where "how many to take" from each group is the only choice; requiring at least one of each gives 6×7×8=336.
Concept and Intuition
When items within a group are identical, a "selection" from that group is fully determined just by how many are taken (0 up to the total available), since the items themselves are indistinguishable. So a group of n alike items offers n+1 possible selection-counts (0 through n) if none is required, or n possible counts (1 through n) if at least one must be taken.
Step-by-Step Solution
- Fruits: 6 alike items, must take at least 1, so the count can be 1,2,…,6 — 6 choices.
- Vegetables: 7 alike items, at least 1, so 1,…,7 — 7 choices.
- Biscuits: 8 alike items, at least 1, so 1,…,8 — 8 choices.
- Since the choice within each category is independent, multiply: 6×7×8=336. …
- AP EAPCET 2026Set eng-2026-05-12-AN1 markMCQQ.Among the number of all possible arrangements of all the letters of the word 'ARRANGE', the number of arrangements in which either two A's or two R's do not occur together is (A) 460 (B) 520 (C) 580 (D) 660
›Reveal solutionSolution
Using inclusion–exclusion on "AA together" and "RR together" gives the count where at least one pair is together; subtracting from the total gives the arrangements where neither repeated pair is together, which is 660.
Concept and Intuition
"Two A's do not occur together" and "two R's do not occur together" jointly describes arrangements avoiding both togetherness conditions. The cleanest way to count this is inclusion–exclusion: find arrangements where each unwanted event happens, combine them, and subtract from the grand total.
Step-by-Step Solution
- ARRANGE = A, R, R, A, N, G, E: 7 letters with A repeated twice and R repeated twice.
- Total distinct arrangements =2!2!7!=45040=1260.
- Treat the two A's as a single glued block: entities are [AA],R,R,N,G,E (6 entities, R still repeated) ⇒2!6!=360 arrangements with AA together.
- By the same logic (symmetry of A and R), arrangements with RR together =360. …
- AP EAPCET 2026Set eng-2026-05-15-AN1 markMCQQ.If all the letters of the word SEARCH are permuted in all possible ways, then among the permutations so formed, the number of permutations in which no letter of the word occupies its original position is (A) 30 (B) 120 (C) 265 (D) 360
›Reveal solutionSolution
SEARCH has 6 distinct letters, so "no letter in its own position" is the derangement count D6=265.
Concept and Intuition
A derangement is a permutation with no fixed points — here, no letter sits where it started. For n distinct objects, the number of derangements is Dn=n!(1−1!1+2!1−3!1+⋯+n!(−1)n), derived by inclusion–exclusion over the "bad" events (each letter individually fixed).
Step-by-Step Solution
- SEARCH = S, E, A, R, C, H — 6 letters, all distinct (no repeats), so we need D6.
- D6=6!(1−1+21−61+241−1201+7201).
- 6!=720. Compute the bracket times 720 term by term: 720−720+360−120+30−6+1=265.
- So D6=265.
Common Mistakes …
- AP EAPCET 2022Set eng-2022-07-08-AN1 markMCQQ.In how many different ways can three persons A,B,C having 6,7 and 8 one rupee coins respectively, donate Rs.10 collectively? (A) 47 (B) 66 (C) 56 (D) 60
›Reveal solutionSolution
This is a bounded-integer-solutions counting problem, solved cleanly by inclusion-exclusion starting from the unrestricted count.
Concept and Intuition
Counting ways to split a fixed total among people with individual caps is a classic "stars and bars with upper bounds" problem — count all solutions ignoring caps, then subtract the solutions that violate each cap using inclusion-exclusion.
Step-by-Step Solution
- Let a,b,c≥0 be the rupees donated by A, B, C with a≤6, b≤7, c≤8, and a+b+c=10.
- Unrestricted non-negative solutions to a+b+c=10: (210+2)=(212)=66.
- Subtract solutions where a≥7: substitute a′=a−7≥0, so a′+b+c=3, giving (25)=10 solutions.
- Subtract solutions where b≥8: substitute b′=b−8≥0, so a+b′+c=2, giving (24)=6 solutions.
- Subtract solutions where c≥9: substitute c′=c−9≥0, so a+b+c′=1, giving (23)=3 solutions. …
- AP EAPCET 2025Set eng-2025-05-23-AN1 markMCQQ.The number of ways in which a committee of 7 members can be formed from 6 teachers, 5 fathers and 4 students in such a way that at least one from each group is included and teachers form the majority among them, is (A) 1865 (B) 2370 (C) 3050 (D) 4380
›Reveal solutionSolution
This is a constrained-selection counting problem: split 7 committee seats among three groups so every group is represented and the teacher-count strictly exceeds each of the other two group-counts, then sum the corresponding combinations. Answer: 2370.
Concept and Intuition
"Teachers form the majority" here means teachers outnumber each of the other two groups individually (a plurality), while every group still contributes at least one member. We enumerate every feasible split (t,f,s) of the 7 seats among teachers/fathers/students satisfying t≥1,f≥1,s≥1, t>f, t>s, then use (t6)(f5)(s4) for each split and add.
Step-by-Step Solution
- We need t+f+s=7 with 1≤t≤6, 1≤f≤5, 1≤s≤4, and t>f, t>s.
- t=3: need f<3,s<3,f+s=4 ⟹ only (f,s)=(2,2). Ways =(36)(25)(24)=20⋅10⋅6=1200.
- t=4: need f<4,s<4,f+s=3 ⟹ (f,s)=(1,2) or (2,1).
- (1,2): (46)(15)(24)=15⋅5⋅6=450.
- (2,1): (46)(25)(14)=15⋅10⋅4=600.
- Subtotal =1050. …
- AP EAPCET 2026Set eng-2026-05-15-AN1 markMCQQ.The number of ways of selecting a team of 7 persons for a hotel having atleast one receptionist from 4 persons, atleast 4 waiters from another 7 persons and atleast 1 cook from another 5 persons is (A) 1470 (B) 2450 (C) 2720 (D) 2870
›Reveal solutionSolution
Enumerate the few (receptionist, cook, waiter) splits that satisfy all three "at least" constraints within a team of 7, and sum the combinations for each split; total is 2870.
Concept and Intuition
When a fixed total (7) must be split among groups each with a minimum requirement, the fastest approach is to see how much "slack" is left after meeting the tightest constraint, then enumerate the finitely many ways to distribute that slack, rather than trying to build a single combined formula.
Step-by-Step Solution
- Let r = receptionists (from 4, r≥1), w = waiters (from 7, w≥4), c = cooks (from 5, c≥1), with r+w+c=7.
- Since w≥4, we need r+c≤3; since r≥1,c≥1, r+c≥2. So r+c∈{2,3}.
- r+c=2: only (r,c)=(1,1), giving w=5.
- r+c=3: (r,c)=(1,2) giving w=4, or (r,c)=(2,1) giving w=4.
- Count each case:
- (1,1,5): (14)(15)(57)=4×5×21=420. …
- AP EAPCET 2021Set eng-2021-08-19-AN1 markMCQQ.In how many ways 4 balls can be picked from 6 black and 4 green colored balls such that at least one black ball is selected? (A) 212 (B) 210 (C) 209 (D) 15
›Reveal solutionSolution
Using the complement (no black ball at all) is far easier than summing all "at least one black" cases directly; the answer is 209.
Concept and Intuition
"At least one" conditions are best handled via complementary counting: total ways minus the ways that completely fail the condition.
Step-by-Step Solution
- Total balls =6 black +4 green =10; choosing any 4: (410)=210.
- "No black ball selected" means all 4 chosen are green; but there are only 4 green balls, so this is (44)=1 way. …
🎓Unlock everything free for 14 days
- ✓Full step-by-step solutions
- ✓Concept-first explanations
- ✓Methods, shortcuts & mistakes
- ✓PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.