# Marginal Density - Probability

(X,Y) is a two-dimensional abolute continuous random vector with the density function fx,y given by:

(1) $f_{X,Y}(x,y) = \begin{cases} \frac{1}{2} & 0 \le x \le 1, 0 \le y \le 4x \\ 0 & \text{otherwise} \\ \end{cases}$

Show the density functions fx and fy for X and Y are:

$f_{X}(x) = \begin{cases} 2x & 0 \le x \le 1\\ 0 & \text{otherwise} \\ \end{cases}$

$f_{Y}(y) = \begin{cases} \frac{1}{2}(1-\frac{y}{4}) & 0 \le y \le 4\\ 0 & \text{otherwise} \\ \end{cases}$

I'm having a hard time figuring out how this works, i have been looking for a while for some similar problems without any luck. I can make the step with $$f_{X}(x) =\int_{0}^{4x} {\frac{1}{2} dy} = 2x$$ But $f_{Y}$ i can't figure out and makes me wonder if the first one is done correctly.

Another example i can't solve is:

(2) $f_{X,Y}(x,y) = \begin{cases} \frac{3}{4}x & 0 \le x \le y \le 2\\ 0 & \text{otherwise} \\ \end{cases}$

$f_{X}(x) = \begin{cases} \frac{3}{4}x(2-x) & 0 \le x \le 2\\ 0 & \text{otherwise} \\ \end{cases}$

$f_{Y}(y) = \begin{cases} \frac{3}{8}y^2 & 0 \le y \le 2\\ 0 & \text{otherwise} \\ \end{cases}$

From what i gathered i should be able to solve it with $\int{f_{X,Y}(x,y)dx}$, but can't seem to do it right. Any help is appreciated.

-

We will use the geometry. Where does our density function live? Since $x$ ranges from $0$ to $1$, it follows that $y$ ranges from $0$ to $4$. But we always have $y\le 4x$.

Draw the rectangle with corners $(0,0)$, $(1,0)$, $(1.4)$ and $(4,0)$, The joint density lives in the part of the rectangle below the line $y=4x$. Draw that line. So our joint density function lives on or in the triangle with corners $(0,0)$, $(1,0)$, and $(4,1)$.

To find the density function of $Y$, we must "integrate out" $x$. We are integrating "horizontally." Note that $x$ starts at $x=\frac{y}{4}$. This is because our triangle starts at $y=4x$. Note also that the triangle ends at $x=1$. So we want $$\int_{x=y/4}^1\frac{1}{2}\,dx.$$ The integration is exceptionally easy!

The same technique ("integrate out $y$") will give you $f_X(x)$.

Remark: The problem you mention at the end yields to basically the same technique. Draw a picture. When we integrate out $y$ (or $x$) the picture will give you the limits of integration.

-

What you did for $f_{X}$ is OK ! For $f_{Y}$, if you just write $f_{Y}(y) = \int_{0}^{1} \frac{1}{2} \: dx$, you're missing that the condition on $y$ (which is $0 \leq y \leq 4x$) also depends on $x$.

To do this right, use indicator functions. $f_{(X,Y)}$ can be re-written as follows :

$$f_{(X,Y)}(x,y) = \frac{1}{2} \textbf{1}_{\lbrace 0 \leq x \leq 1 \, ; \, 0 \leq y \leq 4x \rbrace}$$

Which also writes :

$$f_{(X,Y)}(x,y) = \frac{1}{2} \textbf{1}_{\lbrace 0 \leq x \leq 1 \, ; \, 0 \leq \frac{y}{4} \leq x \rbrace}$$

So, we have :

$$f_{(X,Y)}(x,y) = \frac{1}{2} \textbf{1}_{\lbrace \frac{y}{4} \leq x \leq 1 \rbrace}$$

Now, let's use our favourite formula : $f_{Y}(y) = \int f_{(X,Y)}(x,y) \: dx$. It leads to the expected result :

$$f_{Y}(y) = \begin{cases} \frac{1}{2} \left( 1 - \frac{y}{4} \right) & \text{if } 0 \leq y \leq 4 \\ 0 & \text{otherwise} \\ \end{cases}$$

-

The example you worked out for $f_X(x)$ is correct, and shows the general strategy for these kinds of computations. To compute $f_X(x)$, you fix the value $x$ and then marginalize'' the integral $\int f_{X,Y}(x,y)$ by writing the integral of $f_{X,Y}$ over the region of $y$ you get (in terms of $x$) when you fix $x$. Similarly vice-versa for computing $f_Y(y)$. The tricky part sometimes is figuring out what the region of integration for $y$ should be when you fix $x$, or vice-versa. For example, to get the $f_Y(y)$ in your first example, you use the given inequalities to figure out that the region of integration for $x$ is $y/4 \leq x \leq 1$. So you have

$$f_Y(y) = \int_{y/4}^1 1/2 dx = (1 - y/4)/2$$

in the valid range for $y$ (between $0$ and $4$) and the density is 0 elsewhere.

-