By
TheoremΒ 2.4.8, there are
\(2^n\) bit strings of length
\(n\text{.}\) The only bit string that does not have any
\(\bs{0}\) s is
\(\bs{11}\) \(\cdots\) \(\bs{1}\text{.}\) Therefore, by
TheoremΒ 2.2.9, there are
\(2^n-1\) bit strings of length
\(n\) that include at least one
\(\bs{0}\text{.}\)
How can we write a recursion to count? Write
\(z_n=\) the number of bit strings of length
\(n\) that include at least one
\(\bs{0}\text{.}\) Note that the only bit string of length 1 that includes at least one
\(\bs{0}\) is
\(\bs{0}\) itself and so
\(z_1=1\text{.}\) Given a bit string of length
\(n\) that has at least one
\(\bs{0}\text{,}\) we consider two cases.
Case 1: The bit string begins with
\(\bs{1}\text{.}\) In this case, the other
\(n-1\) bits must include at least one
\(\bs{0}\text{.}\) There are
\(z_{n-1}\) such bit strings.
Case 2: The bit string begins with
\(\bs{0}\text{.}\) In this case, we have at least one
\(\bs{0}\) no matter what the other
\(n-1\) bits are. They can be any bit string of length
\(n-1\text{.}\) By
TheoremΒ 2.4.8, there are
\(2^{n-1}\) bit strings of length
\(n-1\text{.}\) Therefore, there are
\(2^{n-1}\) such bit strings.
\begin{equation*}
z_n=z_{n-1}+2^{n-1}
\end{equation*}
for \(n\ge 2\) and the initial condition is \(z_1=1\text{.}\)