# the derivation of E(X|X)

My intuition told me E(X|X) is X. However,I get stuck when when I try to evaluate it from the definition. How do I define f(X|X) ? would it be constant? Thanks for your help.

• What is your definition of $E[X\mid Y]$, the conditional expectation of $X$ given $Y$? – Dilip Sarwate Jan 20 '17 at 22:04

Your intuition is correct: if $X$ is any random variable with finite mean (not necessarily discrete or continuous!), then $E[X \mid X] = X$.
More generally, if $\mathcal{G}$ is a $\sigma$-field, then $E[X\mid\mathcal{G}] = X$ (almost surely) whenever $X$ is a $\mathcal{G}$-measurable random variable with finite mean. This can be proved from the definition of $E[X \mid \mathcal{G}]$ as the unique (up to almost everywhere equivalence) $\mathcal{G}$-measurable random variable $Y$ such that $E[X \mathbf{1}_A] = E[Y \mathbf{1}_A]$ for every $A \in \mathcal{G}$. To see why, note that if $X$ itself is $\mathcal{G}$-measurable, then certainly $E[X \mathbf{1}_A] = E[X \mathbf{1}_A]$ for all $A \in \mathcal{G}$.
The special case $E[X \mid X]$ is just $E[X \mid \mathcal{G}]$, where $\mathcal{G}$ is the $\sigma$-field generated by $X$, in which case $X$ is necessarily $\mathcal{G}$-measurable and hence $E[X \mid X] = X$ (almost surely).
• I think the OP is trying to fit $f_{X\mid Y}(x\mid y) = \displaystyle\frac{f_{X,Y}(x,y)}{f_Y(y)}$ to the case when $Y$ is the same as $X$, and then wanting to determine $E[X\mid X]$ from the conditional density $f_{X\mid X}$. – Dilip Sarwate Jan 20 '17 at 22:11
• @zqzwxec11 The point of my answer is that you don't need to consider densities or probability mass functions to conclude that $E[X \mid X] = X$. The formula holds for all random variables with finite mean, even random variables that are neither discrete nor continuous. – Artem Mavrin Jan 22 '17 at 2:03