I came across this question on Quora.
You have an unfair coin for which heads turns up with probability $p=\frac 35$. You flip the coin repeatedly until there have been more heads than tails. How many flips on average does this take?
Let $X$ be the random variable denoting number of flips needed to achieve more heads than tails.
I got interested in this question and tried to find the probability distribution of $X$.
It seems to me that $P(X=2n)=0$ i.e, it's not possible to achieve more heads than tails in even number of flips. For odd number of flips i.e, $X=2n+1$, there must be $n+1$ heads and $n$ tails, but I'm pretty confused how many suitable arrangements are possible.
The answers already given on Quora suggest that $\mathbb E[X]=5$ based on simulation programs.
Is there a closed form expression for probability distribution of $X$? Any help would be appreciated.
Edit: From the comments, I learned that the order of outcomes when $X=2n+1$ resembles Dyck words. You can read my Quora answer.