3

This is the exercise:

How many bit strings of length $77$ are there such that

a.) the bit string has at least forty-six $0$s and at least twenty-nine $1$s, and also the bit string corresponding to the first forty positions contains at most twenty-one $0$s and at most nineteen $1$s, and the bit string corresponding to the last twenty-six positions contains at least twenty-four $0$s.

b.) the bit string corresponding to the first nine positions contains exactly three $0$s and the bit string corresponding to the last twenty-six positions contains the string $1101\,1101$ as a substring.

I was able to solve part a. of the exercise by doing some case work and by taking in consideration all the constraints by doing it, removing the cases that wouldn't satisfy the constraints and that is what I've got for part a:

$$\begin{align*} & \binom{40}{21} \Bigg[\binom{26}{24} \left[\binom{11}1+\binom{11}2+\binom{11}3\right] \\ &\qquad\quad + \binom{26}{25} \left[\binom{11}0 + \binom{11}1 + \binom{11}2\right] \\ &\qquad\quad + \binom{26}{26} \left[\binom{11}0+\binom{11}1\right]\Bigg] \end{align*}$$

However I have no idea how to solve part b. Here's the consideration I made so far.

Since the bit string corresponding to the first nine positions contains exactly three $0$s ($\binom93$) and therefore exactly six $1$s. Since the substring contained in the last twenty-six positions is of length $8$, we have $18$ positions of the last twenty-six with no constraints. From position $10$ to position $77-26$, we have no constraints.

I appreciate whoever is going to help me, thanks!


Edit: I posted an answer to my question.

zaxunobi
  • 217

2 Answers2

1

This is my solution for part b.) expressed as binomial coefficients. Not sure if this correct though. Let's do first a quick recap.

First 9 positions: 3 zeros. So it would be $\binom{9}{3} $

Middle positions: 77-9-26 = 42. Which would be $2^{42}$

Last 26 positions: contains "11011101". I am going to account now for the substrings repetitions and overlaps.

11011101: $\binom{19}{1} * 2^{18}$

11011101
    11011101

: $\binom{15}{1} * 2^{14}$

11011101 11011101: $\binom{12}{2} * 2^{10}$

11011101
    11011101
        11011101

: $\binom{11}{1} * 2^{10}$

11011101
    11011101 11011101

: $\binom{8}{2} * 2^{6}$

11011101 11011101 11011101: $\binom{5}{3} * 2^{2}$

Final solution:

$\binom{9}{3} * 2^{42} * [\binom{19}{1} * 2^{18} - \binom{15}{1} * 2^{14} - \binom{12}{2} * 2^{10} + \binom{11}{1} * 2^{10} + \binom{8}{2} * 2^{6} + \binom{8}{2} * 2^{6} + \binom{5}{3} * 2^{2}]$

zaxunobi
  • 217
0

Here we show a way to calculate the substring part of problem b.) The technique is based upon the Goulden-Jackson Cluster Method. We consider binary words of length $n\geq 0$ and a set $\mathcal{B}=\{11011101\}$ of so-called bad words which are not allowed to be part of the words we are looking for. We derive a generating function $A(z)=\sum_{n=0}^{\infty}a_nz^n$ with the coefficient $a_n$ of $z^n$ being the number of these words of length $n$. The wanted number of words which do contain the word $\color{blue}{11011101}$ is consequently $$\color{blue}{2^n-a_n}.$$ Following the paper at page 7, the generating function $A(z)$ is \begin{align*} \color{blue}{A(z)=\frac{1}{1-dz-\text{weight}(\mathcal{C})}}\tag{1} \end{align*} with $d=|\mathcal{V}|=2$, the size of the alphabet and $\mathcal{C}$ is the weight-numerator of bad words with \begin{align*} \color{blue}{\text{weight}(\mathcal{C})=\text{weight}(\mathcal{C}[11011101])} \end{align*}

We calculate according to the paper setting $w:=11011101$ \begin{align*} \text{weight}(\mathcal{C}[w])&=-z^8-z^4\cdot\text{weight}(\mathcal{C}[w])-z^7\cdot\text{weight}(\mathcal{C}[w])\tag{2}\\ &\qquad\qquad\quad 1101{\color{blue}{\underline{1101}}}1101\ \ \quad 1101110{\color{blue}{\underline{1}}}1011101 \end{align*}

The additional terms on the right-hand side of (2) take into account overlaps, which are indicated by the blue letters of the overlapping bad word in the lines below. It follows \begin{align*} \text{weight}(\mathcal{C})=\text{weight}(\mathcal{C}[w])=\frac{-z^8}{1+z^4+z^7} \end{align*}

We obtain according to (1) and (2) \begin{align*} \color{blue}{A(z)}&=\frac{1}{1-dz-\text{weight}(\mathcal{C})}\\ &=\frac{1}{1-2z-\frac{-z^8}{1+z^4+z^7}}\\ &=\color{blue}{\frac{1+z^4+z^7}{1-2z+z^4-2z^5+z^7-z^8}}\tag{3}\\ &=1+2z+4z^2+8z^3+\cdots+128z^7+255z^8\\ &\qquad+\cdots+{\color{blue}{62\,449\,479}}z^{26}+\cdots \end{align*} where the last line was calculated with the help of Wolfram Alpha. We conclude the wanted number of binary words of length $26$ which contain $11011101$ is \begin{align*} 2^{26}-a_{26}=2^{26}-62\,449\,479=\color{blue}{4\,659\,385} \end{align*}

Note: We can also manually calculate $a_{26}$ from (3) by deriving a recurrence relation for $a_n$. The recurrence relation is given by the coefficients of the denominator of (3) as \begin{align*} a_n-2a_{n-1}+a_{n-4}-2a_{n-5}+a_{n-7}-a_{n-8}=0 \end{align*} Since there are no restrictions given by the word $11011101$ for the first eight items $a_0, \ldots, a_7$ , we have the recurrence relation: \begin{align*} \color{blue}{a_n}&\color{blue}{=2a_{n-1}-a_{n-4}+2a_{n-5}-a_{n-7}+a_{n-8}\,\qquad\qquad n\geq 8}\\ \color{blue}{a_n}&\color{blue}{=2^n\quad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad 0\leq n\leq 7} \end{align*} from which we can calculate $a_{26}$ manually, admittedly somewhat laboriously.

Markus Scheuer
  • 112,413
  • Hello, thank you so much for the reply! I will take it my time to read it, since I didn't quite get it the first time. By the way, if you wanna check out a similar question I would much appreciate it: https://math.stackexchange.com/questions/4949344/what-are-the-preferred-steps-to-solve-an-exercise-that-involves-finding-all-poss – zaxunobi Jul 23 '24 at 08:19
  • @zaxunobi: You're welcome. :-) – Markus Scheuer Jul 25 '24 at 19:32
  • If I express a solution to you as binomial coefficients, would you able to tell me if it's equivalent to your answer? – zaxunobi Aug 02 '24 at 08:36
  • If I were to use stars and bars along with inclusion-exclusion, would you be able to tell me if your solution is equivalent to mine? – zaxunobi Aug 07 '24 at 14:06
  • @zaxunobi: I think so. – Markus Scheuer Aug 07 '24 at 14:18
  • I've updated the original question with the solution for part b expressed as binomial coefficients. – zaxunobi Aug 15 '24 at 07:15
  • @zaxunobi: When you have found a solution, you should add it as an answer to your question so that others can vote on it. – Markus Scheuer Aug 15 '24 at 19:25
  • But I am not sure is correct. Should I post it as answer anyway? – zaxunobi Aug 17 '24 at 08:50
  • @zaxunobi: Since it is an answer to your question this is the right way to do it. You will probably also get some helpful comments on your answer. – Markus Scheuer Aug 17 '24 at 10:23
  • Ok, I posted my solution as an answer. – zaxunobi Aug 18 '24 at 09:33