Suppose we have two jars, each containing $n$ balls. We randomly select one of the jars with equal probability and draw a ball from it. We repeat this process until one of the jars becomes empty. At this point, we want to determine the expected value of the number of balls remaining in the other jar.
This is what I have tried: I need to determine the expected time $T$ it takes to empty one of the jars. Then, the quantity of interest will be $2n - T$. Let $f(a,b)$ denote the expected time it takes to empty one of the jars, where $a$ and $b$ represent the number of remaining balls in each jar. I set up a recurrence relation for $f(a,b)$: $f(a,b) = \frac{1}{2}(f(a-1,b)+f(a,b-1))+1$, with base cases $f(a,0) = f(0,b) = 0$. However, solving this recurrence is not trivial. One approach is to find the generating function $G(x,y)$ for $f(a,b)$, which can be expressed as $G(x,y) = \frac{2xy}{(1-x)(1-y)(2-x-y)}$. I'm unsure how to proceed from here. Any help or insight would be greatly appreciated.
Conclusion: $2n - f(n,n) = \frac{4 (2n-1)!}{4^n ((n-1)!)^2}$.
I did it by numerical simulation and finding corresponding arrays.
Related to https://oeis.org/A002011
Below are some of my ideas (not complete):
We can also validate the answer by the generating function.