# Finding the probability of two random variables being equal to 1

Question:

A die is thrown $$n+2$$ times. After each throw a '$$+$$' is recorded for $$4$$, $$5$$, or $$6$$ and '$$-$$' for $$1$$,$$2$$, or $$3$$, the signs forming an ordered sequence. To each, except the first and the last sign, is attached a characteristic random variable which takes the value $$1$$ if both the neighboring signs differ from the one between them and $$0$$ otherwise. If $$X_1, X_2, \ldots , X_n$$ are the characteristic random variables, find the mean and variance of $$X = \sum_{i=1}^n X_i$$

Problematic part:

$$V(X) = V(X_1+X_2+\cdots+X_n) = \sum_{i=1}^n V(X_i) +2\sum_{i=1}^n\sum_{j=1, j>i}^n Cov(X_i,X_j)$$

Calculating the variance of $$X$$ requires calculating the covariance of two arbitrarily chosen random variables $$X_i$$ and $$X_j$$.

The formula then used is $$Cov(X_i,X_j) = E(X_iX_j) - E(X_i)E(X_j)$$

Which brings us to the essence of my problem -- How to find $$E(X_iX_j)$$?

It is certain that $$X_iX_j$$ can take only two values, namely, $$0$$ and $$1$$. Therefore $$E(X_iX_j) = 1.P(X_iX_j=1) + 0.P(X_iX_j=0)= P(X_iX_j=1)$$

But at this point I'm not sure how to compute the probability. The book I'm using says the probability is $$1/8$$, but I can't seem to wrap my head around the reasoning. An intuitive explanation would be highly appreciated!

Assuming the die is thrown independently, $$X_i$$ and $$X_j$$ are independent if $$j \geq i + 3$$. So in that case the convariance is $$0$$. So you only have to calculate $$E[X_iX_{i+1}] = E[X_1X_2]$$ and $$E[X_iX_{i+2}]=E[X_1X_3]$$ which should be easy by just looking at all the possible outcomes.