The number of positive integers of 5 digits such that each digit is 1, 2 or 3, and all three of the digits appear atleast once.

combinationscombinatoricspermutations

The number of positive integers of 5 digits such that each digit is 1, 2 or 3, and all three of the digits appear at least once.

Working:
Three 1, one 2, one 3, number of numbers = 5!/3! = 20 Two 1, one 2, two 3, number of numbers = 5!/(2!*2!) = 30 Two 1, two 2, one 3, number of such numbers = 5!/(2!*2!) = 30 One 1, one 2, three 3, number of such numbers = 5!/3! = 20 One 1, two 2, two 3, number of such numbers = 5!/(2!*2!) = 30 One 1, three 2, one 3, number of such numbers = 5!/(3!) = 20 Therefore, total number of such numbers = 20 + 30 + 30 + 20 + 30 + 20 = 150

Question: Is there any other possible easier, and simpler approach?

Best Answer

Inclusion Exclusion is somewhat easier.

The total number of such integers, ignoring the requirement that all three digits appear, is $3^5$. We then subtract off the instances in which one specified digit does not appear, that's $3\times 2^5$. Then we add back the $3$ instances in which two specified digits do not appear. Thus we get $$3^5-3\times 2^5+3=150$$