Let $X$ and $Y$ be random variables (on some unspecified probability space $(\Omega, \mathcal{F}, \mathbb{P})$ ), assume they have a joint density $f_{X, Y}(x, y)$, and assume $\mathbb{E}|Y|<\infty$. In particular, for every Borel subset $C$ of $\mathbb{R}^2$, we have
$$
\mathbb{P}\{(X, Y) \in C\}=\int_C f_{X, Y}(x, y) d x d y .
$$
In elementary probability, one learns to compute $\mathbb{E}[Y \mid X=x]$, which is a nonrandom function of the dummy variable $x$, by the formula
$$
\mathbb{E}[Y \mid X=x]=\int_{-\infty}^{\infty} y f_{Y \mid X}(y \mid x) d y,
$$
where $f_{Y \mid X}(y \mid x)$ is the conditional density defined by
$$
f_{Y \mid X}(y \mid x)=\frac{f_{X, Y}(x, y)}{f_X(x)} .
$$
The denominator in this expression, $f_X(x)=\int_{-\infty}^{\infty} f_{X, Y}(x, \eta) d \eta$, is the marginal density of $X$, and we must assume it is strictly positive for every $x$. We introduce the symbol $g(x)$ for the function $\mathbb{E}[Y \mid X=x]$ defined by (2.6.1); i.e.,
$$
g(x)=\int_{-\infty}^{\infty} y f_{Y \mid X}(y \mid x) d y=\int_{-\infty}^{\infty} \frac{y f_{X, Y}(x, y)}{f_X(x)} d y .
$$
In measure-theoretic probability, conditional expectation is a random variable $\mathbb{E}[Y \mid X]$. This exercise is to show that when there is a joint density for $(X, Y)$, this random variable can be obtained by substituting the random variable $X$ in place of the dummy variable $x$ in the function $g(x)$. In other words, this exercise is to show that
$$
\mathbf{E}[Y \mid X]=g(X) .
$$
(We introduced the symbol $g(x)$ in order to avoid the mathematically confusing expression $E[Y \mid X=X]$.)