Our math teacher is currently teaching us probability and posed this question.

How many ways can $7$ digits be selected from the set $S = \{1,2,3,4,5,6,7,8,9\}$ such that the greatest number in the selection is 9? *Repetition is allowed

And I thought, well, since 9 should be the greatest number it should appear at least once. So, let us take 9 as our first digit. The rest of the 6 digits can be selected in $9^6$, because you can select any of the 9 digits and the greatest number would still be 9.

That would mean the answer would be $9^6$.

But, the solution that our teacher told us was to take all the possible selections and subtract the selections where 9 isn't present; i.e. the correct answer would be $9^7 - 8^7$.

So, where did I go wrong?

  • 1
    $\begingroup$ Why do you assume that the first digit has to be $9$? $\endgroup$
    – user169852
    Jul 16, 2021 at 9:27
  • 1
    $\begingroup$ You took $9$ as the first digit but that's not necessary. $\endgroup$
    – Math Lover
    Jul 16, 2021 at 9:27
  • $\begingroup$ Because well, if the greatest digit is 9, then I presumed that 9 had to be selected at least once. That is why I took 9 as the first digit. And because it is a selection and order doesn't matter, I thought taking 9 as the first digit was ok $\endgroup$ Jul 16, 2021 at 9:30
  • $\begingroup$ The teacher's solution implies that the order does matter. Otherwise the total number of possible selections would not be $9^7$. $\endgroup$
    – user169852
    Jul 16, 2021 at 9:32
  • 1
    $\begingroup$ Are you sure the question wasn't "How many 7-digit numbers can be selected..."? That would agree wth your teacher's answer. (By contrast, your $9^6$ answers the question "How many 7-digit numbers starting with $9$ can be selected...", which is different.) $\endgroup$
    – TonyK
    Jul 16, 2021 at 9:56

1 Answer 1


Try it with three digits from $\{1,2\}$ where the largest is $2$.

Your method would say the possibilities are $211,212,221,222$

but you would miss $112,121,122$.

Rather than your $2^{3-1}=4$ possibilities, there are the teacher's $2^3-(2-1)^3=7$ possibilities

  • $\begingroup$ Actually, see these are supposed to be selections where order isn't supposed to matter, like combinations. So, umm 112 and 121 are supposed to be basically the same thing, That is why I took 9 as the first digit, assuming that order doesn't matter. $\endgroup$ Jul 16, 2021 at 9:51
  • $\begingroup$ @AmandaRives In that case you are both wrong and the answer would be a smaller $3$ in my toy example for the patterns $222,221,211$, and ${9+7-2 \choose 7-1}=3003$ in your original question $\endgroup$
    – Henry
    Jul 16, 2021 at 9:59
  • $\begingroup$ how did you take the combinations to be 3003? $\endgroup$ Jul 16, 2021 at 10:06
  • $\begingroup$ @AmandaRives Stars and bars on the six digits $\endgroup$
    – Henry
    Jul 16, 2021 at 10:08
  • $\begingroup$ @AmandaRives en.wikipedia.org/wiki/Stars_and_bars_(combinatorics) $\endgroup$
    – Henry
    Jul 16, 2021 at 10:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .