Negative Binomial Distribution with finite number of trials

negative binomialprobabilitystatistics

Suppose a user tosses a coin $n$ times. How do I compute the expected value of the number of heads before the user sees $k$ tails, ($k < n$)?

This looks somewhat like Negative Binomial Distribution (NBD). However, unlike this problem with a finite number of tosses ($n$), there no cap on the number of tosses in a classic NBD. I am wondering how that derivation would look?

Best Answer

"before the user sees $k$ tails, ($k < n$)"

thus last tail can range from position $k\;$ to position $(n-1)$,

which means number of heads can range from $0$ to $(n-k-1)$

Thus by symmetry, the expected number of heads before seeing $k$ tails $= \frac{n-k-1}2$