follow up: A flips an **unfair** coin 11 times, B 10 times: what is the probability A gets more heads? 
*

*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 question


*I 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()


We have that
$$A\sim\text{Bin}(11,q)$$
and
$$B\sim\text{Bin}(10,p)$$
We want
$$\begin{align}
\text{Pr}(A>B)&=1-\text{Pr}(A\leq B)\\
&=1-\sum_{i=0}^{10}\text{Pr}(B=i)\cdot\text{Pr}(A>i)\\
&=1-\sum_{i=0}^{10}\text{Pr}(B=i)\cdot\big(1-\text{Pr}(A\leq i)\big)\\
&=1-\sum_{i=0}^{10}\text{Pr}(B=i)\cdot\bigg(1-\sum_{j=0}^{i}\text{Pr}(A=j)\bigg)\\
&=1-\sum_{i=0}^{10}{10\choose i}p^{i}(1-p)^{10-i}\cdot\bigg(1-\sum_{j=0}^{i}{11\choose j}q^{j}(1-q)^{11-j}\bigg)
\end{align}$$
