\problemdata       % Takes 5 *mandatory* arguments
  {pairwise-variance}      % latex-friendly label for the prob.
  {variance}               % The topic(s) of the problem content.
  {}                       % Source (if known)
  {S02 cp12W-4}            % Usage (list ones you are aware of).
  {Nick Matsakis, S02}     % Last revision info (author, date).
\begin{problem}
Prove that $\variance{X+Y+Z} = \variance{X} + \variance{Y} +
\variance{Z}$, if $X,Y,Z$ are pairwise independent. Explain why
pairwise independence is sufficient.

{\em Reminder:} If two random variable are independent, then
$\expect{X_i X_j} = \expect{X_i} \expect{X_j}$. Given a set of random
variables, pairwise independence implies that every possible pair of
random variables is independent. Mutual independence on the other hand
implies that any two subsets of random variables must be independent.

\solution{
Let $R = X + Y + Z$.  We can compute $\expectsq{R}$ as follows:
\begin{eqnarray*}
\expectsq{R}
& = & \left(\expect{X+Y+Z}\right)^2 \\
& = & (\expect{X} + \expect{Y} + \expect{Z})^2 \\
& = & \expectsq{X} + \expectsq{Y} + \expectsq{Z} + 2\expect{X}\expect{Y} + 
       2\expect{X}\expect{Z} + 2\expect{Y}\expect{Z}
\end{eqnarray*}

Computing $\expect{R^2}$ we get:
\begin{eqnarray*}
\expect{R^2} 
& = & \expect{(X+Y+Z)^2}\\
& = & \expect{X^2 + Y^2 + Z^2 + 2XY + 2XZ + 2YZ} \\
& = & \expect{X^2}  + \expect{Y^2} + \expect{Z^2} + 2\expect{XY} + 2\expect{XZ} + 2\expect{YZ}\\
& = & \expect{X^2}  + \expect{Y^2} + \expect{Z^2} + 2\expect{X}\expect{Y} + 
       2\expect{X}\expect{Z} + 2\expect{Y}\expect{Z}
\end{eqnarray*}

Notice that the last step is only valid because the random variables are pairwise independent. Finally, we can compute $\variance{R}$.  We can begin immediately by cancelling out the cross terms leaving us with:

\begin{eqnarray*}
\variance{R}
& = & \expect{R^2} - \expectsq{R}\\
& = & \expect{X^2}  + \expect{Y^2} + \expect{Z^2} - (\expectsq{X} + \expectsq{Y} + \expectsq{Z}) \\
& = & \expect{X^2} - \expectsq{X} + \expect{Y^2} - \expectsq{Y} + \expect{Z^2} - \expectsq{Z} \\
& = & \variance{X} + \variance{Y} + \variance{Z}
\end{eqnarray*}

Thus concluding the proof.
}
\end{problem}
