# Let the random point (X, Y ) be uniformly distributed on the triangle

Let the random point (X, Y ) be uniformly distributed on the triangle $D=\{(x,y):0\leq x\leq y\leq 1\}$ Find the marginal densities of X and Y and plot their graphs.

-

The joint density function is $2$ in the triangle, and $0$ elsewhere, since the triangle has area $1/2$.
We find the cumulative distribution function $F_Y(y)$ of $Y$. It is not interesting except when $0\le y \le 1$. So suppose that $0\le y\le 1$, and find $P(Y \le y)$. This is the integral of the joint density function over a certain region $R_y$. But we do not need to do much work to evaluate the double integral. But we do need to draw a picture.
The region $R_y$ is an isosceles right triangle whose two legs are equal to $y$. So the area is $y^2/2$, and therefore $F_Y(y)=(2)(1/2)(y^2)=y^2$. It follows by differentiating that the density function $f_Y(y)$ is equal to $2y$ for $0\le y \le 1$. (The density function is $0$ elsewhere.)
For the random variable $X$, the calculation is similar but a little more complicated. The part of the triangle on which $X \le x$ is a trapezoid. Just find its area, multiply by $2$, and differentiate. Alternately, first find $P(X \ge x)$. The geometry is a bit easier.