Question: What is the probability that an integer between 0 and 10000 has exactly one 8 and one 9?
I have been working on this problem and have come up with simply placing each integer one by one in any 4 digit number (allowing 0's at the front to represent 2 and 3 digit numbers as well), so:
Stage #1 (place the 9) = 4 possibilities _ _ _ _
Stage #2 (place the 8) = 3 possibilities, e.g. _ 9 _ _
Stage #3 (pick the 3rd digit) = 8 possibilities [0-7], e.g. 0 9 8 _
Stage #4 (pick the last digit) = 8 possibilities [0-7], e.g. 0 9 8 7
This leads to 4*3*8*8 = 768 and a probability of .0768, which is consistent with answers that I have found online, however I think that this over-counts in situations where the 3rd and last digit chosen are the same, e.g. 0 9 8 0, because it counts both the case where the last digit is placed first and the case where the first digit is placed first, but they are the same number.
So, I'm thinking to avoid over-counting, I can subtract the number of integers with one 8, one 9, and two of the same digits; there are 24 integers of the form 8 9 x x (1*3*8*1), 24 integers of the form 9 8 x x, and 42 integers of the form x 8 9 x / x 8 x 9 etc. with x first (calculated 7*3*2*1, or pick first digit [1-7], place 8, place 9, pick last digit).
Is this the right method to avoid over-counting? Is the first part of the solution even over-counting?