counting words with a condition

63 Views Asked by At

Suppose we are given a sequence $x_1x_2x_3x_4x_5x_6$ where the $x_i$ are digits 0 to 9, and we want to know how many of them do we have that satisfy $x_1<x_2<x_3<x_4<x_5<x_6$?

$discussion:$

Notice that $x_1$ can only be a number betwwen $0$ to $4$ so if $x_1=0$, then we reduce our problem to count number of strings $x_2<x_3<x_4<x_5<x_6$ where $x_i$ are digits $\geq 1$. And here notice that $x_2$ must be between $1$ and $5$. So, If $x_2 = 1$ now we have another subproblem... in this counting those that satisfy $x_3<x_4<x_5<x_6$ and now $x_3$ must be between $2$ and $6$ and so if you let $x_3=2$ then $x_4$ can be betwwen $3$ and $7$ and we see that each time we have $4$ choices for the $x_i$

So, we see that there $4 \times 4 \times ... \times 4 = \boxed{4^6}$ such sequences.

Now, my question, in general, if we have sequence $x_1x_2...x_n$ there are ${\bf no}$ sequences that satisfy $x_1<x_2 < ... <x_n$ but if $n=9$ say, then we only have $1^9$ choices. if $n=8$, then we have $2^8$ choices. If $n=7$, we have $3^7$ choices. if $n=6$, we have $4^6$ choices and so on...

Is this a correct generalization?

1

There are 1 best solutions below

0
On BEST ANSWER

To build a sequence of length $n$ in ascending order, you need to choose $n$ different digits. Once the digits are chosen, you have only one order in which you can place them in the sequence. Hence, the number of sequences that satisfy the condition $x_1<\ldots<x_n$ is ${10 \choose n}$.

So, for $n=10$ you have only one option: 0123456789. For $n=9$ you have $10$ options: just choose which digit not to include. For $n=6$ you have ${10 \choose 6}=210$ options and not $4^6=4096$. Looking at it as many sub-problems is very problematic, as the number of choices in each problem strongly depends on previous choices.