I added a follow up question
what if the coin is unfair?
to my original question A flips a fair coin 11 times, B 10 times: what is the probability A gets more heads than B?, but the moderators asked me to start a new questionI believe the "naive approach" in the original question is wrong, it is only correct by accident. Because if they use an unfair coin, where $p_H$ is the probability to get head, and if we follow the same "naive method":
For the first 10 times of A, he has the same expected number of heads as B. So if the 11th flip of A results in H, he gets more head than B, so the answer is $p_H$.
- this answer is wrong based on the following numerical result:
from matplotlib import pyplot as plt
import numpy as np
from scipy.special import comb as C
def game(p, n1=11, n2=10):
q = 1-p
x = sum([
C(n1, a) * p**a * q**(n1-a) * sum([
C(n2, b) * p**b * q**(n2-b)
for b in range(0, a-1 + 1)
])
for a in range(0, n1 + 1)
])
return x
p = np.linspace(0, 1, 100)
x = [game(pi) for pi in p]
plt.plot(p, x)
plt.xlabel('unfair coin: p(head)')
plt.ylabel('probability A gets more head')
plt.axhline(0.5)
plt.axvline(0.5)
plt.show()