[Math] How many strings of four decimal digits that do not contain the same digit three times

combinatoricsdiscrete mathematics

Hello, everyone!

I received the following question as part of my Discrete Mathematics course and am unable to solve it.

How many strings of four decimal digits that do not contain the same digit three times?

I know that it is related to counting rules and involves the product and sum rules however, I can not decide what approach to take to solve.

What I have so far:
1) Solution 1
Total number of combinations = 10 * 10 * 10 * 10 = 10 ^ 4 = 10 000

Number of combinations where the string contains the same digit three times:
1 * 1 * 1 * 10 = 10 * 10 (since 0 – 9 are possible numbers that can be repeated) = 100

Number of combinations where the string does not contain the same digit three times:
10 000 – 100 = 9 900

Help Needed:
I do not know if this is correct. If it isn't, I would be very appreciative if someone could direct me to the correct method for solving the problem.

Best Answer

As Eric noted in a comment, you're not taking into account the fact that there are four different positions for the fourth digit. The correct calculation is

$$ 10^4-4\cdot10\cdot10+3\cdot10=9630\;, $$

where the last term corrects for the fact that the second term counts each string of four identical digits $4$ times. Alternatively, not counting them in the second term, you could also write

$$ 10^4-4\cdot10\cdot9-10=9630\;. $$