I get wrong answer for distribution of $y$ everytime

We have a triangle: $A(0,0)$, $B(3,1)$ and $C(1,2)$.

The joint probability density function is given by:

$$p_{X,Y}(x,y) = k\cdot x \, \text{if (x,y) in triangle, otherwise it is zero}$$ I tried to get the distribution for $Y$. I know that I need to get it's probability density function first.

So for lines between the points I got the following equations:

$$y = \frac{5}{2}-\frac{1}{2}x$$
$$y = \frac{1}{3}x$$ $$y = 2x$$

If I reverse them I don't know in which order to apply them in bounds of the integral to find the density function. I know that there are two densities, one for $y\in (0,1) $ and one for $y \in (1,2)$. But I just can't seem to get it right. Is there a systematical way to do this?


Solution 1:

You ask for a systematic way to find bounds. Sketching helps.

enter image description here

Now do you see that for $ \displaystyle y \in (0, 1), $ $x$ is bound between lines $x = \frac y 2$ and $x = 3y$?

Also for $ \displaystyle y \in (1, 2)$, $x$ is bound between $\frac y2$ and $(5 - 2y)$.