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

combinatorics

I want to check whether my concept and answer is right

I am considering strings of four decimal digits that contain the same digit twice. With this,
I have the possibilities of $xxyz,xyxz,yxxz,yxzx,yzxx,xyzx$ where $x$ is the same digit, and $y, z$ are randomly different decimal digits taken.
So $10 \cdot 1 \cdot 9 \cdot 8 = 720$ and $6$ possibilities, then $720 \cdot 6 = 4320$ ways.
Now consider digits that have pattern $xxyy, yyxx,xyxy,yxxy,yxyx,xyyx$, here $10 \cdot 1 \cdot 9 \cdot 9=810 \cdot 6= 4860$ ways.
Then total combinations are $10^4 =10000$ then $10000-4320-4860=820$ ways .

Best Answer

Your title is ambiguous (see the comment of Mohammad) and I preassume that it concerns the number of strings that have the property that no digit appears exactly $2$ times.

Where it concerns strings that have $3$ distinct digits your calculation with outcome $$\binom42\cdot10\cdot9\cdot8=4320$$ is correct.

Where it concerns strings that have $2$ distinct digits that both appear twice the outcome should be: $$\frac12\binom42\cdot10\cdot9=270$$ You (maybe accidently) have $2$ factors $9$ instead of $1$ and did not repair double counting.

You could also reason that there are not $6$ but $3$ patterns there ($xxyy$,$xyxy$ and $xyyx$) and this with $10$ choices for $x$ and $9$ remaining choices for $y$.

Related Question