To calculate the probability we can count all the possible choices where we have only two similar digits, and we divide it over all numbers between 1,000 and 9,999 included which are 9,000 numbers.
First digit of X can be 1,2,...9 but not zero.
The other three digits can be 0,1,..9.
We should have only two similar digits.
So we have C2of4= 6 possible similarities:
Either the first and the second are similar, or the first and the third, or the first and the forth, or the second and the third, or the second and the forth, or the third and the forth.
AFirst method:
First and second similar: for first digit we have 9 choices, the second we have 1 choice, the third we have 9 choices, the forth we have 8 choices.
First and third similar: for first digit we have 9 choices, the second we have 9 choices, the third we have 1 choice, the forth we have 8 choices.
First and forth similar: for first digit we have 9 choices, the second we have 9 choices, the third we have 8 choices, the forth we have 1 choice.
Second and third similar: for first digit we have 9 choices, the second we have 9 choices, the third we have 1 choice, the forth we have 8 choices.
Second and forth similar: for first digit we have 9 choices, the second we have 9 choices, the third we have 8 choices, the forth we have 1 choice.
Third and forth similar: for first digit we have 9 choices, the second we have 9 choices, the third we have 8 choices, the forth we have 1 choice.
So numbers having only 2 similar digits are 6*9*9*8=3888
Second method:
We can do it another way, if want see clearly what happens with the 0 that cannot be in the first digit, and therefore differentiate the cases where the repeated number is 0 and where not.
1. If first digit is one of the two similar, we have 3 choices with each having 9*1*9*8 numbers, so we have 3*9*1*9*8= numbers. (Here 0 cannot be one of the similar)
2. If first digit is not one of the two similar, we have 3 choices but in each choice we should differentiate whether the two similar are 0 or not.
a. If the two similar digits are 0, we have 9*1*1*8. We have 3 places of the two 0 so we have 3*9*1*1*8 numbers.
b. If the two similar digits are not 0, we have 3 places to the two none 0. But we should differentiate for each case again if the third one of the the three right digits is 0 or not:
I. If the third digit is 0 we have 9*1*1*8
II. If the third digit is not 0: we have left 9*1*8*7
So we have in b. (3*9*1*1*8+3*9*8*7)=3*9*8*8
So the numbers with only 2 similar digits are 3*9*1*9*8+ 3*9*1*1*8+3*9*8*8=6*9*9*8=3888 we arrive at the same number going step by step.
Probability of having only 2 similar digits is 3888/9000=54/125
Posted from my mobile device