
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Problem. How many bit strings of length 10 are there that satisfy: (a) the strings start with 100 and end with 11? (b) the strings start with 100 or end with 11? (c) the strings start with 100 or start with 11? (d) the strings do not start with 100 or end with 11?
(a) There are 2^5 = 32 bit strings of length 10 that start with 100 and end with 11. (Take any bit string of length 5, of which there are 2^5 , and add 100 as a prefix and 11 as a suffix.)
(b) There are 2^7 + 2^8 − 25 = 352 bit strings of length 10 that start with 100 or end with 11. Here we use the Principle of Inclusion/Exclusion: Let A be the set of all bit strings of length 10 that start with 100 or end with 11, and let
A 1 = {bit strings of length 10 starting with 100} A 2 = {bit strings of length 10 ending with 11}
Then A = A 1 ∪ A 2 and
|A| = |A 1 ∪ A 2 | = |A 1 | + |A 2 | − |A 1 ∩ A 2 | = 2^7 + 2^8 − 25
where the cardinality of A 1 ∩ A 2 was determined in (a).
(c) There are 2^7 + 2^8 = 384 bit strings of length 10 that start with 100 or start with 11. In this problem the sum principle applies, if A 1 is defined as in (b) and A 3 is the set of bit strings of length 10 starting with 11 then A 1 ∩ A 3 = ∅. The problem asks to determine the number of bit strings in A 1 ∪ A 3. So |A 1 ∪ A 3 | = |A 1 | + |A 3 | = 2^7 + 2^8.
(d) By the sum principle, the total number 2^10 of bit strings of length 10 equals the number 2^7 +2^8 − 25 (from (b)) of bit strings of length 10 that start with 100 or end with 11 plus the number N of stringgs of length 10 that do not start with 100 or end with 11. Thus
N = 2^10 − (2^7 + 2^8 − 25 ) = 672.