Player $A$ and player $B$ are playing coin tossing game. Player $A$ has $n$ coins, player B has $m$ coins. If two head or tails turn up then player $A$ takes both coins. Otherwise player $B$ takes them.
I'm thinking this way:
Let us define $F_{n,m}$ - expected game length if $A$ has $n$ coins and $B$ has $m$. Probability of winning in a single round for both players is equal.
Then one has $$F_{n,m} = 1 + 1/2F_{n-1,m} + 1/2 F_{n,m-1}$$
Obviously $F_{0, m} = 0$ and $F_{n,0} = 0$.
How do I solve this reccurence relation? Or should I went differently about this problem?
Let $X_t$ be the number of coins player $A$ has at time $t$. Then $0\leqslant X_t\leqslant n+m$ a.s. so $X_t$ is integrable, and $$\mathbb E[X_{t+1}\mid \mathcal F_t] = \frac12(X_t+1)+\frac12(X_t-1)=X_t, $$so $\{X_t\}$ is a martingale. Let $$\tau = \inf\{t>0:X_t\in\{0,n+m\}\}. $$ Since $\tau$ is the absorption time of a birth-death Markov chain with finitely many states, $\mathbb E[\tau]<\infty$. Moreover, we have $$\mathbb E[|X_{t+1}-X_t|\mid\mathcal F_t]\leqslant 1, $$ and so by optional stopping, $$\mathbb E[X_\tau] = \mathbb E[X_0]. $$ It follows that $$\mathbb E[X_\tau\mid X_\tau=0]\mathbb P(X_\tau=0)+\mathbb E[X_\tau\mid X_\tau=n+m]\mathbb P(X_\tau=n+m)=n, $$ from which the probability of player A winning is $$ p_A:=\mathbb P(X_\tau=n+m) = \frac n{n+m}. $$
Let $W_t$ denote the winnings of player $A$ at time $t$. Then $$X_t = X_0 + \sum_{i=1}^t W_i, $$ and where the $W_i$ are i.i.d. with $$\mathbb P(W_1=1)=\mathbb P(W_1=-1)=\frac12. $$ Since $\mathbb E[W_1]=0$ and $\mathbb E[W_1^2]=1$, Wald's second identity yields $$\mathbb E\left[\left(\sum_{t=1}^\tau W_t\right)^2\right] = \mathbb E[\tau].$$ Since $$\sum_{t=1}^\tau W_t = X_t-X_0, $$ it follows that \begin{align} \mathbb E[\tau] &= \mathbb E[(X_\tau-X_0)^2]\\ &= \mathbb E[(X_\tau-X_0)^2\mid X_\tau=0]\mathbb P(X_\tau=0)+E[(X_\tau-X_0)^2\mid X_\tau=n+m]\mathbb P(X_\tau=n+m)\\ &= (0-n)^2(1-p_a) + (n+m-n)^2p_a\\ &= \frac{n^2m}{n+m} + \frac{nm^2}{n+m}\\ &= nm. \end{align} Intuitively this makes sense because for a given $N=n+m$, the expected length is maximized when $n=m$ (for even $N$) or $|n-m|=1$ (for odd $N$).