One coin is fair and one is weighted so that Pr[H]=211. You randomly select one of the two coins, and flip it 5 times, noting the result of each flip.

What is the expected number of heads?

To find the expected number of heads, we need to calculate the probability of obtaining each possible number of heads and then multiply each probability by the corresponding number of heads.

Let's consider the two possible scenarios:
1. Selecting the fair coin (Probability = 0.5)
- The probability of getting 0 heads (Tails all 5 times) = (0.5)^5 = 0.03125
- The probability of getting 1 head and 4 tails = 5C1 * (0.5)^1 * (0.5)^4 = 0.15625
- The probability of getting 2 heads and 3 tails = 5C2 * (0.5)^2 * (0.5)^3 = 0.3125
- The probability of getting 3 heads and 2 tails = 5C3 * (0.5)^3 * (0.5)^2 = 0.3125
- The probability of getting 4 heads and 1 tail = 5C4 * (0.5)^4 * (0.5)^1 = 0.15625
- The probability of getting 5 heads (Heads all 5 times) = (0.5)^5 = 0.03125

Expected number of heads with the fair coin = (0 * 0.03125) + (1 * 0.15625) + (2 * 0.3125) + (3 * 0.3125) + (4 * 0.15625) + (5 * 0.03125)

2. Selecting the weighted coin (Probability = 0.5)
- The probability of getting 0 heads (Tails all 5 times) = (0.211)^0 * (0.789)^5 = 0.24074
- The probability of getting 1 head and 4 tails = 5C1 * (0.211)^1 * (0.789)^4 = 0.40119
- The probability of getting 2 heads and 3 tails = 5C2 * (0.211)^2 * (0.789)^3 = 0.26547
- The probability of getting 3 heads and 2 tails = 5C3 * (0.211)^3 * (0.789)^2 = 0.08849
- The probability of getting 4 heads and 1 tail = 5C4 * (0.211)^4 * (0.789)^1 = 0.01453
- The probability of getting 5 heads (Heads all 5 times) = (0.211)^5 = 0.00034

Expected number of heads with the weighted coin = (0 * 0.24074) + (1 * 0.40119) + (2 * 0.26547) + (3 * 0.08849) + (4 * 0.01453) + (5 * 0.00034)

To calculate the overall expected number of heads, we need to multiply the expected number of heads in each scenario by their respective probabilities and sum them up:

Expected number of heads = (Expected number of heads with the fair coin * 0.5) + (Expected number of heads with the weighted coin * 0.5)

Plug in the values you've calculated into the equation above, and you will find the expected number of heads in this scenario.