Probability of getting H from tossing a coin is $p$. We toss a coin $n$ times. What is probability that number of H will be odd.
My work.
If we toss one time then it's just $p$. P(#2)=$p(1-p)$, (#$2$) - $2$ tosses
And so if n is even then
$P$(#n)$=p(1-p)^{n-1} + p^3(1-p)^{n-3} + \cdots p^{n-1}(1-p)$
If n is odd.
$P$(#n)$=p(1-p)^{n-1} + p^3(1-p)^{n-3} + \cdots p^{n}$
How combine this two and get some compact form?
I can see geometric progression pattern but can't make use of that.