# Marginal Densities

I just have a few questions about joint density and marginal density questions.

Q1: Joint Distribution $f_1=2x+4y$ on triangle with vertices $(0,0), (0,1),(1,0)$. Sketch the region and compute marginal density of $X$. Use this to compute the expected value of $X$. Find the conditional density of Y given X. If X is .5, what is the expected value of $Y$. Lastly, the total is $Z=X+Y$. Find the density of Z.

The region is clearly just the triangle with those vertices. The marginal density is the integral of $f_1$ from $(0)$ to $(1-x)$ $dy$. The expected value is simply integral from 0 to 1 of $xf_{1x}(X)=\frac{1}{3}$.
The conditional density is simply the joint density divided by the marginal density of $X$. This I found to be $$\frac{2x+4y}{2-2x}=\frac{x+2y}{1-x}$$ Therefore $E(Y|X=.5)=\int^{.5}_0 yf_{y|x}=\frac{7}{24}$

Lastly, the cumulative distribution function of $X+Y$ I determined as $$\int_0^z\int^{z-x}_0f(x,y)dydx=\int_0^z\int^{z-x}_0(2x+4y)dydx=\int_0^z((2xy+2y^2))|^{z-x}_0=\int_0^z2x(z-x)+2(z-x)^2$$ $$=\int_0^z2xz-2x^2+z^2-2zx+x^2=\int_0^z-x^2+z^2=(\frac{-x}{3}+xz^2)|^z_0=\frac{-z^3}{3}+z^3$$.

Therefore the density is simply the derivative of this, which I found to be $-z^2+3z^2$

Q2: $X$ is the percentage spent on total budget. $Y$ is spend on books. Joint Distribution is $f_2=8xy$ for $0\le x\le 1$ and $0\le y \le x$. Find the marginal densities and sketch both. then find their expected values. Find the conditional density of $f{Y|X}$ and evaluate the $E(Y|X=.6)$. Let $Z=Y/X$. Find the PDF or CDF of $Z$ and find the expected value of $Z$.

Marginal Density of $X$:$\int^x_0 8xydy=4x^3$
Marginal Density of $Y$:$\int^1_y 8xydx=4y-4y^3$
$E(X)=\int^1_0xf_xdx=\int^1_04x^4dx=\frac{4}{5}$
$E(Y)=\int^1_0yf_ydy=\int^1_04y^2-4y^4=\frac{8}{15}$

The conditional density of $f{Y|X}=\frac{8xy}{4x^3}=\frac{4y}{x^2}$
$E(Y|X=.6)=\int^.6_0 y(\frac{4y}{.6^2})=\frac{4}{5}$

Lastly, $$\int^1_0\int^{zx}_08xydydx=\int^1_04xy^2|^{zx}_0=\int^1_04z^2x^3=z^2x^4|^1_0=z^2$$

Thus by taking the derivative the density of $z$ is $2z$.

$E(Z)=\int^1_0 z*2z=\frac{2}{3}$

It looks like you have already worked out parts of it but I'll include all the working anyway.

Q1.

(a) Find $f_X(x)$:

\begin{eqnarray*} f_X(x) &=& \int_0^{1-x} (2x+4y)\;dy \\ &=& \left[ 2xy+2y^2\right]_0^{1-x} \\ &=& 2x(1-x)+2(1-x)^2 \\ &=& 2-2x. \end{eqnarray*}

(b) Find $E(X)$:

\begin{eqnarray*} E(x) &=& \int_0^{1} xf_X(x)\;dy \\ &=& \int_0^{1} (2x-2x^2)\;dy \\ &=& \left[ x^2-\dfrac{2}{3}x^3 \right]_0^{1} \\ &=& 1-\dfrac{2}{3} \\ &=& \dfrac{1}{3}. \end{eqnarray*}

(c) Find $f_{Y|X}(y|x)$:

\begin{eqnarray*} f_{Y|X}(y|x) &=& \dfrac{f_{X,Y}(x,y)}{f_X(x)} \\ &=& \dfrac{2x+4y}{2-2x} \\ &=& \dfrac{x+2y}{1-x} \qquad\qquad\text{for $0\leq x,\quad 0\leq y,\quad x+y\leq 1$.} \end{eqnarray*}

(d) Find $E(Y\mid X=0.5)$:

\begin{eqnarray*} E(Y\mid X=0.5) &=& \int_0^{0.5} yf_{Y|X}(y|0.5)\;dy \qquad\qquad\text{(upper limit $=1-x=1-0.5=0.5$)} \\ &=& \int_0^{0.5} \dfrac{y/2+2y^2}{1-1/2}\;dy \\ &=& \int_0^{0.5} (y+4y^2)\;dy \\ &=& \left[ \dfrac{1}{2}y^2+\dfrac{4}{3}y^3 \right]_0^{0.5} \\ &=& \dfrac{1}{8} + \dfrac{1}{6} \\ &=& \dfrac{7}{24}. \end{eqnarray*}

(e) Find $f_Z(z)$ where $Z=X+Y$. Note that this involves a single integral, not a double integral.

\begin{eqnarray*} f_Z(z) &=& \int_0^{z} f_{X,Y}(x,z-x)\;dx \\ && \qquad\text{(upper limit $z$ is the largest possible $X$ given that $X+Y=z$)} \\ &=& \int_0^{z} (2x+4(z-x))\;dx \\ &=& \int_0^{z} (4z-2x)\;dx \\ &=& \left[ 4zx-x^2 \right]_0^{z} \\ &=& 3z^2. \end{eqnarray*}

Q2. Finding $f_X, f_Y, E(X), E(Y)$ can be done the same way as in Q1.

(a) Find $f_Z$. I'll use the "change of variable" method.

We have $Z=Y/X$. Also let $W=X$. Then $Y=WZ$ and $X=W$. Therefore our Jacobian is:

$$J=\begin{vmatrix} \dfrac{\partial x}{\partial z} & \dfrac{\partial y}{\partial z} \\ \dfrac{\partial x}{\partial w} & \dfrac{\partial y}{\partial w} \\ \end{vmatrix} =\begin{vmatrix} 0 & w \\ 1 & z \\ \end{vmatrix} = -w.$$

Therefore,

\begin{eqnarray*} f_{Z,W}(z,w) &=& f_{X,Y}(x(z,w),\;y(z,w))\;|J| \\ &=& 8zw^3 \qquad\text{for $0\lt z \lt 1\;$ and $\;0\lt w \lt 1$}. \\ \end{eqnarray*}

Now,

\begin{eqnarray*} f_{Z}(z) &=& \int_{w=0}^{1} f_{Z,W}(z,w)\;dw \\ &=& \int_{w=0}^{1} 8zw^3 \;dw \\ &=& \left[ 2zw^4 \right]_{w=0}^{1} \\ &=& 2z. \end{eqnarray*}

(b) Find $E(Z)$:

\begin{eqnarray*} E(Z) &=& \int_{0}^{1} zf_Z(z)\;dz \\ &=& \int_{0}^{1} 2z^2 \;dz \\ &=& \left[ \dfrac{2}{3}z^3 \right]_{0}^{1} \\ &=& 2/3. \end{eqnarray*}

• okay. Due to the fact that I got completely different answers for the densities, see the updated question. Could you explain where I am wrong, like process and how you are correct? May 8, 2015 at 17:37
• @JackArmstrong Hi Jack. Q1, CDF for Z: $\int_0^z 2xz-2x^2+z^2-2xz+x^2$ is wrong. Looks like simple expansion error. The work up to there is OK. I think we agree on the rest in Q1. In Q2, I took $Z=X/Y$ instead of $Y/X$. My mistake, I'll make a correction. May 8, 2015 at 18:03
• @JackArmstrong I've fixed my Q2 answer. It matches your result now. :-) May 8, 2015 at 18:17