Suppose $n (n\ge 2)$ coins are tossed independently in a row. Let $X$ denote the number of instances in which a head is followed by a tail. Find variance of $X$.
I tried using indicator random variables.
Let $Y_n$ be the event of the $n^{th}$ toss being a head and the $n+1^{th}$ toss being a tail. $P(Y_n)=\displaystyle\frac{1}{4} \forall n$. Let $I_n$ be the indicator $\text{R.V.}$ for $Y_n$.
I found $E(X)=\displaystyle\frac{(n-1)}{4}$
I'm struggling with $E(X^2)$. The entire calculation becomes too messy and doesn't seem right. I'm getting a quadratic equation of $n$, which is definitely heading in the wrong direction.
Can someone please guide me with this problem? Thank you.
For $ n \ge 2$, let $ {\left({X}_{i}\right)}_{1 \leqslant i \leqslant n}$ be i.i.d random variables and $ f \colon {\mathbb{R}}^{2} \rightarrow \mathbb{R}$ be any bounded measurable function, finally, let
\begin{equation}X = \sum _{i = 1}^{n-1} f \left({X}_{i} , {X}_{i+1}\right)\end{equation}
Then
\begin{equation}\text{Var} \left(X\right) = \left(n-1\right) {\nu}+2 \left(n-2\right) \left({\xi}-{{\mu}}^{2}\right)\end{equation}
where
\begin{equation}{\mu} = E \left[f \left({X}_{1} , {X}_{2}\right)\right], \quad {\nu} = \text{Var} \left(f \left({X}_{1} , {X}_{2}\right)\right), \quad {\xi} = E \left[f \left({X}_{1} , {X}_{2}\right) f \left({X}_{2} , {X}_{3}\right)\right] \left[n \geqslant 3\right]\end{equation}
Indeed, it is clear that $E \left(X\right) = \left(n-1\right) {\mu}$ and
\begin{equation}\begin{array}{rcl}E \left[{X}^{2}\right]&=&\displaystyle \sum _{i = 0}^{n-1} \sum _{j = 0}^{n-1} E \left[f \left({X}_{i} , {X}_{i+1}\right) f \left({X}_{j} , {X}_{j+1}\right)\right]\\ &=&\displaystyle \sum \sum _{\left|i-j\right| = 0}+\sum \sum _{\left|i-j\right| = 1}+\sum \sum _{\left|i-j\right| \geqslant 2}\\ &=&\left(n-1\right) \left({\nu}+{{\mu}}^{2}\right)+2 \left(n-2\right) {\xi}+\left({\left(n-1\right)}^{2}-\left(n-1\right)-2 \left(n-2\right)\right) {{\mu}}^{2}\\ &=&\left(n-1\right) {\nu}+2 \left(n-2\right) {\xi}+{\left(E \left[X\right]\right)}^{2}-2 \left(n-2\right) {{\mu}}^{2} \end{array}\end{equation}
which implies the result.
In our case, we have $ f \left({X}_{i} , {X}_{i+1}\right) = 1$ if $ \left({X}_{i} , {X}_{i+1}\right) = \left(0 , 1\right)$ and $0$ otherwise, where $ {X}_{i} = 1$ if the $ i$ -th coin is a tail and $0$ otherwise. It follows that
\begin{equation} {\mu} = \frac{1}{4} \qquad {\nu} = \frac{3}{16} \qquad {\xi} = 0\end{equation}
Hence
\begin{equation}\text{Var} \left(X\right) = \frac{3 \left(n-1\right)}{16}-\frac{2 \left(n-2\right)}{16} = \frac{n+1}{16}\end{equation}