I was solving this problem:
Given a coin that lands on heads with $p$ probability, what is the probability that a series of coin flips will end with exactly one more head than tail? For instance, H and THTHH are examples of such sequences. I was able to reduce this problem to the following answer in the form of an infinite series.
$$ \sum_{n=0}^\infty C_n p^{n + 1} (1 - p)^n $$ I pop this into Wolfram and it spits out $\frac{p}{1-p}$. My question is: How do I prove this? Any help would be greatly appreciated!
This follows by taking the well-known generating function for the Catalan numbers, $$ \sum_{n\ge 0}C_n x^n=\frac{1-\sqrt{1-4x}}{2x}, $$ and setting $x\gets p(1-p)$. For a proof of the above, see https://en.wikipedia.org/wiki/Catalan_number#First_proof.