# Finding the probability density function of a random variable in two dimensions

Let $$(X,Y)$$ be a point chosen at random from the triangle $$\{x,y:0\leq x\leq y\leq 1\}$$. $$f_{X,Y}(x,y)=2$$ if $$(x,y)$$ is in the triangle, and it is 0 otherwise. Find the probability density function for $$X$$.

What confuses me about this problem is understanding how $$x$$ and $$y$$ make up the triangle. If I'm understanding this correctly, then the biggest triangle we can make has vertices $$(0,1),(1,1),$$ and $$(0,0)$$. If this is the case then the probability should be 1. As $$x$$ increases, $$y$$ can at least be $$x$$ which means that $$y$$ is dependent on $$x$$. From this though I'm not sure where to go from here.

• Note the marginal density property $f_X(x)=\frac{f_{X,Y}(x,y)}{f_Y(y\mid X=x)}$. You may find this helpful. – TheSimpliFire Apr 16 at 19:35

If I'm understanding this correctly, then the biggest triangle we can make has vertices $$(0,1),(1,1),$$ and $$(0,0)$$.

You're right, that's the support of your random (multivariate) variable.

If this is the case then the probability should be 1.

Huh... what? What you know is that "total" probability is $$1$$, i.e. $$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f_{X,Y}(x,y) dx dy=1$$. Now, because the density here is constant, denoting by $$S$$ the support region and by $$A_S$$ its area we get $$\int_{S} 2 dx dy= 2 \, A_S= 1$$ and this is indeed true, because the area of the triange is $$\frac12$$. Then, it's all right.

As $$x$$ increases, $$y$$ can at least be $$x$$ which means that $$y$$ is dependent on $$x$$.

Yes. In fact, if you have a bounded support that it's not a rectangle, (or a cartesian product of rectangles) then the variables are dependent.

You have the joint density $$f_{X,Y}$$. To get the single variable ("marginal") density, you sum (integrate) over the other variable ("marginalize") :

$$f_X(x)=\int f_{X,Y}(x,y) dy$$

Because the density is constant, and the support is known, what remains is just to get the integrations limits right, i.e. which is the range for the integrating variable ($$y$$) for each fixed $$x$$. Can you go on from here?

• I gave this a bit more thought. Would we be doing a double integral over the triangle? The first from 0 to $x$ then the second from $x$ to $y$? – Peetrius Apr 17 at 19:15
• No, the double integral is what gives 1. To marginalize you need only to integrate with respect to $y$, as I explained. – leonbloy Apr 17 at 19:17
• So is $f_{X,Y}(x,y)$ simply $(1-x)$ which means I take $\int_0^1(-x+1)dy$ to find $f_X(x)$? Sorry, this feels far beyond my skills in probability. I'm going to offer a bounty on this problem. – Peetrius Apr 19 at 0:14
• Using the last formula $$f_X(x)=\int_x^1 2dy = 2(1-x).$$ – d.k.o. Apr 19 at 0:28
• NB: You should always include the support.$$f_X(x)= 2(1-x)~\mathbf 1_{0\leqslant x\leqslant 1}$$ – Graham Kemp Apr 19 at 2:05