โ† run

math-prob-01

0.000
0/1 testsยท math
Challenge ยท difficulty 4/5
# The Vanishing Coins

You start with **3 fair coins** on the table.

A **round** consists of flipping every coin that is currently on the table (all at once). After the flips, remove every coin that landed **tails**; every coin that landed **heads** stays on the table for the next round. You then play another round with whatever coins remain.

The game ends at the moment the table is empty (no coins remain).

Let $R$ be the number of rounds played until the table is empty. Compute the expected value $\mathbb{E}[R]$.

Give your answer as an exact fraction in lowest terms, written as `a/b` (for example, `7/3`).
Proposed solution
Alright, I have this problem about flipping coins and removing tails until all coins are gone. I need to find the expected number of rounds until the table is empty. Let me break it down step by step.

### Understanding the Problem
First, I need to understand the scenario:
1. **Initial Setup**: 3 fair coins on the table.
2. **Round Definition**: Flip all coins on the table. After flipping, remove all coins that show tails. The remaining heads stay for the next round.
3. **Termination Condition**: The game ends when no coins are left on the table.

I need to find the expected number of rounds, R, until the table is empty.

### Approach
This seems like a problem involving expected value and recursion. I recall that for such problems, it's often useful to define the expected value for smaller cases first and then build up to the desired case.

### Base Cases
1. **0 Coins**: If there are no coins, the game is already over. So, R = 0.
2. **1 Coin**:
   - Probability of heads (H) = 1/2 โ†’ game continues to next round.
   - Probability of tails (T) = 1/2 โ†’ game ends.
   - Expected rounds: E[1] = (1/2)*1 + (1/2)*(1 + E[0]) = (1/2)*1 + (1/2)*(1 + 0) = 1/2 + 1/2 = 1.

But, I think I made a mistake here. The expected value should be the probability of continuing plus the expected value of the next state.

Actually, the correct recursive formula is:
E[n] = 1 + sum over all possible outcomes of (probability of outcome * E[new state])

For n=1:
- With probability 1/2, the coin is tails โ†’ game ends. So, 1 round is played, and then it's over.
- With probability 1/2, the coin is heads โ†’ game continues with 1 coin again.
- So, E[1] = 1 + (1/2)*E[1] + (1/2)*0.

But, if the coin is tails, the game ends, so no additional rounds. So, the correct equation is:
E[1] = 1 + (1/2)*E[1] + (1/2)*0.

Let's solve for E[1]:
E[1] = 1 + (1/2)*E[1]
E[1] - (1/2)*E[1] = 1
(1/2)*E[1] = 1
E[1] = 2.

Hmm, that's different from my initial thought. I must have misunderstood the initial approach.

### General Recursive Formula
For n coins, the expected number of rounds E[n] can be defined as:
E[n] = 1 + sum over k=0 to n of [P(k heads) * E[k]]

Because:
1. We play one round (hence the +1).
2. After the round, we have k coins left (k heads), and the expected remaining rounds is E[k].

### Calculating E[0]
E[0] = 0, because if there are no coins, the game is over.

### Calculating E[1]
As above:
E[1] = 1 + (1/2)*E[0] + (1/2)*E[1] = 1 + (1/2)*0 + (1/2)*E[1] = 1 + (1/2)*E[1]

Solving:
E[1] - (1/2)*E[1] = 1 โ†’ (1/2)*E[1] = 1 โ†’ E[1] = 2.

### Calculating E[2]
For two coins, the possible outcomes after flipping are:
- 0 heads (both tails): probability (1/2)^2 = 1/4 โ†’ E[0] = 0
- 1 head (one tail, one head): probability C(2,1)*(1/2)^2 = 2/4 = 1/2 โ†’ E[1] = 2
- 2 heads (both heads): probability (1/2)^2 = 1/4 โ†’ E[2] = ?

So, the equation is:
E[2] = 1 + (1/4)*E[0] + (1/2)*E[1] + (1/4)*E[2] = 1 + (1/4)*0 + (1/2)*2 + (1/4)*E[2] = 1 + 1 + (1/4)*E[2] = 2 + (1/4)*E[2]

Now, solve for E[2]:
E[2] - (1/4)*E[2] = 2 โ†’ (3/4)*E[2] = 2 โ†’ E[2] = 8/3 โ‰ˆ 2.666...

### Calculating E[3]
For three coins, the possible outcomes are:
- 0 heads: probability (1/2)^3 = 1/8 โ†’ E[0] = 0
- 1 head: probability C(3,1)*(1/2)^3 = 3/8 โ†’ E[1] = 2
- 2 heads: probability C(3,2)*(1/2)^3 = 3/8 โ†’ E[2] = 8/3
- 3 heads: probability (1/2)^3 = 1/8 โ†’ E[3] = ?

The equation is:
E[3] = 1 + (1/8)*E[0] + (3/8)*E[1] + (3/8)*E[2] + (1/8)*E[3] = 1 + (1/8)*0 + (3/8)*2 + (3/8)*(8/3) + (1/8)*E[3] = 1 + (6/8) + (24/24) + (1/8)*E[3] = 1 + 3/4 + 1 + (1/8)*E[3] = 2.75 + (1/8)*E[3]

Now, solve for E[3]:
E[3] - (1/8)*E[3] = 11/4 โ†’ (7/8)*E[3] = 11/4 โ†’ E[3] = (11/4)*(8/7) = 22/7 โ‰ˆ 3.142...

### Verification
Let me double-check the calculations for E[3]:
- 1 + (3/8)*2 = 1 + 6/8 = 1 + 3/4 = 7/4
- (3/8)*(8/3) = 1
- Total so far: 7/4 + 1 = 11/4
- Plus (1/8)*E[3]

Thus, E[3] = 11/4 + (1/8)*E[3]

Subtract (1/8)*E[3] from both sides:
(7/8)*E[3] = 11/4

Multiply both sides by 8/7:
E[3] = (11/4)*(8/7) = 22/7

This matches my previous result.

### Conclusio