Zaymiey

📐 Mathematics  ·  Permutations and Combinations  ·  JEE

Total number of onto functions from A (m elements) to B (n elements) using inclusion-exclusion:

Answer: sum from k=0 to n of (-1) k × C(n,k) × (n-k) m.

  • A n<sup>m</sup>, the count of all functions from A to B without restriction
  • B sum from k=0 to n of (-1)<sup>k</sup> × C(n,k) × (n-k)<sup>m</sup>
  • C n! × C(m,n), mistakenly mixing a permutation count with a combination
  • D m<sup>n</sup>, swapping the roles of the domain and codomain sizes

Correct answer: B. sum from k=0 to n of (-1)<sup>k</sup> × C(n,k) × (n-k)<sup>m</sup>

Explanation: Inclusion-exclusion over elements of B left uncovered: Σₖ₌₀ⁿ (−1)ᵏ C(n,k)(n−k)ᵐ. Each term accounts for functions missing exactly k elements of B.

StartABCBCACAB6 ordered outcomes (permutations); pairing AB/BA etc gives 3 combinations

Counting tree for selecting 2 items from {A, B, C} without repetition: 3 x 2 = 6 ordered arrangements.

Concept context

Counting, arrangements, and selections

Read the full Permutations and Combinations notes →