I am wondering how can we get the last equation in the picture.
I can't get it from the defination of conditional expectation.

It's in book https://zh.1lib.limited/book/5399963/e7ba93
I am wondering how can we get the last equation in the picture.
I can't get it from the defination of conditional expectation.

It's in book https://zh.1lib.limited/book/5399963/e7ba93
Copyright © 2021 JogjaFile Inc.
Note that $\ell$ takes the value $\min(\emptyset) = \infty$ if $X < k$. So $\ell \in \{1, \dots, n\} \iff X \geq k$. So \begin{align} E(X \mid X \geq k) &= E(\sum_{i = 1}^nX1_{\{\ell = i\}} \mid X \geq k) \\ &= \sum_{i = 1}^{n}E(X 1_{\{\ell = i\}} \mid X \geq k) \\ &= \sum_{i = 1}^{n}P(\ell = i \mid X \geq k)E(X \mid \ell = i, X \geq k) \\ &= \sum_{i = 1}^{n}P(\ell = i \mid X \geq k)E(X \mid \ell = i). \end{align}