Digital Logic | Number of possible Functions

In the below articles, we are going to calculate the number of functions possible from given two sets of the element.

Statement:
Suppose there are two sets ‘A’ and ‘B’ containing ‘n’ and ‘m’ number of elements respectively, i.e., Sets,

'A' = {1, 2, 3, 4, ............, n},
'B' = {1, 2, 3, 4, ............, m} 

Then the number of function possible will be m^n when functions are counted from set ‘A’ to ‘B’ and n^m when function are counted from set ‘B’ to ‘A’.

Explanation:
In the below diagram, as we can see that Set ‘A’ contain ‘n’ elements and set ‘B’ contain ‘m’ element. Each element of set ‘A’ makes ‘m’ number of functions with each element of the set ‘B’ and hence total number of functions possible is m^n.



Examples:

  1. If set ‘A’ contain ‘3’ element and set ‘B’ contain ‘2’ elements then total number of function possible will be 2^3 = 8.
  2. If set ‘A’ contain ‘5’ element and set ‘B’ contain ‘2’ elements then total number of function possible will be 2^5 = 32.

But when functions are counted from set ‘B’ to ‘A’ then the formula will be n^m where n, m are the number of elements present in set ‘A’ and ‘B’ respectively then examples will be like below:

  1. If set ‘A’ contain ‘3’ element and set ‘B’ contain ‘2’ elements then the total number of functions possible will be 3^2 = 9.
  2. If set ‘A’ contain ‘5’ element and set ‘B’ contain ‘2’ elements then the total number of function possible will be 5^2 = 25.

Similarly when the two sets increases to 3 sets,

'A' = {1, 2, 3, 4, ............, n},   
'B' = {1, 2, 3, 4, ............, m} 
'C' = {1, 2, 3, 4, ............, p}  

Then the number of possible function will be p^{(m^n)} when the function is counted from Set ‘A’ to ‘B’ then to ‘C’ and thus so on for any number of sets.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.