I have a question about the last step of a proof on page 37 of All of Statistics. The entire proof is here for sake of completeness, but I don't think grokking it in its entirety is necessary for answering the question:
Suppose that $X \sim \text{Uniform}(0,1)$. After obtaining a value of $X$ we generate $Y \mid X = x \sim \text{Uniform}(x,1)$. What is the marginal distribution of $Y$? First note that,
$$ f_X(x) = \begin{cases} 1 & \text{if } 0 \le x \le 1 \\ 0 & \text{otherwise} \end{cases} $$
and
$$ f_{Y \mid X}(y \mid x) = \begin{cases} \frac{1}{1-x} & \text{if } 0 < x < y < 1 \\ 0 & \text{otherwise} \end{cases} $$
So,
$$ f_{X,Y}(x,y) = f_{Y \mid X} (y \mid x) f_X(x) = \begin{cases} \frac{1}{1-x} & \text{if } 0 < x < y < 1 \\ 0 & \text{otherwise} \end{cases} $$
The marginal for $Y$ is
$$ f_Y(y) = \int_0^y f_{X,Y}(x,y) dx = \int_0^y \frac{dx}{1 -x} = - \int_1^{1-y} \frac{du}{u} = - \log (1-y) $$
for $0 < y < 1$.
Question: Why -- on the very last step -- do we integrate from $0$ to $y$? It makes sense to me that we would integrate from $0$ to $\infty$, or perhaps $0$ to $1$ (since there isn't anything beyond that to integrate). But why $0$ to $y$? Does іntegrating on $\int_0^\infty$, $\int_0^1$, and $\int_0^y$ yield the same answer?
The marginal distribution is indeed given by $$ f_Y(y)=\int_{-\infty}^{\infty}f_{X,Y}(x,y)\;dx $$ and since $f_{X,Y}(x,y)=\frac{1}{1-x}$ if $0<x<y<1$ and $f_{X,Y}(x,y)=0$ otherwise, it follows that if $0<y<1$ then $$ \int_{-\infty}^{\infty}f_{X,Y}(x,y)\;dx=\int_0^y\frac{1}{1-x}\;dx $$ since we must have $0<x<y$.