# An expression of a conditional expectation using the law of iterated expectation

Suppose that we have a discrete random variable $$D$$ with the support $$\mathcal{S}_0=\left\{ d_1,\ldots,d_{20}\right\}$$.

In addition, consider a subset of the support like $$\mathcal{S}_1=\left\{d_1,\ldots,d_{10}\right\} \subset \mathcal{S}_0$$.

Lastly, we have two continuous random variables $$X$$ and $$Y$$.

Here, I have two questions.

First, I want to express $$\mathbb{E}\left[Y\middle|X,D=d_1\;or\;D=d_2\;or\;\ldots\;or\;D=d_{10}\right]$$ as $$\mathbb{E}\left[Y\middle|X,D\in \mathcal{S}_1\right]$$.

Is this a valid expression? More compactly, is it possible to write \begin{align*} \mathbb{E}\left[Y\middle|X,D=d_1\;or\;D=d_2\;or\;\ldots\;or\;D=d_{10}\right]=\mathbb{E}\left[Y\middle|X,D\in \mathcal{S}_1\right] \end{align*}.

Second, if the answer to the first question is yes, by the law of iterated expectation, the following derivation may be correct. \begin{align*} \mathbb{E}\left[Y\middle|X,D\in \mathcal{S}_1\right]&=\mathbb{E}\left[\mathbb{E}\left[Y\middle| X,D\in\mathcal{S}_1,D\right]\middle|X,D\in\mathcal{S}_1\right] \\[5pt] &=\sum_{d\in\mathcal{S}_1}\mathbb{E}\left[Y\middle|X,D\in\mathcal{S}_1,D=d\right]\Pr\left[D=d\middle|X,D\in\mathcal{S}_1\right] \\[5pt] &=\sum_{d\in\mathcal{S}_1}\mathbb{E}\left[Y\middle|X,D=d\right]\Pr\left[D=d\middle|X,D\in\mathcal{S}_1\right] \end{align*} Are any of the above statements incorrect?

In my shallow knowledge, the there is nothing wrong. But, I want to confirm my derivation.

Thank you.

It's correct, but faster: $$\mathbb{E}\left[Y\middle|X,D\in \mathcal{S}_1\right]=\frac{1}{Pr(D\in S_1|X)}\int\limits_{D\in S_1}YdP_{\Omega/X}=\frac{\sum_{d\in S_1}\mathbb{E}[Y.I_{\{d\}}(D)|X]}{\sum_{d\in S_1}Pr[D=d|X]}$$