# Difference between $\mathbb{E}[Y|X]$ and $\mathbb{E}[Y|X=x]$

Let $$(\Omega, \mathcal{A}, \mathbb{P})$$ be a probability space and $$X: \Omega \rightarrow \mathcal{X}$$ and $$Y: \Omega \rightarrow \mathcal{Y}$$ be random variables.

I have two questions comparing the conditional expectations $$\mathbb{E}[Y|X]$$ and $$\mathbb{E}[Y|X=x]$$.

1.) What is the difference between $$\mathbb{E}[Y|X=x]$$ and $$\mathbb{E}[Y|X]$$ in terms of their mathematical properties? I.e., from which space to which space do they map, which variables are they functions of and if they are measurable?

2.) If $$X$$ and $$Y$$ are absolutely continuous real valued random variables and have a joint density $$f_{X, Y}$$ with respect to the Lebesgue-measure $$\lambda \otimes \lambda =\lambda^2$$, Then: $$\mathbb{E}[Y|X=x] = \int y \, f_{Y|X=x}(y) \, \lambda(dy) = \int y \, \frac{f_{X, Y}(x,y)}{f_X(x)}\lambda(dy).$$

My question is now, how would that equation look like for $$\mathbb{E}[Y|X]$$? Does it make sense to write something like $$f_{Y|X=X}(y)$$ and $$f_{X,Y}(X,y)$$ and do these quantity even exist? I.e., should I write $$\mathbb{E}[Y|X] = \int y \, f_{Y|X=X} \lambda(dy) = \int y \, \frac{f_{X, Y}(X,y)}{f_X(X)}\lambda(dy)$$?

• $\mathbb{E}[Y\mid X=x]$ is a value which depends on $x$, while $\mathbb{E}[Y\mid X]$ is a function of $X$ and so a random variable. If you define $g(x) = \mathbb{E}[Y\mid X=x]$, then you can say $\mathbb{E}[Y\mid X]= g(X)$ Commented Oct 25, 2021 at 16:57
• So but then $\mathbb{E}[Y|X=x]$ is also a function of $x$, no? Commented Oct 26, 2021 at 13:52
• $g(x)$ is a function of $x$, though for given $x$ it is just a value. But it is not a random variable or a function of a random variable Commented Oct 26, 2021 at 13:58
• So what I am wondering is how I should interprete $\mathbb{E}[Y|X=x]$. So is that a function $g(\cdot)$ or is it a function value with a specific fixed $x$, i.e., is it the function $g$ evaluated at $x$, $g(x)$? Commented Oct 26, 2021 at 14:15
• It is certainly the later, since it is the conditional expectation of $Y$ given that $X$ takes the specific value $x$. Commented Oct 26, 2021 at 14:18

In measure-theoretic probability, it is important to understand that while $$E[Y|X]$$ is a carefully defined mathematical object (as a Radon-Nikodym derivative), "$$E[Y|X = x]$$" is merely a shorthand notation that is based on $$E[Y|X]$$. Specifically, since (a fixed version of) $$E[Y|X]$$ is $$\sigma(X)$$-measurable, there exists (cf. Theorem 20.1 in Probability and Measure (3rd ed.) by Patrick Billingsley; Lemma of Theorem 9.1.2 in A Course in Probability Theory by Kai Lai Chung) a Borel measurable function $$\varphi$$ such that $$E[Y|X] = \varphi(X)$$. "$$E[Y|X = x]$$" is then defined as \begin{align*} E[Y|X = x] = \varphi(x), x \in \mathbb{R}. \tag{1}\label{1} \end{align*}

This convention is further clarified by Chung as follows (also see remarks by me at the end of this answer):

As a consequence of the theorem, the function $$E[Y|X]$$ of $$\omega$$ is constant a.e. on each set on which $$X(\omega)$$ is constant. By an abuse of notation, the $$\varphi(x)$$ above is sometimes written as $$E[Y|X = x]$$.

...

Generalization to a finite number of $$X$$'s is straightforward. Thus one version of $$E[Y|X_1, \ldots, X_n]$$ is $$\varphi(X_1, \ldots, X_n)$$, where $$\varphi$$ is an $$n$$-dimensional Borel measurable function, and by $$E[Y|X = x_1, \ldots, X_n = x_n]$$ is meant $$\varphi(x_1, \ldots, x_n)$$.

To summarize, in measure-theoretic probability theory, there is only one unambiguous definition of the concept conditional expectation, which is $$E[Y|X]$$. In contrast, the widely used notation "$$E[Y|X = x]$$" does not possess its own specific definition, but is merely a derivative of the fundamental notion $$E[Y|X]$$. In other words, there is a chronological order between these two objects: one cannot define $$E[Y|X = x]$$ independently without first settling down the definition of $$E[Y|X]$$. For this reason, "$$E[Y|X = x]$$" is not a universally accepted notation in rigorous probability texts -- for example, I have never seen Billingsley used $$E[Y|X = x]$$ for a single time throughout his classical text Probability and Measure.

For your second question, what you stated is correct. The same expression of $$E[Y|X]$$ in this case is also given in Problem 34.2 in Probability and Measure. On the other hand, you seemed to imply that this expression is a corollary of the expression $$E[Y|X = x]$$ which you laid out first. As I commented above, this is not the case (as you reversed the correct chronological order): you can verify that \begin{align*} g(X) := \frac{\int_{-\infty}^\infty f(X, y)ydy}{\int_{-\infty}^\infty f(X, y)dy} \end{align*} is a version of $$E[Y|X]$$ directly by checking $$g(X)$$ satisfies (with the help of Fubini's theorem) the two defining properties of the conditional expectation. After completing this step, it is then customary to write $$g(x) = \frac{\int_{-\infty}^\infty f(x, y)ydy}{\int_{-\infty}^\infty f(x, y)dy}$$ as $$E[Y|X = x]$$.

### Technical Notes

To reinforce the understanding of the convention $$\eqref{1}$$, let's verify that the statement "$$E[Y|X]$$ of $$\omega$$ is constant a.e. on each set on which $$X(\omega)$$ is constant." in the quotation block and try to understand why Chung said writing $$\varphi(x)$$ as $$E[Y|X = x]$$ is "an abuse of notation".

First of all, for a fixed version $$\varphi(X)$$ of $$E[Y|X]$$, on each $$\omega$$ in the set $$\{X = x\}$$, it is clear that $$\varphi(X)(\omega) = \varphi(X(\omega)) = \varphi(x)$$, which is a constant. The stake of this statement is that if $$\psi(X)$$ is another version of $$E[Y|X]$$, then \begin{align*} P(\psi(X) \neq \varphi(x), X = x) = 0, \end{align*} this is a consequence of \begin{align*} P(\psi(X) \neq \varphi(x), X = x) = P(\psi(X) \neq \varphi(X), X = x) \leq P(\psi(X) \neq \varphi(X)) = 0. \end{align*} The last equality holds because any two versions of the conditional expectation are equal with probability $$1$$. Therefore, an accurate interpretation of $$\eqref{1}$$ should be: given a fixed version $$\varphi(X)$$ of $$E[Y|X]$$, for each $$x \in \mathbb{R}^1$$ and any other version $$\psi(X)$$ of $$E[Y|X]$$, it holds that for each $$\omega \in \{X = x\}$$ outside a null set (depending on $$\psi$$), we have \begin{align*} \psi(X)(\omega) = \varphi(x). \end{align*} Note that it is possible to have an $$\omega' \in \{X = x\}$$ such that $$\psi(X)(\omega') \neq \varphi(x)$$, but such $$\omega'$$ is within a null set. Since technically $$\psi(X)$$ and $$\varphi(X)$$ do not need to agree everywhere on $$\{X = x\}$$, yet $$E[Y | X = x]$$ in appearance is a single value, that's probably the reason why Chung added the qualifier "By an abuse of notation". However, this is a really a minor "abuse", just like people always use the notation $$E[Y|X]$$ (technically it is an equivalence class of almost surely identical random variables) to stand for a fixed version of it.

𝔼[𝑌|𝑋] is a random variable of X, where 𝔼[𝑌|𝑋=𝑥] is a constant when the random variable X is evaluated at x of its domain.

• Sure--by definition a conditional expectation is a random variable. But what exactly do you mean by "random variable of $X$"?
– whuber
Commented May 20 at 2:43
• "a random variable of X" means the function mapping from the state space to the real line, i.e. for any state there is a unique real value for it. Commented May 26 at 8:12
• People would usually just say "random variable:" the "of $X$" part is superfluous and unconventional, potentially causing confusion.
– whuber
Commented May 29 at 17:16
• @whuber Probably the OP meant "a function of the random variable $X$", which for clarity he/she needs to correct for. Commented May 30 at 12:29