\problemdata
{random variable}
{f01 ps11}

\begin{problem} Suppose that $R$ is a random variable.  Let
$C$ be an event.  The {\em conditional expectation} of $R$ given that
event $C$ occurs is denoted $\expect{R \mid C}$ and is defined to be
\[
\expect{R \mid C}  ::= \sum_{x \in \text{range}(R)} x \cdot \prob{R = x \mid C}.
\]

\begin{problemparts}

\problempart Compute the expected value of the number rolled on a
fair, six-sided die, given that the outcome is even.

\solution{Let the random variable $R$ be the number rolled, and let
$C$ be the event that the number rolled is even.
\begin{eqnarray*}
\expect{R \mid C}       & = &   \sum_{x=1}^{6} x \cdot \prob{R = x \mid C} \\
                & = &   1 \cdot 0 + 2 \cdot \frac{1}{3} + 
                        3 \cdot 0 + 4 \cdot \frac{1}{3} + 
                        5 \cdot 0 + 6 \cdot \frac{1}{3} \\
                & = &   4
\end{eqnarray*}
}

\problempart Compute the expected value of the number rolled on a
fair, six-sided die, given that the outcome is odd.

\solution{Define $R$ and $C$ as before.
\begin{eqnarray*}
\expect{R \mid \overline{C}}
        & = &   \sum_{x=1}^{6} x \cdot \prob{R = x \mid \overline{C}} \\
        & = &   1 \cdot \frac{1}{3} + 2 \cdot 0 + 
                3 \cdot \frac{1}{3} + 4 \cdot 0 + 
                5 \cdot \frac{1}{3} + 6 \cdot 0 \\
        & = &   3
\end{eqnarray*}
}

\problempart Prove the following identity, assuming that all
expectations exist.
\begin{eqnarray*}
\expect{R}      & = &   \prob{C} \cdot \expect{R \mid C} +
                        \prob{\overline{C}} \cdot \expect{R \mid \overline{C}}
\end{eqnarray*}

\solution{We transform the right side into the left side.  All
summations are over $x \in \text{Range}(R)$.
\begin{eqnarray*}
\lefteqn{\prob{C} \cdot \expect{R \mid C} +
        \prob{\overline{C}} \cdot \expect{R \mid \overline{C}}} \\
        & = &   \prob{C} \cdot ( \sum_{x}
                        x \cdot \prob{R = x \mid C} )
                + \prob{\overline{C}} \cdot  ( \sum_{x}
                        x \cdot \prob{R = x \mid \overline{C}} ) \\
        & = &   \prob{C} \cdot ( \sum_{x}
                        x \cdot \frac{\prob{[R = x] \cap C}}{\prob{C}} )
                + \prob{\overline{C}} \cdot  ( \sum_{x}
                        x \cdot \frac{\prob{[R = x] \cap \overline{C}}}
                        {\prob{\overline{C}}} ) \\
        & = &   \sum_{x} x \cdot (
                        \prob{[R = x] \cap C} + \prob{[R = x] \cap \overline{C}}
                        ) \\
        & = &   \sum_{x} x \cdot (
                        \prob{([R = x] \cap C) \cup ([R = x] \cap \overline{C})}
                        ) \\
        & = &   \sum_{x} x \cdot \prob{R = x} \\
        & = &   \expect{R}
\end{eqnarray*}

The first step uses the definition of conditional expectation.  The
second step uses the definition of conditional probability.  The third
step is simplification.  The fourth step uses the fact that the
probability of a disjoint union of events is equal to the sum of the
event probabilities.  The fifth step is simplification, and the final
step uses the definition of expected value.}

\end{problemparts}
\end{problem}
