Let $n>1$ be a positive integer. Find the number of binary strings $(a_1, a_2, \ldots, a_n)$, such that the number of indices $1\leq i \leq n-1$ such that $a_i=a_{i+1}=0$ is equal to the number of indices $1 \leq i \leq n-1$, such that $a_i=a_{i+1}=1$.
Problem
Source: Thailand 2023 TSTST1/5
Tags: combinatorics
27.08.2023 06:20
Funny combo haha Let $a$ be the number of sequences of consecutive 1's, $b$ be the number of consecutive 0's Let $k$ be the total number of 1's then the total number of 0's are $n-k$. Since a sequence of $n$ consecutive same numbers add $n-1$ to the number of indices, we have: $k-a=n-k-b$. Obviously either $a=b,a=b-1,a=b+1$ so: If $2|n\Rightarrow a=b\Rightarrow k=\frac{n}2$. We are looking to divide $\frac{n}2$ 1's into $a$ intervals, and $a$ runs from 1 to $\frac{n}2$ so that would be $\binom{\frac{n}2-1}{a-1}$ to arrange 1's for any $a$, which means $\binom{\frac{n}2-1}{a-1}^2$ to arrange the whole sequence for any $a$. So the number of ways to arrange this sequence is $\sum_{k=1}^{\frac{n}2}\binom{\frac{n}2-1}{k-1}^2=\binom{n-2}{\frac{n}2-1}$ If $2\nmid n\Rightarrow a=b-1$ or $a=b+1$. Since we can just change all the 1's to 0's and vice versa, any sequence with $a=b-1$ can be arranged into sequences that have $a=b+1$ that still works, so we will only consider the cases where $a=b-1$. In this case $k=\frac{n-1}2$. So the number of arrangements for any a is $\binom{\frac{n-1}2-1}{a-1}\binom{\frac{n+1}2-1}{a}$, which means the total number of arrangements is $2.\sum_{k=1}^{\frac{n-1}2}\binom{\frac{n-1}2-1}{k-1}\binom{\frac{n+1}2-1}{k}=2\binom{\frac{n-3}2}{n-2}=2\binom{\frac{n-1}2}{n-2}$.