# Write the formula to find the number of onto functions from set A to set B.

Functions are the backbone of advanced mathematics topics like calculus. Functions are of many types, like into and onto. Let's solve a problem regarding onto functions.

## Answer: The formula to find the number of onto functions from set A with m elements to set B with n elements is n^{m} - ^{n}C_{1}(n - 1)^{m} + ^{n}C_{2}(n - 2)^{m} - ... or [summation from k = 0 to k = n of { (-1)^{k} . ^{n}C_{k }. (n - k)^{m }}], when m ≥ n.

Let's understand the solution.

**Explanation:**

To find the number of onto functions from set A (with m elements) and set B (with n elements), we have to consider two cases:

⇒ **One in which m ≥ n**: In this case, the number of onto functions from A to B is given by:

→ Number of onto functions = n^{m} - ^{n}C_{1}(n - 1)^{m} + ^{n}C_{2}(n - 2)^{m} - ....... or as [summation from k = 0 to k = n of { (-1)^{k} . ^{n}C_{k }. (n - k)^{m }}].

Let's solve an example.

→ Let m = 4 and n = 3; then using the above formula, we get 3^{4} - ^{3}C_{1}(3 - 1)^{4} + ^{3}C_{2}(3 - 2)^{4} = 81 - 48 + 3 = 36.

Hence, they have 36 onto functions.

⇒ **One in which m < n: **In this case, there are no onto functions from set A to set B, since all the elements will not be covered in the range function; but onto functions from set B to set A is possible in this case though.

### Hence, The formula to find the number of onto functions from set A with m elements to set B with n elements is n^{m} - ^{n}C_{1}(n - 1)^{m} + ^{n}C_{2}(n - 2)^{m} - ....... or [summation from k = 0 to k = n of { (-1)^{k} . ^{n}C_{k }. (n - k)^{m }}], when m ≥ n.

visual curriculum