# Why is $E(X_1Y_3)=P(X_1=1,X_3=1)$

I have a little problem about the notation and the equation described below.

Let $X_0,X_1,X_2,\dots$ be $\{0,1\}$-valued random variables defined as follows:

• $X_0=0$
• for $n\geq 1$ do
• if $X_{n-1}=1$ then $X_n=0$ else $X_n=Z_n$ end if

The random variables $Z_n$ are independent from $X_0,X_1,X_2,\dots$ and are defined as $P(Z_n=1)=P(Z_n=0)=\frac{1}{2}$.

I saw a calculation of the covariance $cov(X_1X_3)$:

\begin{align} cov(X_1X_3)&=E(X_1X_2)-E(X_1)E(X_3) \\ &=P(X_1=1,X_3=1)-P(X_1=1)P(X_3=1) \end{align}

And here is my problem. Why is the last equity true?

Since $X_i$ is $\{0,1\}$-valued I know that $$E(X_i)=0*P(X_i=0)+1*P(X_i=1)=P(X_i=1)$$

But I don't see why

$$E(X_1X_3)=P(X_1=1,X_3=1)$$

is true! I am sure this is trivial, but I don't get it.

Thanks for any enlightenment!

• @Srivatsan: It appears to me that $E(X_1X_2)$ is a typo for $E(X_1X_3)$, in which case your answer (with minor subscript adjustments) is fine. Jan 14, 2012 at 5:11
• @BrianM.Scott, yes you are right. This was just a typo. Thanks for pointing that out. But the question still stands. :-) Jan 14, 2012 at 5:18
• @Brian I see. Thanks. I have now undeleted the post. Jan 14, 2012 at 7:24

The expectation of a joint random variable $f(X_1, X_3)$ is given by $$E[f(X_1, X_3)] = \sum_{x_1, x_3} f(x_1, x_3) \cdot P(X_1 = x_1, X_3 = x_3).$$ For $f(X_1, X_3) = X_1 X_3$, $$E[X_1X_3 ] = \sum_{x_1 = 0}^{1} \sum_{x_3=0}^{1} x_1x_3 \cdot P(X_1 = x_1, X_3 = x_3).$$ Three out of the four summands in the above sum drop out, leaving only one term behind: the one corresponding to $x_1 = x_3 =1$. This gives us $$E[f(X_1, X_3)] = P(X_1 = 1, X_3 = 1). \quad \diamond$$
Alternatively, consider the joint random variable $Y = X_1 X_3$. It turns out that when $X_1$ and $X_3$ are $0$-$1$ random variables, then so is $Y$. And for a $0$-$1$ random variable $Y$, you know the the expectation is given by $$E[Y] = P(Y = 1).$$ Now notice that $Y = X_1 X_3$ equals $1$ if and only if $X_1 = X_3 = 1$, and equals $0$ if either $X_1$ or $X_3$ is $0$. $\quad \diamond$
$X_1 X_3 = 1$ if $X_1 = 1$ and $X_3 = 1$. Otherwise, $X_1 X_3 = 0$.