Permutation and combination Number of Bits Problem

206 Views Asked by At

how many bit strings of length eight either start with a '1' bit or end with the two bits '00'? I got the answer 128 by using the "exclusive or" approach i.e. for bit strings starting with '1': There is one way to choose the first bit, 2^5 ways to choose the succeeding 5 bits and 3 ways to choose the last 2 bits= 3*2^5 and for bits ending with '00': There is one way to choose the first and last two bits and 2^5 ways to choose the remaining bits= 2^5 Therefore answer will be= 3*2^5+2^5=128.

1

There are 1 best solutions below

0
On

Recall that $$n(A\cup B)=n(A)+n(B)-n(A\cap B)$$ where $A$ is the set of $8$ length bit strings starting with $1,B$ is the set of $8$ length bit strings ending in $00$.

$n(A)=2^7$, because the remaining last $7$ bits can be $0,1$.

$n(B)=2^6$, because the remaining first $4$ bits can be $0,1$.

$n(A\cap B)$ is the number of $8$ length bit strings which both start with $1$ and end in $00$. Thus, there are $5$ bits which we can vary, resulting in $n(A\cap B)=2^5$.

The required answer is $2^7+2^6-2^5=128+64-32=160$.