[Math] Counting binary strings with at least two adjacent zeros.

combinatorics

Considering 8-bit strings, how many strings contains at least two adjacent zeros?

Here is my progress.

0 zeros in string = 0

1 zero = 0

2 = 7

3 = ?

4 = $8\choose4$ – 2

5 = $8\choose5$

6 = $8\choose6$

7 = $8\choose7$

8 = $8\choose8$

But I can't figure out how it is with 3 zeros in string. Can you help me? Can you tell the rest of my consideration is all right? According to result, is has to be 201 in total, but it doesn't fit for my calculations.

Best Answer

To count the number of 8-bit strings that have exactly 3 zeros and at least 2 are adjacent, you can count the number of 8 bit strings with exactly 3 zeros, and subtract those in which they are not adjacent.

The number of 8-bit strings with exactly 3 zeros is $\binom{8}{3}$. To count those with no two zeros adjacent, consider placing the five $1$s, leaving space between them for possibly adding a $0$: $$\Box \quad1\quad \Box\quad 1 \quad\Box \quad 1 \quad \Box\quad 1 \quad \Box \quad 1\quad \Box$$ Now you will select three of the six boxes to place a zero in. There are $\binom{6}{3}$ ways of doing this. So the number of $8$-bit strings with exactly $3$ zeros, and at least two zeros adjacent is $$\binom{8}{3} - \binom{6}{3} = 56 - 20 = 36.$$

I don't know how you counted for $4$. Doing the same thing as above, there are $\binom{8}{4}$ strings with exactly four $0$s; if you place all the $1$s first, there are five places where a zero may go, so you need to subtract $\binom{5}{4}$ strings that have no two zeros adjacent; that gives $\binom{8}{4}-5 = 65$ strings.

The rest seem okay.

Using these totals, we have: $0 + 7 + 36 + 65+ 56+28+8+1=201$ total.