1
Given a deck of 52 cards, only consider the color black and red. Shuffle the cards. Define that a group is a sequence of same-color cards.
For example, Red/Black/Black/Black/Red/Red
is an array of 3 groups.
Q: What is the expected number of groups?
A:
Consider a simple case of 2 cards. If they have the same color, the \(E\) will be 1. \(E\) will be 2 if the 2 cards have different colors.
Therefore, we can add 1 to \(E\) whenever there is a place to change the color of two cards.
Consider another simple case of 4 cards:
Card1, Card2, Card3, Card4
There are 3 places that the number of groups can change, {Card1, Card2}
, {Card2, Card3}
, {Card3, Card4}
.
$$
\mathbb{P}(\text{2 cards colors different}) = 1 - \mathbb{P}(\text{2 cards same color})
$$
$$
\mathbb{P}(\text{2 cards same color}) = \frac{N/2 - 1}{N - 1} \text{ , where } N \text{ is the number of cards}
$$
Therefore, in the example of 4 cards, we have the expected number of groups:
$$
1 + \mathbb{P}(\text{2 cards colors different}) \times \text{{Number of places that the number of groups can change}}
$$
$$
1 + (1 - \frac{4/2 - 1}{4 - 1}) \times 3 = 1 + \frac{2}{3} \times 3 = 3
$$
The beginning 1
refers to the case when two cards have the same color, which is just 1 group to start with.
Thus, for a deck of 52 cards, the expected number of groups is: $$ 1 + (1 - \frac{52/2 - 1}{52 - 1}) \times 51 = 1 + \frac{26}{51} \times 51 = 27 $$
2
Given 100 shoelaces in a box, every time you can pick two random ends and tie them together. This will results in a longer shoelace, or they may form a loop.
Q: What is the expected number of loops?
A:
When there is only 1 shoelace, you can only pick 1 end and its other end, then 1 loop is formed.
When there are 2 shoelaces, by randomly picking 1 end, a loop can only be formed if you pick the other end of the same lace. Thus, the probability of creating a loop from two shoelaces is: $$ \mathbb{P}(L_2) = \frac{1}{3} $$
Similarly, the probability of creating a loop from 3 shoelaces is: $$ \mathbb{P}(L_3) = \frac{1}{5} $$
Therefore, we can have the expected number of loops: $$ 1 + \mathbb{P}(L_2) \times 1 + \mathbb{P}(L_3) \times 1 + … + \mathbb{P}(L_{100}) \times 1 $$ $$ = 1 + \frac{1}{3} + \frac{1}{5} + … + \frac{1}{199} = \sum_{n=1}^{100} \frac{1}{2n - 1} $$