Expectation and Variance of the Number of Changes of Sign in a Sequence

96 Views Asked by At

Let $X_1, X_2, . . . , X_n$ be independent random variables taking values $1$ and $−1$ with probabilities:

$P (X_j = −1) = P (X_j = 1) = 1/2$ for any $j \in [n]$.

Let $N$ be the number of changes of sign in the sequence $X_1, X_2, . . . , X_n$ (for example, there are $3$ changes of sign in the sequence $1, 1, −1, 1, 1, 1, −1, −1)$.

Find the expectation and the variance of $N$.

Can someone give me a hint on how to start this problem? I know there's something to do with using an indicator function.

1

There are 1 best solutions below

0
On

Let $Z_i = \mathbf{1}[X_i \ne X_{i+1}]$.

Mean. One can show $E[Z_i]=P(X_i \ne X_{i+1})=1/2$, so $E[Z_1+\cdots+Z_{n-1}]=(n-1)/2$.

Sketch for variance: For the variance you need to find second moments, since \begin{align}Var(Z_1+\cdots+Z_{n-1}) &= E(Z_1+\cdots+Z_{n-1})^2 - (E[Z_1 + \cdots + Z_{n-1}])^2\\&=E(Z_1+\cdots+Z_{n-1})^2 - \frac{(n-1)^2}{4}.\end{align}

Since $Z_i$ is an indicator, $E Z_i^2=EZ_i=1/2$.

We have two cases for $E [Z_i Z_j]$. Without loss of generality assume $i<j$.

If $j=i+1$, then $E[Z_iZ_j]=P[X_i \ne X_{i+1} \ne X_{i+2}] = \frac{1}{4}$.

If $j> i+1$, then $E[Z_i Z_j] = P(X_i \ne X_{i+1}) P(X_j \ne X_{j+1}) = \frac{1}{4}$ as well. [In general if $P(X_i=1)=p$ where $p \ne 1/2$, these two cases would not match.]

Expanding the square $(Z_1+\cdots+Z_{n-1})^2$ in the above formula for variance and plugging in these results will lead you to the answer.