Question about sigma-algebra generated by a random variable I saw this example in Richard Durrett's book:

Example 5.1.4. To continue making connection with definitions of
  conditional expectation from undergraduate probability, suppose $X$
  and $Y$ have joint density $f (x, y)$, i.e., 
  $$ P ((X, Y ) ∈ B) = \int_B f (x, y) \, dx \, dy $$
  for $B ∈ R^2$ and suppose for simplicity
  that $f (x, y) \, dx > 0$ for all y. We claim that in this case, if
  $E|g(X)| < \infty$ then $E(g(X)\mid Y ) = h(Y )$, where 
  $$ h(y) = \left. \int g(x)f (x, y) \, dx \right/ \int f (x, y) \, dx. $$

My question is, why we have $h(Y) \in \sigma(Y)$.  The book states it as something trivial, but I failed to see why this is true.
 A: Because it's a function of $Y$.
$$
\{\omega : h(Y(\omega)) \in A\} = \{ \omega : Y(\omega) \in\text{something measurable} \}.
$$
(This assumes $h$ is measurable.  We know $Y$ is measurable since it's a random variable.)
That does it.
We have
$$
\text{something} = \{ y\in \mathbb R : h(y)\in A \}.
$$
Later addendum: From comments, my impression of what the question is about is evolving . . . . .
So let's see: What does the measure-theoretic definition of $\mathbb E(W\mid Y)$ say, when $W$ and $Y$ are random variables?
The conditional expectation should be a $\sigma(Y)$-measurable random variable $V$ such that for every $\sigma(Y)$-measurable set $B$,
$$
\int_B W\,dP = \int_B V\,dP.
$$
(The r.v. $W$ itself is not generally $\sigma(Y)$-measurable; otherwise there'd be no point in having such a definition.)  So a question is: How do we know such a random variable exists, and that there is essentially only one (i.e. only one up to equalitiy-almost-everywhere)?  The answer is that that follows from the Radon–Nikodym theorem, thus: Observe that
$$
Q(B) = \int_B W\,dP \tag{1}
$$
is a measure on $\sigma(Y)$ that is absolutely continuous with respect to the restriction of the measure $P$ to $\sigma(Y)$.  So there is a Radon–Nikodym derivative $V=dQ/dP$, i.e. a $\sigma(Y)$-measurable function $V$ such that for all $B\in\sigma(Y)$,
$$
Q(B) = \int_B V \, dP.
$$
(The equality $(1)$ looks as if it's saying $W$ is the desired Radon–Nikodym derivative, but again, that doesn't work since $W$ is not generally $\sigma(Y)$-measurable; otherwise there'd be no point in doing this.)
So the answer is that this comes from the Radon–Nikodym theorem.
Later still . . . .  The other $\sigma$-algebras, besides those of the form $\sigma(Y)$ for some random variable $Y$, that I've seen this done with are tail $\sigma$-algebras.  For a sequence $X_1,X_2,X_3,\ldots$ of random variables, a tail event is any event whose occurrence or non-occurrence is determined by the whole sequence $X_1,X_2,X_3,\ldots$ but whose occurrence or non-occurrence is unchanged by altering the values of any finite set of terms in that sequence.  An example is the even that $\lim_{n\to\infty}X_n>1/2$.  The tail $\sigma$-algebra is the set of all tail events.
