Lists of length $n$ with symbols $\{1, 2, 3, \dots , 12 \}$ where $a_\max-a_\min \leq 5$

39 Views Asked by At

Calculate the number of lists (the order matters) of length $n$ with the symbols $\{1, 2, 3, \dots , 12 \}$ where the difference of the maximum element and the minimum element of the list is $\leq 5$

I have done it already when the difference has to be exactly $5$ and the result I got is $7\cdot (6^n-2\cdot 5^n+4^n)$. The result that I found on a text book for the exercise I am asking is $6\cdot(6^n-5^n)+6^n$. However I don't know how to get to this result. Could someone help me?

1

There are 1 best solutions below

0
On BEST ANSWER

Let $f(k)$ be the number of qualifying lists such that$\;a_{\max}-a_{\min}=k$.

Your answer for $f(5)$ is correct.

You are using the principle of inclusion-exclusion, and the same principle will work to get other values of $f(k)$, provided $1\le k\le 11$.

Thus for $1\le k\le 11$, we get $$f(k)=(12-k)\Bigl((k+1)^n-2k^n+(k-1)^n\Bigr)$$ and for $k=0$, by direct count, we have $f(0)=12$.

If you compute the sum $$f(0)+f(1)+f(2)+f(3)+f(4)+f(5)$$ and combine like terms, it will match the expected answer.