Conditional mean of a bounded success time (source code)

= Conditional mean of a bounded success time
{title2=$\mathbb E[K\mid K\leq m]=\frac{\sum_{j=1}^m jh_j\prod_{i<j}(1-h_i)}{1-\prod_{j=1}^m(1-h_j)}$}

Let $h_j$ be the probability of first success on attempt $j$, conditional on reaching that attempt. Then the <chain rule for probabilities> gives $P(K=j)=h_j\prod_{i<j}(1-h_i)$; no assumption of independent attempts is needed when these are the specified conditional probabilities. The chance of success by attempt $m$ is $1-\prod_{j=1}^m(1-h_j)$. Divide the truncated first moment by that probability to obtain the displayed <conditional expectation>, provided its denominator is positive. This is different from counting all unsuccessful cases as though they succeeded on the last permitted attempt.