How many binary strings of length n >= 4 are there that contain exact two instances of 10 Aa said in the title, The order of 10 matters , for example for n = 4 there is only one string which is 1010, or for n=5 there are 6 strings as following :
10101, 10100, 10110, 10010, 11010, 01010 
Thanks in advance.
 A: Imagine the $n$ bits as asterisks in a line, mark the transitions $0\to 1$ as $+$ and the transitions $1\to 0$ as $-$. Then, we want to place two $-$ marks in the $n-1$ available positions, including a $+$ mark somewhere between them, and optionally a $+$ somewhere before and-or after them.
So we have the following count:
$${n-1 \choose 3}+{n-1 \choose 4}+{n-1 \choose 4}+{n-1 \choose 5}= \tag{1}$$
$$={n \choose 4}+ {n \choose 5} \tag{2}$$
$$={n+1 \choose 5} \tag{3}$$
In $(1)$, the combinatorial numbers correspond to the respective allowed patterns: 
$ ( - + - )$
$ (- + - +)$
$ ( + - + -)$
$ ( + - + - +)$.
Eqs $(2)$ and $(3)$ correspond to the Pascal triangle identity.

Update: an equivalent slightly simpler formulation would be: place an extra $0$ before the $n$ bits, and an extra $1$ after them. Then, considering the whole $n+1$ transitions available in the expanded $n+2$ string, we now have a single allowed pattern $(+ - + - +)$. Hence, the total count is
$${n+1 \choose 5} $$
A: Note: We can model the situation with generating functions. But first let's analyse the problem.

We consider binary strings consisting of $0s$ and $1s$ which contain precisely two substrings $10$.  We are looking for the number of strings with length $n\geq 4$. Each string has the shape
  \begin{align*}
  x10y10z
  \end{align*}
  with $x,y,z$ substrings of length $\geq 0$ which do not contain $10$.
How could we describe all binary strings which do not contain $10$? They are precisely the strings which start with zero or more $0s$ followed by zero or more $1s$.

Let $$1^\star=\{\varepsilon,1,11,111,\ldots\}$$ denote all strings containing only $1$s with length $\geq0$. The empty string is denoted with $\varepsilon$. The corresponding generating function is $$w^0+w^1+w^2+\ldots=\frac{1}{1-w},$$ with the exponent of $w^n$ marking the length $n$ of a string of $1s$ and the coefficient of $w^n$ marking the number of strings of length $n$. Similarly we define $0^\star=\{\varepsilon,0,00,000,\ldots\}$.

So, each of $x,y,z$ in the string $x10y10z$ is of the form $$0^\star1^\star$$ Since concatenation of strings correspond to multiplication of the corresponding generating functions we obtain for $x,y,z$
  \begin{align*}
  \left(\frac{1}{1-w}\right)^2
  \end{align*}
  All binary strings containing precisely two substrings $10$ can be described as
  \begin{align*}
  (0^\star1^\star)10(0^\star1^\star)10(0^\star1^\star)
  \end{align*}
Consequently we derive as generating function
  \begin{align*}
  w^4\left(\frac{1}{1-w}\right)^6
  \end{align*}

$$ $$

Since the number of binary strings of length $n \geq 4$ is encoded as coefficient of $[w^n]$ we finally obtain
  \begin{align*}
  [w^n]&w^4\left(\frac{1}{1-w}\right)^6\\
&=[w^{n-4}]\sum_{k=0}^{\infty}\binom{-6}{k}(-w)^k\\
&=\binom{-6}{n-4}(-1)^{n}\\
&=\binom{n+1}{5}\qquad\qquad n\geq 4
  \end{align*}

