Random variable with infinite expectation but finite conditional expectation I've been very stuck on a question from Probability and Random Processes by Grimmett and Stirzaker for ages - so stuck that I flicked to the back to have a look at the answers. But, I can't seem to even understand the reasoning behind that!
The question is: Construct an example of two random variables X and Y for which $\mathbb{E}(Y)=\infty$ but $\mathbb{E}(Y|X)<\infty$.
The answer given is: Take Y to be a random variable with mean $\infty$, say $f_{Y}(y)=y^{-2}$ for $1 \leq y<\infty$, and let X=Y. Then $\mathbb{E}(Y|X)=X$ which is (almost surely) finite.
Firstly, how can a random variable have infinite mean? Secondly, I don't really understand the subtlety of letting X=Y and finally what's with the "(almost surely)"?
Thanks in advance for your help!
 A: *

*A random variable $Y$ has infinite mean if $\mathbb{E}[Y] = \infty$; in your case, this happens since
$$
  \int_1^{\infty} y f_Y(y) dy
= \int_1^\infty \frac{1}{y} dy
= \infty.
$$

*$X$ and $Y$ are just functions. As long as they are measurable (which you don't really need to worry about) you have valid random variables. I wouldn't call it sublte. Many other choices would have worked ($X = Y^3$ for instance). 
Here, once you "know" the value of $X$, you also "know" the value of $Y$, and it will always be finite. Each value of the function is finite, even though the integral above is infinite.

*Any statement that has "almost surely" at the end of it means that the set on which the claim is true has measure $1$. In this case, the reason we write "a.s." in
$$
  \mathbb{E}[Y \mid X] 
= Y \ \ \mbox{a.s.}
$$
is that conditional expectations are really choices of Radon-Nikodym derivatives (functions which satisfy 2 properties) and for some choices the equality holds everywhere, and for others it holds only "almost everywhere".
A: 
Take Y to be a random variable with mean ∞, say $f_Y(y)=\frac y2$ for $1≤y<∞$, and let $X=Y$. Then $(Y|X)=X$ which is (almost surely) finite.
Firstly, how can a random variable have infinite mean? 

Consider a positive variable with a density $f$. An infinite mean means that
$$
\int x f(x)dx = \infty
$$ 
In your example:
$$
\int x f(x)dx = \int_1^\infty \frac x{x^2}dx =  \int_1^\infty \frac {dx}{x}=
\infty
$$ 

Secondly, I don't really understand the subtlety of letting $X=Y$ and finally what's with the "almost surely"?

You have $$
(Y|X)=X\\
\Bbb P((Y|X) <\infty) = \Bbb P(X <\infty) 
=\int_1^\infty \frac {dx}x = 1
$$
So $(Y|X) <\infty$ a.s.
A: The "amost surely" is not necessary, $X$ is never infinite on the given domain. A random variable can have finite distribution but infinite mean if $\int f_Y(y) dy$ is a convergent integral but $\int y f_Y(y)$ is divergent. This is the case for example with $f_Y(y) = 1/y^2$, because $\int_1^\infty 1/y^2 dy$ is a convergent integral but $\int_1^\infty y(1/y^2) dy = \int_1^\infty 1/y$ is a divergent integral (equal to $\infty$). Finally, if you condition the expectation of a variable on itself then you just get the variable back, and in this case the variable is always finite which is why the example works.
