Difference in notation of conditional probability/expectation Currently I am learning about conditional probabilities and expectations. In this question I focus on the expectation, but the question also holds for the probability notation and variance notation. I noted that there are two different methods to write down an expectation:
$\mathbb{E}(\mathbb{E}(X \mid Y))$ and $\mathbb{E}(\mathbb{E}(X \mid Y=y))$.
I am wondering if there is a difference between these notations.
 A: Short answer, yes there is a difference.
The conditional expectation $\mathbb{E}[\mathsf{X}\mid\mathsf{Y}]$ is in itself a random variable, while $\mathbb{E}[\mathsf{X}\mid\mathsf{Y}=y]$ is just a real number.
Take for instance $\mathsf{X}\mid\mathsf{Y}\sim N(\mathsf{Y}, \sigma^2)$.
Since the expectation of a normal random variable is its mean, we find that $\mathbb{E}[\mathsf{X}\mid\mathsf{Y}]=\mathsf{Y}$, a random variable, while for any $y\in\mathbb{R}$ we have $\mathbb{E}[\mathsf{X}\mid\mathsf{Y}=y]=y$ which is not a (non-degenerate) random variable.
In general, the conditional expectation $\mathbb{E}[\mathsf{X}\mid\mathcal{F}]$ of $\mathsf{X}$ given a $\sigma$-algebra $\mathcal{F}$ is in itself a random variable satisfying certain criteria, namely being $\mathcal{F}$-measurable, integrable and integrating the same as $\mathsf{X}$ on $\mathcal{F}$, i.e. $\int_F\mathbb{E}[\mathsf{X}\mid\mathcal{F}]\mathrm{d}\mathbb{P}=\int_F\mathsf{X}\mathrm{d}\mathbb{P}$ for all $F\in\mathcal{F}$.
The conditional expectation given another random variable $\mathsf{Y}$ is implicitly the conditional expectation given $\sigma(\mathsf{Y})$, the smallest $\sigma$-algebra making $\mathsf{Y}$ measurable.
One can show that this amounts to saying that $\mathbb{E}[\mathsf{X}\mid\mathsf{Y}]=\varphi(\mathsf{Y})$ for some measurable function $\varphi$, and you may then identify the quantity $\mathbb{E}[\mathsf{X}\mid\mathsf{Y}=y]$ as $\varphi(y)$.
