Suppose I have a 4 digit code that I can make with the 10 digits, repetition allowed. I want to find the total number of codes that have repeated digits. The easiest way would be Total Possible Codes $-$ Non-repeating Digit Codes -> $10^4 - (10 \times 9 \times 8 \times 7)$.
But suppose I want to do a case by case basis looking for the codes with repeating digits. For codes with 2 repeating digits I first find total combinations of $2$ slots out of the $4$, assign them a digit, then assign the remaining two digits. I get : $4 \choose 2$ $(10 \times 9 \times 8)$
Similarly with 3 repeated digits I get $4 \choose 3$ $(10 \times 9)$ and 4 repeating digits $4 \choose 4$ (10). But adding these up gives a different result than doing it using the first method. Why is this? What am I doing wrong?