Detailed properties of conditional expectation I have two questions regarding properties of conditional expectation given on Wikipedia website https://en.wikipedia.org/wiki/Conditional_expectation. I suppose that these properties are not precise, i.e.

*

*One property states that: If $Z$ is a random variable, then ${\displaystyle \operatorname {E} (f(Z)\mid Z)=f(Z)}$.

My question is: Is it true for any $f$ function? Or do we need some additional assumptions on this function?


*Another property states that: If $X$ is $\displaystyle{\mathcal {H}}$-measurable, then ${\displaystyle E(XY\mid {\mathcal {H}})=X\,E(Y\mid {\mathcal {H}})}.$
In many sources I found additional assumption that $X$ is bounded random variable or that $E[XY]<\infty$.
I would be grateful for clarifying me these issues.
 A: Proof of 1.
By the definition, for every $B\in \sigma(Z)$, we have that
$$E[f(Z)|Z]1_B=f(Z)1_B.$$
In particular, for every $z$ in the image of $Z$ we can take $B=Z^{-1}(z) \in \sigma(Z)$. Then, for every $\omega \in B$, $E[f(Z)|Z](\omega)=f(z)$.
That is, $E(f(Z)|Z)=f(Z)$.
Proof of 2.:
See that for every $H \in \mathcal{H}$ we have
$$E[XY|\mathcal{H}]1_H=XY1_H.$$
Moreover, $E[Y|\mathcal{H}]1_H=Y1_H.$ Using it in the previous expression we have
$$E[XY|\mathcal{H}]1_H=XE[Y|\mathcal{H}]1_H.$$
As $X$ is $\mathcal{H}$-measurable, $X^{-1}(x) \in \mathcal{H}$ for every $x$ in the image of $X$. Take $\omega \in X^{-1}(x)$ and $H=X^{-1}(x)$, then
$$E[XY|\mathcal{H}](\omega)=xE[Y|\mathcal{H}](\omega).$$
Edit: In both proofs I assumed that those conditional expectations are well defined.
In fact, by the Doob–Dynkin lemma, $E[f(Z)|Z]$ is well defined iff $f$ is a Borel measurable function.
And for the second proof we need that $E[|XY||\mathcal{H}]<\infty$ and $E[|XY||\mathcal{H}]<\infty$. Usually it asks for $E[|XY|]<\infty$ and $E[|Y|]<\infty$, which implies the former hypothesis.
This link has a nice proof of existence.
