2
$\begingroup$

A 26 card deck containing 13 "hearts" and 13 "spades" is well-shuffled. Thirteen pairs are then dealt from the deck. A pair is a "match" if it contains 1 heart and 1 spade. Let N be the number of matches. The deck will always be exhausted in each dealing, so you will always have 13 pairs. What is the expectation and variance of N?

N will always have be an odd number because you have 13 of each card, and the median of N is 7, so that's my educated guess for expectation. Beyond that, however, I'm not sure of how to approach this problem.

$\endgroup$
  • $\begingroup$ I don't see that N is well defined? Are you drawing pairs until the deck is exhausted? $\endgroup$ – Michael R. Chernick Dec 14 '17 at 0:34
  • $\begingroup$ Yes, all cards are paired until the deck is exhausted, so you will always have 13 "pairs" of cards. $\endgroup$ – BenL126 Dec 14 '17 at 0:36
  • $\begingroup$ That is what I thought but it needs to be stated in the question. $\endgroup$ – Michael R. Chernick Dec 14 '17 at 0:37
2
$\begingroup$

Expected Value

The Expected Value can be solved easily using Linearity of Expectation. Define $$X_i = \begin{cases} 1, & \text{ if the $i^{th}$ pair is a match} \\ 0, & \text{ otherwise} \end{cases}$$

It should be clear that, with this set up, we have $N = \sum_{i=1}^{13} X_i$.

Next we find $P(X_i = 1)$. Without loss of generality, assume that the first card is a heart which implies that there are $12$ hearts and $13$ spades remaining. Thus $P(X_i = 1) = \frac{13}{12+13} = 0.52$. In turn, we have $E(X_i) = 0(0.48) + 1(0.52) = 0.52$.

Now via Linearity of expectation, $$E(N) = E\left(\sum_{i=1}^{13}X_i\right) = \sum_{i=1}^{13}E(X_i) = \sum_{i=1}^{13}0.52 = 6.76$$

Variance

The calculation for variance is somewhat more involved. Since the $X_i$ are not independent we have,

$$Var(N) = Var\left(\sum_{i=1}^{13}X_i\right) = \sum_{i=1}^{13}Var(X_i) + 2\sum_{i\neq j}Cov(X_i, X_j)$$

First note that $Var(X_i) = (0.52)(0.48)$ (by recognizing that $X_i \sim Bern(0.52)$). To find the covariance of term, we start with $$Cov(X_i, X_j) = E(X_iX_j) - E(X_i)E(X_j)$$ The only new term here is $E(X_iX_j)$. With a little bit of thought, you should be able to convince yourself that $$E(X_iX_j) = P(X_i=1, X_j=1) = P(X_i=1|X_j=1)P(X_j=1)$$ We now focus on the term $P(X_i=1|X_j=1)$. In simpler terms (wlog), we are looking for "the probability the second pair is a match given that the first pair is a match." By similar logic to above, we have, $$P(X_i=1|X_j=1) = \frac{12}{11+12} = \frac{12}{23}$$.

Finally, we put all of the pieces together.

\begin{align*} Var(N) &= \sum_{i=1}^{13}Var(X_i) + 2\sum_{i\neq j}Cov(X_i, X_j) \\ &= 13(.52)(.48) + 2\binom{13}{2}\left[\frac{12}{23}(0.52) - (0.52)^2\right] \\ &= 3.385878 \end{align*}

Verification via Simulation

These answers can be easily checked in R

M <- 10000
count <- rep(0, M)
for(m in 1:M){
  deck <- c(rep(0, 13), rep(1,13))
  shuffle <- sample(deck, replace=F)
  for(i in seq(1,26,by=2)){
    if(shuffle[i]!=shuffle[i+1])
      count[m] <- count[m] + 1
  }
}

Running this simulation, mean(count) returns $6.76004$ and var(count) returns $3.396853$.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much for your detailed response! For the expected value, why is the expectation 0.52 for the ith pair? It seems to me that as you deal more cards the probabilities change, so 0.52 would only be true for the first pair of cards dealt. $\endgroup$ – BenL126 Dec 14 '17 at 6:01
  • 1
    $\begingroup$ That is true. What you are saying shows that the $X_i$ are NOT independent of eachother. Marginally however (ignoring other information), we can do the same calculation for any particular pair. Since linearity of expectation "doesn't care" about independence the result will hold. $\endgroup$ – knrumsey Dec 14 '17 at 7:22
  • $\begingroup$ Thank you for pointing out that it's the marginal probabilities that are not changing. I have one last question, if that's alright. When calculating $E(X_iX_j)$, why does the first equality hold? I've not seen expectation converted to a probability quite like that. $\endgroup$ – BenL126 Dec 15 '17 at 18:27
  • $\begingroup$ Thats subtle and I skipped the details. Since $X_i$ are binary, the product is also binary. Hence $$E(X_iX_j) = 1P(X_iX_j = 1) + 0P(X_iX_j = 0) = P(X_iX_j=1) = P(X_i = 1, X_j = 1)$$ $\endgroup$ – knrumsey Dec 15 '17 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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