NOTE: This answer assumes that the OP asks for the number of bit strings with EXACTLY 5 consecutive 0's or 1's. It does not work if you're looking for the number of bit strings with AT LEAST 5 consecutive 0's or 1's.
There are 10 bits, so there's a total of $2^{10}=1024$ possible cases.
Let see the case of 5 consecutive 0's.
Then, we need at least a 1 in every end (if there wasn't, it would be 6 consecutive 0's). Let's see all possible arranges ($x$ is a bit whose value doesn't matter, so it could be either a 1' or a 0':
$$\begin{array}{rcl}
000001xxxx&&6\text{ numbers fixed, so }2^4\text{ cases}\\
1000001xxx&&7\text{ numbers fixed, so }2^3\text{ cases}\\
x1000001xx&&7\text{ numbers fixed, so }2^3\text{ cases}\\
xx1000001x&&7\text{ numbers fixed, so }2^3\text{ cases}\\
xxx1000001&&7\text{ numbers fixed, so }2^3\text{ cases}\\
xxxx100000&&6\text{ numbers fixed, so }2^4\text{ cases}
\end{array}$$
So there's $2\cdot 2^4 + 4\cdot2^3=2^5+2^5=2^6=64$ bit strings with 5 consecutive 0's.
The case of 5 consecutive 1's is exactly the same, so there's 64 bit strings with 5 consecutive 1's.
But, note we are counting twice the cases with 5 consecutive 1's and 5 consecutive 0's:
$$0000011111\qquad 1111100000$$
So we need to substract 2 (2 possible bit strings) for a total of:
$$64+64-2=126\text{ bit strings with either 5 consecutive 0's or 1's}$$
Best Answer
Yes, you are correct about each separate case, but to find the number of bit strings of length $8$ that either start with two zeros or end in a one (or both), we cannot simply *add* the two counts and say "we're done." We can use the sum rule, but with modifications:
If we add the counts $2^6 + 2^7$, we need to also account for having double counted those bit strings which both start with two zeros and end in a one: Subtract that number of strings from the sum, and you'll have your answer.
Clarification: The number of bit strings of length 8 of the form
0 0 x x x x x 1
will have been counted $(1)$ in the first total of all strings of the form0 0 x x x x x x
, and $(2)$ it will have been counted in the second total of all strings of the formx x x x x x x 1
. So we need to subtract the number of strings of the form0 0 x x x x x 1
from the combination of the first count and second count, so that they are only counted once.So, we count the number of bit strings of the form:
0 0 x x x x x 1
,and just as you computed the first two counts, we see that there are $2^5$ such strings which have been counted twice, so we will subtract that from the sum of the first two counts.
Total number of bit strings that start with two zeros $(2^6)$ or end in a one $(2^7)$ or both ($2^5$):
$$ 2^6 + 2^7 - 2^5$$