$\mathbb{E}[X \mid X \geq n/2]$ when $X \sim \text{Bin}(n, 0.5)$ I'm wondering if there's a closed form for the conditional expectation $\mathbb{E}[X \mid X \geq n/2]$ when $X \sim \text{Bin}(n, 0.5)$ is drawn from the Binomial distribution with parameters $n$ and $0.5$. Thanks!
 A: $$
\begin{align}
P(X = k | X \ge \frac n2) &= \frac{P(X=k, X \ge \frac n2)}{P(X \ge \frac n2)} \\
&= \frac{P(X=k)}{P(X \ge \frac n2)} I(k \ge \frac n2) \\
&= \frac{{n \choose k}}{\sum_{i=\lfloor\frac{n+1}2\rfloor}^n {n \choose i}} I(k \ge \frac n2) 
\end{align}
$$
Hence,
$$
\begin{align}
E[X|X \ge \frac n2] &= \frac{\sum_{k=\lfloor\frac{n+1}2\rfloor}^n k{n\choose k}}{\sum_{k=\lfloor\frac{n+1}2\rfloor}^n {n\choose k}} 
\end{align}
$$
A: @xzm is correct that
$$
\begin{align}
E[X|X \ge \frac n2] &= \frac{\sum_{k=\lfloor\frac{n+1}2\rfloor}^n k{n\choose k}}{\sum_{k=\lfloor\frac{n+1}2\rfloor}^n {n\choose k}} 
\end{align}
$$
but it is possible to obtain this in closed form.
First note that $k{n\choose k}=n{n-1 \choose k-1}$. Then consider odd and even $n$ separately. For $n=2a+1$,
\begin{align}
E[X|X \ge \frac n2] &= \frac{(2a+1)\sum_{k=a+1}^{2a+1} {2a\choose k-1}}{\sum_{k=a+1}^{2a+1} {2a+1\choose k}}  &= \frac{(2a+1)\sum_{k=a}^{2a} {2a\choose k}}{\sum_{k=a+1}^{2a+1} {2a+1\choose k}} 
\end{align}
For $n$ even the sum of the "upper half" of the Binomial coefficients is $\sum_{k=a}^{2a} {2a\choose k} = \frac{1}{2}\big(2^{2a}-{2a \choose a}\big) +{2a \choose a} = 2^{2a-1} +\frac{1}{2} {2a \choose a}$, whereas for $n$ odd the sum is $\sum_{k=a+1}^{2a+1} {2a+1\choose k} = \frac{1}{2}2^{2a+1} = 2^{2a}$.
Thus
\begin{align}
E[X|X \ge \frac n2] &= \frac{(2a+1)\big(2^{2a-1}+\frac{1}{2} {2a \choose a}\big)}{2^{2a}}  &= \frac{(2a+1)\big(2^{2a}+ {2a \choose a}\big)}{2^{2a+1}}.
\end{align}
Similar calculations can be done to give a closed form for the even case. For $n=2a$, the result is
\begin{align}
E[X|X \ge \frac n2] &= \frac{4a\big(2^{2a-2}+ {2a-1 \choose a}\big)}{2^{2a}+{2a \choose a}}.
\end{align}
