Integrating Indicator Function (statistics problem) I have the following problem. Find the marginal denstity of $Y$ given that:
$$
f_{Y\mid X=x} \sim U[x,x+1]
$$
and $X \sim U[0,1]$.
My approach was to use the conditional density definition to find the joint distribution;
$$
f_{Y\mid X=x}\cdot f_X = f_{X,Y} = 1\cdot 1 = 1, X<Y<X+1
$$
Hence to find the marginal of Y, I would have to integrate:
$\int 1\cdot[x<y<x+1] \, dx$
However, I am having trouble with the limits of integration here and the indicator function.
EDIT/update:
Now I have to determine the distribution of X+Y jointly with X. I am once again having trouble with limits of integration and this joint function between X and Y which is an indicator one. Could you give any hints? My approach is to divide the area if integration into cases and calculate the respective areas taking into consideration the level curves of X+Y; I was wondering if there would be a smarter approach.
 A: Draw the region that satisfies the conditions $$0 \le x \le 1, \quad x \le y \le x+1.$$  This is a parallelogram with vertices $(0,0), (1,1), (1,2), (0,1)$.  Now, it should be clear that there are two cases:  $0 \le y \le 1$, and $1 < y \le 2$.  If $y$ cuts across the lower half of the parallelogram, then the integral is simply the length of the interval from $x = 0$ to $x = y$.  If $y$ cuts across the upper half of the parallelogram, then the integral is the length of the interval from $x = y-1$ to $x = 1$.  So the marginal density of $Y$ is given by the piecewise function $$f_Y(y) = \begin{cases} y, & 0 \le y \le 1, \\ 2-y, & 1 < y \le 2. \end{cases}$$
A: I'd have written $Y\mid X=x \sim U(x,x+1)$ (with no "$f$").
Notice that $(Y-x)\mid (X=x) \sim U(0,1)$.
Hence $(Y-X) \mid (X=x) \sim U(0,1)$.
The expression "$U(0,1)$" has no "$x$" in it.  So the conditional distribution of $Y-X$, given $X$, does not depend on the value of $X$!  From that, two things follow:


*

*The marginal (or "unconditional") distribution of $Y-X$ is that same distribution, i.e. it is the distribution of $Y-X$ given $X=x$.

*The random variable $Y-X$ is actually independent of $X$.


That means $Y$ is the sum of two independent random variables ($U=X$ and $V=Y-X$) each of which is uniformly distributed on the interval $(0,1)$.  The pair $(U,V)$ is then uniformly distributed in the square $(0,1)^2$, and you want the distribution of their sum $Y=U+V$.
Thinking about the level sets of $U+V$ in the square tells you what the density function of that random variable looks like.
