Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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

Thanks for any enlightenment!

share|cite|improve this question
@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. – Brian M. Scott Jan 14 '12 at 5:11
@BrianM.Scott, yes you are right. This was just a typo. Thanks for pointing that out. But the question still stands. :-) – Aufwind Jan 14 '12 at 5:18
@Brian I see. Thanks. I have now undeleted the post. – Srivatsan Jan 14 '12 at 7:24
up vote 3 down vote accepted

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$

share|cite|improve this answer
Your second answer was what I needed to grasp the idea. Thank you!! – Aufwind Jan 14 '12 at 15:32
You are welcome. I had such a feeling which is why I added it. But note that the first answer is the more general one: it works for all joint random variables even if they are not 0-1. – Srivatsan Jan 14 '12 at 15:34

$X_1 X_3 = 1$ if $X_1 = 1$ and $X_3 = 1$. Otherwise, $X_1 X_3 = 0$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.