# How is $E[c(X)|X] = c(X)$ derived?

I understand that this is a property of conditional expectation, but I am not too clear on how it is derived.

• Let $X$ take value $x$. The mathematical expectation is by definition: $\mathbb{E}[c(X)|X=x] = \sum_y c(y) P(X=y|X=x)$. $P(X=y|X=x)$ is 1 if $x=y$ and zero otherwise. And this is valid for all possible values of $X$. – Vadim Dec 10 '19 at 10:53
• Well, that is as simple as "what is mean of $c(X)$ when $X=x$?" the answer is $c(x)$ (small letter $x$ here) – TPArrow Dec 10 '19 at 11:49
• – StubbornAtom Dec 10 '19 at 17:44

I will complement the technical answer with an intuitive one. $$E[c(X)|X]$$ means expected value of $$c(X)$$ (a function of a random variable $$X$$) given $$X$$ (that is, given a particular value of $$X$$ has been observed). Since $$X$$ has been observed, so has $$c(X)$$, and its expected value is just its observed value. Therefore, $$E[c(X)|X]=c(X)$$

To understand the "derivation" of this rule, you need to look at the formal definition of conditional expectation, which is actually defined directly by its integral equation (see similar answer here). The rule in your question is a trivial consequence of the definition. Given some measureable function $$c:\mathscr{X}\rightarrow \mathbb{R}$$, a valid conditional expectation $$g(X) \equiv \mathbb{E}(c(X)|X)$$ is any measureable function $$g:\mathscr{X}\rightarrow \mathbb{R}$$ that satisfies the equation:

$$\int \limits_\mathscr{X} g(x) \ dF_X(x) = \int \limits_\mathscr{X} c(x) \ dF_X(x).$$

Any measureable function $$g$$ that satisfies this equation is considered to be a valid conditional expectation. Clearly, the function $$g=c$$ satisfies this equation, so we can say that:

$$c(X) = g(X) = \mathbb{E}(c(X)|X).$$

This rule says that we can "take out what is known"; it is a trivial consequence of the underlying definition of conditional probability. (There may be other valid conditional expectations, but they will all be equivalent to this one, except on a set with probability zero. For this reason, we tend to think of $$c(X)$$ as "the" conditional expectation in this case. This is a reasonable shorthand for the more formally correct statement.)

• Doesn't it miss one condition: Measureable with respect to the $\sigma$-algebra generated by the condition, that is $\sigma(X)$? – kjetil b halvorsen Dec 10 '19 at 10:33
• While I might be mistaken, I think that's what it would mean for a function on $\mathscr{X}$ to be measureable (i.e., measureable with respect to the sigma-field on its own domain). In any case, these kinds of questions tend to be asked by people who are not familiar with measure theory, so I prefer to gloss over the measureability conditions a bit. – Ben - Reinstate Monica Dec 10 '19 at 11:06
• Well, but the natural $\sigma$-algebta on $\mathscr{X}$ and the (sub) $\sigma$-algebra generated by the random variable $X$ is not the same thing! I don't think it makes sense to avoid measurability in this case. – kjetil b halvorsen Dec 10 '19 at 11:30
• Kinda. In practice, the mere fact that the function $c$ is being used in the analysis means that it must be a measureable function (or the premise of the question is invalid). Since $g=c$ is a valid conditional expectation, the latter is therefore measureable by implication. – Ben - Reinstate Monica Dec 10 '19 at 22:51