        \problemdata       % Takes 5 *mandatory* arguments
        {variance-6}             % latex-friendly label for the prob.
        {variance}               % The topic of the problem content.
        {Velleman}               % Source (if known)
        {S98 PS11-7; F97 PS11-8} % Usage (list ones you are aware of).
        {Theory Pig, S02}        % Last revision info (author, date).

% Topics: Variance, Expectation
% Variants of this problem appeared in:
% SP 2000, PS 10.5, problem 3
% FA 2000, PS 11.5

\begin{problem}
Suppose you are playing the game ``Hearts'' with three of your friends.
In Hearts, all the cards are dealt to the players, in this case the four
of you will each have 13 cards.

\begin{problemparts}

\problempart
What is the expectation and variance of the number of hearts in your hand?

\solution{
Let $H$ be the number of hearts in your hand, 
and let $X_i$ be the indicator random variable 
for the event that the $i$th card in your hand is a heart. 
Then $H = \sum_{i=1}^{13} X_i$.  
So
\[
\expect{H}  = \sum_{i=1}^{13} \expect{X_i}
        = \sum_{i=1}^{13} \Pr(\text{$i$th card is a heart}) 
        = \sum_{i=1}^{13} \frac{1}{4} = \frac{13}{4}.
\]

To compute variance, 
we first compute $\expect{H^2}$, 
following the solution to Problem~4c. 
\[
\expect{H^2} = \expect{\left(\sum_{i=1}^{13} X_i\right)^2} 
        = \sum_i \expect{X_i} + \sum_i \sum_{j \neq i} \expect{X_i X_j} 
\]
Note that $X_i^2 = X_i$, so $\expect{X_i^2} = 1/4$.  
When $i \neq j$,
$X_i X_j = 1$ if cards $i$ and $j$ are both hearts, and 0 otherwise.  The
probability that both cards are hearts is $\binom{13}{2}/\binom{52}{2}$, 
so 
$\expect{X_iX_j} = \binom{13}{2}/\binom{52}{2} = 3/51$.  
In the summation above, there
are 13 $\expect{X_i^2}$ terms, and $13 \cdot 12 = 156$ terms of the
form $\expect{X_i X_j}$ with $i \neq j$.  Thus,
\[
\variance{H} = \expect{H^2} - \expect{H}^2
        = 13 \cdot \frac{1}{4} + 156 \cdot \frac{3}{51} - (\frac{13}{4})^2 
        \approx 1.864. 
\]
}

% \textbf{REVISE TO SOLVE W/O COVARIANCE:}

% To compute variance we use the identity:
% \[
% \variance{\sum X_i} = \sum \variance{X_i} + \sum_{i\neq j} \covar{X_i,X_j}.
% \]
% where the second sum is taken over all possible ordered pairs of distinct
% $i$'s and $j$'s.  Now for each indicator variable we have
% \[
% \variance{X_i} = \expect{X_i^2} - \expectsq{X_i} = 1/4 - 1/16 = 3/8,
% \]
% and for each pair of distinct indicator variables we have
% \[
% \covar{X_i, X_j} = \expect{X_i X_j}-\expect{X_i}\expect{X_j} =
% \frac{1}{4} \frac{12}{51} - \frac{1}{16} = \frac{-1}{272}.
% \]
% Putting it all together,
% \begin{eqnarray*}
% \variance{H} & = & 
% \sum_{i=1}^{13}\variance{X_i} + 2\left(\sum_{1<=i<j<=13}\covar{X_i,X_j}\right)\\
%  &  = & 13 \frac{3}{8} + 2\binom{13}{2}\frac{-1}{272} = \frac{585}{136} = 4.30147.
% \end{eqnarray*}


\problempart What is the expectation and variance of the number of suits in
your hand?

\solution{
Let $N$ denote the number of suits in a hand.
Let $X_s$ be the indicator random variable 
for the event that there is a spade in the hand. 
Define $X_h, X_d, X_c$ analogously for the three
remaining suits: hearts, diamonds, and clubs.  
Then $N = X_s + X_h + X_d + X_c$.

The expectation of each of the indicator variables is the probability
that a hand contains the corresponding suit.  Thus, for $i \in \set{s,h,d,c}$
\[
\expect{X_i} = 1 -  \frac{\binom{52-13}{13}}{\binom{52}{13}} \approx 0.9872,
\]
because $\binom{52-13}{13}$ is the number of hands that are missing the
particular suit, and $\binom{52}{13}$ is the total number of hands.
\[
\expect{N}=\expect{X_s + X_h + X_d + X_c} = \expect{X_s} + \expect{X_h} +
\expect{X_d} + \expect{X_c} \approx 4 \cdot 0.9872 = 3.9488.
\]
To compute variance, we compute $\expect{N^2}$ directly, 
and then $\variance{N} = \expect{N^2} - \expect{N}^2$. 
We first calculate $\Pr(N=i)$ for $i = 1,2,3,4$.
\[
\Pr(N=1) = \frac{4} {\binom{52}{13}} \approx 6.299 \times 10^{-12},
\]
because there are four possible hands of all one suit out of
$\binom{52}{13}$ possible hands of 13 cards.
\[
\Pr(N=2) = \frac{\binom{4}{2}\left[\binom{26}{13} - 2\right]}{\binom{52}{13}}
         \approx 9.827 \times 10^{-5},
\] 
because there are $\binom{4}{2}$ ways to choose which two suits.  There
are $\binom{26}{13}$ ways to choose 13 cards from the 26 possible cards of
those two suits.  Two of those $\binom{26}{13}$ hands actually contain
only one suit.  
\[
\Pr(N=3) = \frac{\binom{4}{3}
                    \left[\binom{39}{13} - \binom{3}{2}\binom{26}{13} 
                                + 3\right]}
                {\binom{52}{13}} \approx 0.05097,
\]
because there are $\binom{4}{3}$ ways to choose the three suits, 
and $\binom{39}{13}$ ways to choose $13$ cards from the $39$ cards of those
three suits.  But that includes hands with only one or two suits. 
So, using Inclusion-Exclusion, we subtract the
$\binom{3}{2}\binom{26}{13}$ ways to choose two of the three suits
and then choose $13$ cards from the $26$ cards of those suits. 
This subtracts out the three hands with only one suit twice, 
so we add these back. 

Of course, 
\[
\Pr(N=4) = 1 - (\Pr(N=1) +\Pr(N=2) + \Pr(N=3)) \approx 0.9489.
\]
Thus, 
\begin{align*}
\expect{N^2} & = 1 \cdot \Pr(N=1) + 4 \cdot \Pr(N=2) 
                + 9 \cdot \Pr(N=3) + 16 \cdot \Pr(N=4) \\
        & \approx 0 + 0.0004 + 0.4587 + 15.1824 = 15.6415
\end{align*}
This allows us to complete the calculation of the variance:
\[
\variance{N} \approx 15.6415 - (3.9488)^2 \approx 0.0485.
\]
}

\end{problemparts}

\end{problem}
%

%\begin{problem}
%Suppose you are playing the game ``Hearts'' with three of your friends.
%In Hearts, all the cards are dealt to the players, in this case the four
%of you will each have 13 cards.

%\begin{problemparts}

%\problempart What is the expectation and variance of the number of hearts that you will have in your hand?

%\solution{

%Let $H$ be the number of hearts in your hand, and let $X_i$ be the
%indicator variable that is 1 if card $i$ is a heart and is 0 otherwise, so
%$H = \sum_{1\leq i\leq 13} X_i$.  Because $X_i$ is an indicator variable,
%its expectation is the probability that card $i$ is a heart, namely, 1/4.
%So
%\[
%\expect{H} = \sum_1^{13} 1/4 = 13/4.
%\]

%To compute variance, we use the definition:
%\begin{eqnarray*}
%\variance{\sum_{i=1}^{13} X_i} &=&
%    \expect{(\sum_{i=1}^{13} X_i)^2} - \expect{\sum_{i=1}^{13} X_i}^2 \\
%        &=& \expect{(\sum_{i=1}^{13} X_i)^2} - (13/4)^2 \\
%        &=& \mathrm{E}[X_1^2 + X_1X_2 + X_1X_3 + \ldots + X_1X_{13} + \\
%        &&   X_2X_1 + X_2^2 + X_2X_3 + \ldots + X_2X_{13} + \\
%        &&        \vdots \\
%        &&   X_{13}X_1 + X_{13}X_2 + \ldots + X_{13}^2] - (13/4)^2 \\
%        &=& \expect{X_1^2} + \expect{X_1X_2} + \expect{X_1X_3} + \ldots + \expect{X_1X_{13}} + \\
%        &&  \expect{X_2X_1} + \expect{X_2^2} + \expect{X_2X_3} + \ldots + \expect{X_2X_{13}} + \\
%        &&        \vdots \\
%        &&   \expect{X_{13}X_1} + \expect{X_{13}X_2} + \ldots + \expect{X_{13}^2} - (13/4)^2.
%\end{eqnarray*}
%Now we note that $\expect{X_i^2} = \expect{X_i}$ since $X_i$ is an
%indicator variable, so $\expect{X_i^2} = 1/4$.  Also, when $i \neq j$,
%$X_iX_j = 1$ if cards $i$ and $j$ are both hearts, and 0 otherwise.  The
%probability that both cards are hearts is $(1/4)(12/51)$, and thus
%$\expect{X_iX_j} = (1/4)(12/51) = 3/51$.  In the summation above, there
%are 13 $\expect{X_i^2}$ terms, and $2\binom{13}{2} = 156$ terms of the
%form $\expect{X_iX_j}$.  Thus,
%\begin{eqnarray*}
% \variance{\sum_{i=1}^{13} X_i} &=& 13 \cdot \frac{1}{4} + 156 \cdot \frac{3}{51} - (\frac{13}{4})^2 \\
%                &\approx& 1.863970588.
%\end{eqnarray*}

%}

%
%\problempart What is the expectation and variance of the number of suits in
%your hand?

%\solution{
%\medskip
%\textbf{Solution:}

%Similar to the first part: let $N$ denote the number of suits in a hand.
%Let $X_s$ be the indicator variable which is 1 if there is a spade in the
%hand and 0 otherwise. Define $X_h, X_d, X_c$ analogously for the three
%remaining suits: hearts, diamonds, and clubs.  Then $N = X_s + X_h + X_d +
%X_c$.

%The expectation of each of the indicator variables is the probability
%that a hand contains the corresponding suit.  Thus, for $i \in \set{s,h,d,c}$
%\[
%\expect{X_i} = 1 -  \frac{\binom{52-13}{13}}{\binom{52}{13}} = 0.987209,
%\]
%because $\binom{52-13}{13}$ is the number of hands that are missing the
%particular suit, and $\binom{52}{13}$ is the total number of hands.
%\[
%\expect{N}=\expect{X_s + X_h + X_d + X_c} = \expect{X_s} + \expect{X_h} +
%\expect{X_d} + \expect{X_c} = 4 \cdot 0.987209 = 3.94884.
%\]
%To compute variance:
%\begin{eqnarray*}
% \variance{N} &=& \Pr(N=1)(1 - \expect{N})^2 + \Pr(N=2)(2- \expect{N})^2 + \\
%              & & \qquad \Pr(N=3)(3 - \expect{N})^2 + \Pr(N=4)(4 - \expect{N})^2.
%\end{eqnarray*}
%Now we must calculate each of the probabilities.  First,
%\[
%\Pr(N=1) = \frac{4} {\binom{52}{13}} = 6.299 \times 10^{-12},
%\]
%because there are four possible hands of all one suit out of
%$\binom{52}{13}$ possible hands of 13 cards.

%\[
%\Pr(N=2) = \frac{\binom{4}{2}[\binom{26}{13} - 2]}{\binom{52}{13}}
%             = 9.827 \times 10^{-5},
%\] 
%because there are $\binom{4}{2}$ ways to choose which two suits.  There
%are $\binom{26}{13}$ ways to choose 13 cards from the 26 possible cards of
%those two suits.  Two of those $\binom{26}{13}$ hands actually contain
%only one suit.  Thus $\binom{4}{2}(\binom{26}{13} -2)$ is the number of
%hands with two suits.

%\[
%\Pr(N=3) = \frac{\binom{4}{3}[\binom{39}{13} -
%\binom{3}{2}\binom{26}{13} + 3]}{\binom{52}{13}} = 0.05097,
%\]
%because there are $\binom{4}{3}$ ways to choose the three suits.  There
%are $\binom{39}{13}$ ways to choose 13 cards from the 39 cards of those
%three suits.  But that also includes hands with two suits and one suit.
%So, using Inclusion-Exclusion, we subtract the
%$\binom{3}{2}\binom{26}{13}$ ways to choose two suits from the three suits
%and then choose choose 13 cards from the 26 cards of those suits.  Next,
%we add back the three ways to choose hands of one suit among the three.
%Finally, we divide by the $\binom{52}{13}$ ways to choose a possible hand
%of 13.

%Of course, 
%\[
%\Pr(N=4) = 1 - (\Pr(N=1) +\Pr(N=2) + \Pr(N=3)) = 0.9489.
%\]
%This allows us to complete the calculation of the variance:
%\[
%\variance{N}=0.04874.
%\]

%}

%\end{problemparts}
%\end{problem}



