Monday, February 9, 2009

A question of Counting

I am indebted to my friend Shekhar for helping me generate material for this blog.
How many 6-digit number contain exactly 4 different digits?

Solution.
In Short
10C4*4C2* 6!/(2! 2!) + 10C4 * 4C1 * 6!/(3!) - 1/10*(10C4*4C2* 6!/(2! 2!) + 10C4 * 4C1 * 6!/(3!))
=226800+100800-1/10(226800+100800)= 294840

The Detailed solution is as following
Start by picking
any four distinct digits from 0,1,2,3,4,5,6,7,8,9
Note I included 0

This can be done in 10C4 ways
Of these 4 digits I can choose 2 digits that will occur twice in the final number

Say I chose 1 2 3 4
then I can choose any two of them which will occur twice
say a number of form 1 2 3 4 3 2
Where in 3 and 2 repeat once each

Total ways in such a selection can be made is

10C4* 10C2

now suppsing I have 1 2 3 4 and I have 3 2 that will occur in duplicates
I can form any permutaion of them to get a new number

So total number of ways will be

number of selection multiplied by possible arrangements
which is just permutaion of 6 things where 2 things occur more than once
that is 6! (2! 2!)
gives me a total of

6! (2! 2!) * 10C4* 10C2

Is that all
No we can have a case wherein a digit is triplicate instead of two duplicates

again same rule applies

I choose 4 distinct digits in 10 C 4 ways
Then I choose one digit from these chosen 4 numbers which will occur thrice in 4C1 ways
total of
10C4*4C1 ways
and total number of numbers such formed as

10C4*4C1 * 6!/(3!)

Howver that is not all
I need to subtract cases where in 0 occurs as first digit
Howvere a 0 will be the first digit in one tenth of cases
This is becuase first place will be occupied by 1,2,3,4,6 etc equal number of times
So I subtract 1/10 of the sum of above two cases
which gives me the final result

1 comment:

Meera said...
This comment has been removed by the author.