[Math] How many bit strings of length 8 have a weight of 5 start with 101 OR end with 11.

combinatoricsdiscrete mathematics

I'm very close to solving this problem but finding the final answer is proving problematic.

A: 101x xxxx = 32 strings starting with 101
B: xxxx xx11 = 64 strings ending with 11
C: 101x xx11 = 8 strings with both of these.

The number of strings with weight five is equal to 56.

It is also important to note the number of strings starting with 101 with weight five is equal to 10
and the number of strings ending in 11 with weight five is equal to 20.

Therefore I thought the answer would've been 22 i.e. sum of 10 + 20 minus the strings common to both given this is an or problem.

Best Answer

Yes, you can use inclusion-exclusion, but the intersection should include the weight five condition. The correct count is: $$\binom{5}{3}+\binom{6}{3}-\binom{3}{1}=10+20-3=27$$