How many bit string of length 12 contains 01 as a substring ?
I arrived at 2^10 . taking 01 as one set and remaining as other set
How many bit string of length 12 contains 01 as a substring ?
I arrived at 2^10 . taking 01 as one set and remaining as other set
Your way of reasoning is not correctly counting the number of strings. What you should aim for is count the number of strings that DO NOT CONTAIN $01$. Such strings will be of the form $111100000000$, i.e. Starts with bunch of $1's$ Then followed by $0's$. They will be $13$ such strings (including all zeroes). Thus your answer should be $2^{12}-13$.
Anurag A has given a fine explanation of the most straightforward way to solve the problem, but I thought that someone should also explain what’s wrong with your approach. The first problem is that you didn’t take into account the fact that the $01$ block can occupy any one of $11$ different positions in the string. Thus, a first approximation to the desired number is $11\cdot 2^{10}$, not $2^{10}$.
Unfortunately, this overcounts rather badly. The string $\color{brown}{01}0000\color{green}{01}0000$, for instance, gets counted twice, once with the brown $\color{brown}{01}$ as the glued-together block, and once with the green $\color{green}{01}$ as the glued-together block. The string $010101010101$ gets counted $6$ times. To compensate for the overcounting you need an inclusion-exclusion argument. The strings with two $01$ substrings have all been counted twice, so we have to subtract them. Making two glued-together blocks, we see that we have a string of $10$ items, $2$ of which are the $01$ blocks; they can be placed in $\binom{10}2$ ways in the string, and the other $8$ bits can be chosen arbitrarily, so we count a total of $\binom{10}2\cdot2^8$ strings and get a second approximation of
$$\binom{11}1\cdot 2^{10}-\binom{10}2\cdot 2^8\;.\tag{1}$$
But now each string that has three $01$ substrings has been counted $3$ times in the first term of $(1)$ and subtracted $3$ times in the second term (why?), so in effect it isn’t counted in $(1)$ at all. Thus, we have to add those strings back in. When this process is carried to completion, we find that there are
$$\binom{11}1\cdot 2^{10}-\binom{10}2\cdot 2^8+\binom93\cdot 2^6-\binom84\cdot2^4+\binom75\cdot 2^2-\binom66\cdot 2^0$$
$12$-bit strings containing $01$ as a substring. You can check that this actually does work out to $2^{12}-13=4083$.