In: Statistics and Probability
How many bit-strings are there of length 128 that either start with 1111 or end with 0000 but not both?
I have answered the question below
Please up vote for the same and thanks!!!
Do reach out in the comments for any queries
Answer:
Strings starting with 1111:
Let the first 4 digits be 1111. The rest of 124 digits can be 0 or 1
=> We have a permutation of nr => 2124
Strings ending with 0000:
Let the last 4 digits be 0000. The first 124 digits can be 0 or 1
=> We have a permutation of 2124
Strings starting with 1111 and ending with 0000
If we have first 4 digits as 1111 and last 4 digirs as 0000, then the rest of 120 digits can be 0 or 1
=> => We have a permutation of 2120
Total bit-strings are there of length 128 that either start with 1111 or end with 0000 but not both
=> 2 * 2124 - 2120
= 2125 - 2120
= 2120 ( 25 - 1)