I need help on the marginal densities. In particular, I know you just integrate the joint pdf f(x,y) from y=-infinity to +infinity, but in the context of the below question, I have trouble to define the bound (lower and upper limite of the integral), and I don't understand how do you define that.
Question:Let R be the triangle in the x-y plane with corners at (-1,0), (0,1) and (1,0), and let X, and Y have a joint density of 1.
compute marginal densities of X and Y.
My attemp: fX=integrate (1) dy from y=0 to y=1-abs(x) => fX=1-abs(x). But I don't know fY.
Draw a picture. We will use it to set up the integration. We could also treat the problem as a pure geometry problem. We do it in somewhat greater generality, so that you can deal with non-constant joint densities.
For $f_X(x)$, we want to "integrate out" $y$.
Let $-1\le x\lt 0$. Then $y$ goes from $0$ up to the line that joins $(-1,0)$ and $(0,1)$. That line has slope $1$ and goes through $(-1,0)$. So the line has equation $y=x+1$. Thus $y=0$ to $1+x$, so for $-1\le x\lt 0$ we have $$f_X(x)=\int_{y=0}^{1+x} 1\cdot dy.$$ This is $1+x$.
For $0\lt x\lt 1$, we go from $y=0$ to another line, this time $y=-x+1$. Thus in this interval, we have $$f_X(x)=\int_{y=0}^{-x+1}1\cdot dy=-x+1.$$ And for completeness note that $f_X(x)=0$ if $x\lt -1$ and if $x\gt 1$.
For the density function of $Y$ on the interval from $0$ to $1$, we "integrate out" $x$. So, looking at the picture, we see that $x$ travels from the line $y=x+1$, that is, $x=y-1$, to the line $y=-x+1$, that is, $x=1-y$. Thus in the interval $(0,1)$, we have $$f_Y(y)=\int_{x=y-1}^{1-y} 1\,dx.$$ Calculate. We get $f_Y(y)=2-2y$.