For a uniform probability density function (PDF) of two random variables $X$ and $Y$, the PDF exists only in the square of length $\sqrt{2}$, whose vertices are $(1,0)$, $(0,1)$, $(-1,0)$ and $(0,-1)$ (please see attached image below, where I also defined the equations of the lines).
Now, we know that the area of this square is $2$, and its PDF is $$f_{X,Y}(x,y)=\frac{1}{2}$$
Now, if I want to find the marginal PDF of $X$, for example, I want to sum the joint PDF over all values $Y$ can take. But I don't know what the limits of integration will be. Do I just sum from -1 to 1 for $y$?
Best Answer
In cases like this it is often handsome to go for finding the CDF of $X$.
Observe that for $x\in[-1,0]$ we have: $$F_X(x)=P(X\leq x)=\frac12(1+x)^2$$
This expression corresponds with area of triangle with vertices $(-1,0)$,$(x,x)$ and $(x,-x)$ divided by $2$.
For $x\in[0,1]$ we find on a similar way that: $$F_X(x)=P(X\leq x)=1-\frac12(1-x)^2$$
To be complete we note that (of course) $F_X(x)=0$ for $x<-1$ and that $F_X(x)=1$ for $x>1$.
Now PDF $f_X(x)$ can be found by differentiating $F_X(x)$ leading to:$$f_X(x)=1-|x|\text{ if }|x|\leq1\text{ and }f_X(x)=0\text{ otherwise}$$