What is the formula to calculate the number of onto functions from set A to set B?

To find the number of onto functions (surjective functions) from set A to set B, we can use the concept from combinatorial mathematics involving Stirling numbers of the second kind and inclusion-exclusion principle.

Assuming that set A has m elements and set B has n elements, where m >= n, the formula for the number of onto functions, denoted as f(m, n), is:

f(m, n) = n! * S(m, n)

In this formula:

  • n! is the factorial of n, which gives the number of ways to arrange n distinct elements.
  • S(m, n) is a Stirling number of the second kind, which represents the number of ways to partition m elements into n non-empty subsets.

The Stirling number can be calculated using the recurrence relation:

S(m, n) = n * S(m - 1, n) + S(m - 1, n - 1)

with base cases:

  • S(0, 0) = 1
  • S(m, 0) = 0 for m > 0
  • S(0, n) = 0 for n > 0
  • S(n, n) = 1

In essence, the calculation of onto functions combines combinatorial enumeration of subsets and permutations. This approach ensures that every element in set B is mapped to by at least one element in set A, satisfying the definition of onto functions.

Leave a Comment