How to compute conditional expectation of a discrete random variable with respect to a continuous one? while learning about conditional expectation $\operatorname{E}(X\mid Y)$, with $X$ and $Y$ being random variables, I read the corresponding Wikipedia page, where explicit formulas are given for computation of the cases where $X$ and $Y$ are both continuous, both discrete or $X$ is continuous and $Y$ is discrete (continuous here means absolutely continuous with respect to Lebesgue measure).
How about the remaining case where $X$ is discrete but $Y$ is continuous? Is there some explicit formula in terms of the pmf of $X$ and pdf of $Y$?
 A: You can think of the conditional expectation of a random variable $X$ with finite expectation given another random variable $Y$ as the expectation of $X$ if $Y$ "is known", roughly speaking we treat $Y$ as a constant. With that in mind, \begin{align*}\textbf{E}[X\mid Y=y]=\sum_{x\in\mathbb{Z}}xf_{X\mid Y}(x\mid y)\end{align*} would make sense.
By $f_{X\mid Y}(x\mid y)$ I mean the "conditional PMF of $X$ given $Y=y$", that is $f_{X\mid Y}(x\mid y):=\frac{f_{X,Y}(x,y)}{f_Y(y)}$, where $f_Y$ denotes the PDF of $Y$ and we define $f_{X,Y}(x,y):=\frac{\mathrm d~~}{\mathrm dy}\textbf{P}(X=x,Y\leqslant y)$.
We can check this using the definition of the conditional expectation: Obviously $\textbf{E}[X\mid Y=y]$ is $Y$-measurable and for every measurable $A\in\sigma(Y)$ it holds that $$\begin{align*}\int_{A}\mathbf E[X\mid Y]\mathrm dP&=\int_{y\in Y(A)}f_Y(y)\sum_{x\in\mathbb{Z}}x f_{X\mid Y}(x\mid y)\;\mathrm dy\\&=\int_{y\in Y(A)}\sum_{x\in\mathbb{Z}}xf_{X,Y}(x,y)\;\mathrm dy\\&=\sum_{x\in\mathbb{Z}}x\textbf{P}(X=x,Y\in Y(A))\\&=\int_{A}X\;\mathrm dP.\end{align*}$$ For the first and last equality we have used the Trafo-Theorem. The second follows from the fact that $Y$ is continuous and the third should follow from the Dominated Convergence Theorem. So I think this should work.
