Q.Find the number of all onto functions from the set {1,2,3,...,n} to itself.
🔒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 — Counting Functions
Counting Functions
How many functions are there from a set A to a set B? A function must assign to each element of A exactly one element of B — no input left out, no input given two outputs. Counting them is a clean application of the multiplication principle.
All functions
Go through the elements of A one at a time. The first element can be sent to any of the ∣B∣ elements of B; so can the second, and every element after it — each choice is independent. If ∣A∣=m and ∣B∣=n, the total number of functions is
m timesn×n×⋯×n=nm=∣B∣∣A∣.
Example. With A={1,2,3} and ∣B∣=4, there are 43=64 functions from A to B.
This is different from the number of relations, which is 2∣A∣×∣B∣. A relation may pair an input with zero, one, or many outputs; a function must pick exactly one — hence nm, not 2mn.
One-one (injective) functions
For a one-one function no two inputs may share an output, so once an image is used it's gone. This needs m≤n. The first input has n choices, the second n−1, the third n−2, and so on:
n(n−1)(n−2)⋯(n−m+1)=(n−m)!n!=nPm.
Example. One-one functions from a 2-element set to a 4-element set: 4P2=4×3=12. …
Key idea: a function from a finite set to itself is onto exactly when it is one-one. Since S={1,2,…,n} is finite, an onto map f:S→S hits all n values, so no two inputs can share an output — it is a bijection, i.e. a permutation of S. …
For a finite set, an onto self-map is automatically a bijection, i.e. a permutation, so the number of onto functions from {1,2,…,n} to itself is n!.
The key observation
Let S={1,2,…,n} and let f:S→S be onto. "Onto" means every one of the n elements of S is an output of f. But f has only n inputs to produce those n distinct outputs. If two different inputs mapped to the same value, then f would produce at most n−1 distinct outputs and could not cover all n targets. So the outputs must all be distinct — f is also one-one.
A map that is both one-one and onto is a bijection, and a bijection from a set to itself is exactly a rearrangement (permutation) of its elements.
Counting the permutations
Building a permutation, assign images one element at a time:
- f(1) can be any of the n elements — n choices.
- f(2) must differ from f(1) — n−1 choices.
- f(3) must differ from both — n−2 choices. …
Method: Counting onto functions from a finite set to itself
For a map from a finite set to itself, use the key equivalence: on a finite set, onto ⟺ one-one ⟺ bijection.
Steps
Step 1: Convert "onto" to "bijection"
An onto map f:S→S on an n-element set must hit all n values with only n inputs, so no two inputs can collide — it is automatically one-one, hence a permutation of S.
Step 2: Count the permutations
Assign images one input at a time: n choices for the first, n−1 for the next, and so on down to 1: …
Common Mistakes
Mistake 1: Counting all functions (nn) instead of only the onto ones.
Why it's wrong: nn counts every map from the set to itself, most of which are not onto. Correct approach: use that on a finite set onto ⟺ bijection, so the count is the number of permutations, n!.
Mistake 2: Reaching for the full inclusion–exclusion formula and mis-simplifying it. …
Showing the 12 most recent of 17 on this concept.
- AP EAPCET 2026Set eng-2026-05-13-FN1 markMCQQ.Let A and B be two non-empty sets with n(A)=4 and n(B)=5. If a mapping is selected at random from the set of all mapping from A to B, then the probability of getting a many-one mapping is (A) 125101 (B) 12596 (C) 1024921 (D) 128113
›Reveal solutionSolution
Many-one is the complement of one-one among all functions A→B. Answer: 125101.
Concept and Intuition
Every function from A to B is either one-one (injective) or many-one (not injective) — these are complementary events, so P(many-one)=1−P(one-one).
Step-by-Step Solution
- Total number of functions from a 4-element set to a 5-element set: each of the 4 elements of A can map to any of 5 elements of B, giving 54=625.
- Number of one-one (injective) functions: choose images one at a time without repetition: 5×4×3×2=120.
- P(one-one)=625120=12524. …
- AP EAPCET 2026Set eng-2026-05-13-AN1 markMCQQ.Let p denote the number of surjections from a set containing 6 elements to a set containing 2 elements. Let q denote the number of injections from a set containing 3 elements to a set containing 5 elements. Let r denote the number of bijections from a set containing 4 elements to itself. Then p−q+r= (A) 22 (B) 98 (C) 26 (D) 146
›Reveal solutionSolution
The problem asks for p−q+r, where p counts surjections from a 6‑element set to a 2‑element set, q counts injections from a 3‑element set to a 5‑element set, and r counts bijections from a 4‑element set to itself. We compute each separately: p=26−2=62, q=5×4×3=60, r=4!=24. Then p−q+r=62−60+24=26. The correct option is (C).
Concept and Intuition: Counting Functions
We are counting three types of functions between finite sets. The key idea is that each type — surjection, injection, bijection — imposes a different condition on how elements of the domain map to the codomain.
- Surjection: every element of the codomain must be hit at least once. For a small codomain (size 2), we can count total functions and subtract those that miss at least one element.
- Injection: no two domain elements map to the same codomain element. This is like choosing an ordered list of distinct images.
- Bijection: both surjective and injective; for a set to itself, this is just a permutation.
We compute each separately, then combine.
Step‑by‑Step Solution
1. Compute p: number of surjections from a 6‑element set to a 2‑element set.
Let the domain have 6 elements and the codomain have 2 elements, say {a,b}.
A function is surjective if both a and b are images of at least one domain element.
- Total number of functions from a 6‑element set to a 2‑element set: each of the 6 elements has 2 choices, so 26=64.
- Subtract functions that are not surjective. A function fails to be surjective if it misses at least one codomain element.
- Miss a: all 6 elements map to b → 1 function.
- Miss b: all 6 elements map to a → 1 function.
- These two cases are disjoint (cannot miss both because the codomain has only 2 elements).
- So number of non‑surjective functions = 1+1=2.
Thus
p=26−2=64−2=62.
TipFor a codomain of size 2, the formula 2n−2 counts surjections from an n-element set. This works because the only way to fail surjectivity is to map everything to a single element.
--- …
- AP EAPCET 2026Set eng-2026-05-15-FN1 markMCQQ.Let the numerical values of the coefficients of a polynomial belong to the set {0,1,2,…9}. Then the number of reciprocal polynomials of third degree with the leading coefficient 1 that can be formed is (A) 36 (B) 30 (C) 38 (D) 50
›Reveal solutionSolution
Counting monic-cubic reciprocal polynomials of both the first and second kind, with each free coefficient's magnitude restricted to a digit 0–9, gives 19+19=38.
Concept and Intuition
A reciprocal (palindromic-type) polynomial of degree n has coefficients that read the same (first type) or with alternating sign (second type) from either end: ai=an−i or ai=−an−i. For a monic cubic x3+a1x2+a2x+a3 this pairs (a0,a3) and (a1,a2). The phrase 'numerical value of the coefficient' (rather than just 'coefficient') signals that a coefficient may be negative, but its magnitude must be a digit in {0,1,…,9} — so a free coefficient really ranges over the 19 values {−9,−8,…,−1,0,1,…,9}.
Step-by-Step Solution
- Leading coefficient is fixed at a0=1 (monic).
- First type (ai=a3−i): a3=a0=1 (forced), and a2=a1, a single free value whose magnitude is a digit 0–9: that's 19 possible values for the common middle coefficient.
- Second type (ai=−a3−i): a3=−a0=−1 (forced), and a2=−a1; here a1 is free (magnitude 0–9, so 19 values) and a2 is then determined. …
- AP EAPCET 2024Set eng-2024-05-20-AN1 markMCQQ.The number of numbers lying between 1000 and 10000 such that every number contains the digits 3 and 7 only once without repetition is (A) 1140 (B) 918 (C) 720 (D) 810
›Reveal solutionSolution
Split into "other two digits equal" and "other two digits different", handle the leading-zero restriction in each, and add. Answer: 720.
Concept and Intuition
"Contains 3 and 7 only once, without repetition" restricts repetition of the digits 3 and 7 specifically, but doesn't forbid the other two digits (which must avoid 3,7) from matching each other. So we must count both the case where those two extra digits are the same and the case where they differ, and in each subtract numbers that would start with 0.
Step-by-Step Solution
- Other two digits equal (multiset {3,7,e,e}, e∈{0,1,2,4,5,6,8,9}): number of distinct arrangements of each multiset is 2!4!=12. Over 8 choices of e: 8×12=96.
- Subtract leading-zero cases: only happens when e=0 (multiset {3,7,0,0}). Fixing one 0 in front and arranging the remaining {3,7,0} (all distinct) in the last 3 places gives 3!=6 invalid numbers. So valid count here =96−6=90.
- Other two digits distinct (d1=d2, both from the 8-digit set): choose the pair, (28)=28 ways; arrange all 4 distinct digits {3,7,d1,d2} in 4!=24 ways: raw total 28×24=672. …
- AP EAPCET 2024Set eng-2024-05-22-FN1 markMCQQ.If set A has 5 elements, set B has 7 elements then the number of many one functions that can be defined from A to B is (A) 75−7 (B) 57−5 (C) 57−7P5 (D) 75−7P5
›Reveal solutionSolution
Many-one functions are simply all functions minus the injective (one-one) ones. Answer: 75−7P5.
Concept and Intuition
Every function from a 5-element set to a 7-element set is either one-one or many-one (some element of B has more than one pre-image, or equivalently the function is not injective). So many-one count = total functions − injective functions.
Step-by-Step Solution
- Total number of functions from A (5 elements) to B (7 elements) =75 (each of the 5 elements of A can map to any of 7 elements of B).
- Since ∣A∣<∣B∣, one-one functions exist and their count is 7P5=2!7!. …
- AP EAPCET 2023Set eng-2023-05-17-FN1 markMCQQ.If a set A has n elements, then the number of functions defined from A to A that are not one-one is (A) (n)n2 (B) n!−(nC0+nC1+nC2+…+nCn) (C) nn−n! (D) nn
›Reveal solutionSolution
Total functions from A to A number n^n; the one-one ones (which, on a finite set to itself, are exactly the bijections) number n!; subtracting gives n^n - n! not-one-one functions.
Concept and Intuition
A function f:A→A assigns each of the n elements of A to one of n possible images, independently, giving nn total functions. On a finite set mapped to itself, injective (one-one) iff surjective (onto) - a standard pigeonhole fact. So one-one functions are precisely the bijections, and there are n! of these.
Step-by-Step Solution
- Total functions A→A: each domain element has n choices, total =nn.
- On a finite set A to itself, one-one ⟺ bijection. …
- AP EAPCET 2023Set eng-2023-05-17-FN1 markMCQQ.The number of all 8 digit odd numbers is (A) 45×106 (B) 90×106 (C) 9×108 (D) 9×106
›Reveal solutionSolution
Counting 8-digit odd numbers by the multiplication principle: first digit 9 options, last digit 5 options (odd), middle six digits 10 each, giving 45×106.
Concept and Intuition
This is a straightforward fundamental-counting-principle problem: fix the constrained positions (first digit can't be 0; last digit must be odd) and multiply by the free choices for the rest.
Step-by-Step Solution
- First digit (leftmost, to make it an 8-digit number): can be 1 through 9 → 9 choices.
- Last digit (to make the number odd): must be one of 1,3,5,7,9 → 5 choices. …
- AP EAPCET 2023Set eng-2023-05-17-FN1 markMCQQ.The number of all four digit numbers which begin with 4 and end with either zero or five is (A) 200 (B) 64 (C) 256 (D) 32
›Reveal solutionSolution
Fix the first digit as 4 and the last as 0 or 5; the two middle digits are unrestricted, giving 1×10×10×2=200 numbers.
Concept and Intuition
A straightforward application of the multiplication principle for counting arrangements with some positions fixed/restricted and others free.
Step-by-Step Solution
- Four-digit number: positions are (thousands, hundreds, tens, units).
- Thousands digit is fixed at 4: 1 way.
- Units digit must be 0 or 5: 2 ways.
- Hundreds and tens digits are each any of 0–9: 10 ways each. …
- AP EAPCET 2023Set eng-2023-05-18-AN1 markMCQQ.The numbers of positive even divisors of 6300 is (A) 30 (B) 24 (C) 18 (D) 36
›Reveal solutionSolution
Prime-factorize 6300, count total divisors, subtract the odd divisors (those with zero factors of 2) to isolate the even ones.
Concept and Intuition
For N=p1a1p2a2⋯, the total number of divisors is (a1+1)(a2+1)⋯. To count only even divisors, it's easiest to count odd divisors first (those using zero powers of 2) and subtract from the total — since every divisor is either odd or even.
Step-by-Step Solution
- Factorize: 6300=63×100=(9×7)×(4×25)=32×7×22×52=22⋅32⋅52⋅71.
- Total number of divisors =(2+1)(2+1)(2+1)(1+1)=3×3×3×2=54.
- Odd divisors correspond to choosing the power of 2 as exactly 0: count =(1)(2+1)(2+1)(1+1)=1×3×3×2=18.
- Even divisors =54−18=36. …
- AP EAPCET 2022Set eng-2022-07-04-AN1 markMCQQ.If a set A has m-elements and the set B has n-elements, then the number of injections from A to B is (A) nCm if n≥m (B) nPm if n≥m (C) 0 if n≥m (D) m⋅nCm if n≥m
›Reveal solutionSolution
Counting injections is equivalent to choosing and ordering m distinct images out of n, giving nPm — but only possible at all when n≥m.
Concept and Intuition
An injective (one-to-one) function from A (with m elements) to B (with n elements) must map every element of A to a distinct element of B. This is exactly the same combinatorial structure as arranging m distinct objects into n distinct positions without repetition — a permutation problem, not a combination problem (since which element of A maps to which specific element of B matters, unlike choosing a subset).
Step-by-Step Solution
- By the pigeonhole principle, if n<m, no injective function can exist (there aren't enough distinct targets for all m elements), so the count is 0 in that case.
- When n≥m, build an injection element-by-element: the first element of A can map to any of n elements of B; the second element of A can map to any of the remaining n−1 elements (to keep injectivity); and so on, down to the mth element having n−m+1 choices. …
- AP EAPCET 2022Set eng-2022-07-04-FN1 markMCQQ.The total number of permutations of n different things taken not more than r at a time, when each thing may be repeated any number of times is (A) n−1n(nr+1−1) (B) n−1nr+1−1 (C) n−1n(nr−1) (D) n−1nr−1
›Reveal solutionSolution
This tests counting repetition-permutations of varying lengths and summing a geometric series. The total is n−1n(nr−1).
Concept and Intuition
When repetition is allowed, choosing a sequence of length k from n distinct things (order matters, repeats allowed) gives nk possibilities — each of the k positions independently has n choices. "Not more than r at a time" means we must add up the counts for every length from 1 up to r, which is a finite geometric series.
Step-by-Step Solution
- Sequences of length exactly k (with repetition) from n things: nk ways.
- "Taken not more than r at a time" means k ranges over 1,2,…,r.
- Total =n1+n2+⋯+nr, a geometric series with first term n, ratio n, and r terms.
- Sum of a geometric series: n⋅n−1nr−1=n−1n(nr−1).
Common Mistakes …
- AP EAPCET 2022Set eng-2022-07-06-AN1 markMCQQ.How many numbers between 10 and 10,000 can be formed by using the digits 1,2,3,4,5, if no digit is repeated in any number? (A) 200 (B) 775 (C) 60 (D) 120
›Reveal solutionSolution
This tests counting numbers with k digits (for k=2,3,4) formed without repetition from a digit set that has no zero, then summing over the valid digit-lengths. Answer: 200.
Concept and Intuition
Since the numbers must lie strictly between 10 and 10,000, they can have 2, 3, or 4 digits (a 1-digit number can't exceed 10, and a 5-digit number using all 5 given digits would be at least 12345, far above 10,000... actually a 5-digit number itself exceeds 10,000, so only 2,3,4-digit numbers qualify). Because the available digits are 1 through 5 (no zero), every arrangement automatically forms a valid number with no leading-zero issue, so this is a straightforward permutation count for each length, summed together.
Step-by-Step Solution
- Numbers strictly between 10 and 10,000 can have 2, 3, or 4 digits (1-digit numbers are ≤9<10; 5-digit numbers using digits 1-5 are ≥12345>10,000).
- Digits available: {1,2,3,4,5}, each used at most once per number (no repetition), and none is zero, so leading-zero is never an issue.
- Count of 2-digit numbers: choose and arrange 2 digits from 5: P(5,2)=5×4=20.
- Count of 3-digit numbers: P(5,3)=5×4×3=60.
- Count of 4-digit numbers: P(5,4)=5×4×3×2=120.
- Total =20+60+120=200.
Common Mistakes …
🎓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.