An Interesting subsequence problem

379 Views Asked by At

Suppose I have a sequence of $n$ random positive numbers: $A$. I then create subsequences of $A$ of a given length, say $K$. Is it possible by combinatorics to find the number of times a number in $A$ appears at either end positions in the subsequence i.e. at starting position or end position?

For Example if $A = \{1,2,3,4\}$ and $k = 3$, then subsequences are $\{1,2,3\}, \{1,2,4\}, \{1,3,4\}$ and $\{2,3,4\}$. Here $1$ appears $3$ times at position $1$ or call it start position(here it won't appear at the last position as we keep the order of the elements in the subsequence same as $A$, which is obvious), $2$ appears once at the start position. Also, $3$ appears appears once at end position and $4$ appears thrice.

Now what I tried: Suppose we do this for $1$ in $A$ so I fix the position of $1$ at the first position in my subsequence. Now I need $2$ more numbers from $A$ or $K-1$ in general. Also, I now only have the elements that are after 1 to choose from A which would be equal to $n-($position of $A)$. Here I need to choose from $3$ elements($4-1$). So the number of such subsequences is equal to the number of times 1 appears at the first position = $_3C_2$. To be exact I would say $_3C_2\cdot 1$, multiplying with 1 because I use the same permutation(or arrangement) as in $A$

I think similarly we can do this for the last position. Another question is, am I really doing it the right way? Does Combinatorics really work this way? Is the way of thinking really correct? More than the question I got concerned with the way I was thinking. Is this how a Mathematics student would really approach this problem?

Can we also find how many times a number appears at positions other than first and last because let's say in total it appears $X$ times considering any position and then I can subtract the number of times it appears at either of the end positions. But how to determine $X$ or is there a direct way to find the appearances at positions other than end positions? A direct way is appreciated as it would help me with improving the thinking part.

1

There are 1 best solutions below

2
On BEST ANSWER

If I understand the question correctly, we have a sequence of $n$ distinct numbers, $a_1,a_2,\dots,a_n$ and we want to know how many subsequences of length $k$ have $a_i$ in position $j.$ We have to choose $j-1$ of the $i-1$ numbers before $a_i$ and we have to choose $k-j$ of the $n-i$ numbers after $a_i,$ so the answer is $$\binom{i-1}{j-1}\binom{n-i}{k-j}$$