# Let X and Y have joint density given by f(x,y) = 6(1-y) for 0 ≤ x ≤ y ≤ 1. What is Cov(X,Y)?

Mar 16, 2016

Cov_(f_(X,Y)) [X, Y]=E_(f_(X,Y)) [XY ] − E_(f_(X))[X] E_(f_(Y))[Y]
Cov_(f_(X,Y)) [X, Y]=3/20− 1/4*1/2 = 1/40

#### Explanation:

Cov_(f_(X,Y))(X,Y)=σ_(XY)=E[(X−μ_X)(Y−μ_Y)]

Cov_(f_(X,Y)) [X, Y ] = E_(f_(X,Y)) [XY ] − E_(f_(X)) [X] E_(f_(Y)) [Y ]

So we want to calculate the the marginal pdfs, expectations and variances of X and Y for f(x,y) = 6(1-y) " for " 0 ≤ x ≤ y ≤ 1

====marginal pdf, mean and variance with respect to x=======

${f}_{X} \left(x\right) = \int {f}_{X , Y} \left(x , y\right) \mathrm{dy} = {\int}_{x}^{1} 6 \left(1 - y\right) \mathrm{dy} = 6 {\left(y - \frac{1}{2} {y}^{2}\right)}_{x}^{1}$

${f}_{X} \left(x\right) = 3 \left({x}^{2} - 2 x + 1\right)$

${E}_{{f}_{X}} \left[X\right] = \int x {f}_{X} \left(x\right) \mathrm{dx} = 3 {\int}_{0}^{1} \left({x}^{3} - 2 {x}^{2} + x\right) \mathrm{dx}$
${E}_{{f}_{X}} \left[X\right] = 3 {\left(\frac{1}{4} {x}^{4} - \frac{2}{3} {x}^{3} + \frac{1}{2} {x}^{2}\right)}_{0}^{1} = \frac{1}{4}$

${E}_{{f}_{X}} \left[{X}^{2}\right] = \int {x}^{2} {f}_{X} \left(x\right) \mathrm{dx} = 3 {\int}_{0}^{1} {x}^{2} \left({x}^{2} - 2 x + 1\right) \mathrm{dx}$

${E}_{{f}_{X}} \left[{X}^{2}\right] = 3 {\left({x}^{5} / 5 - \frac{2}{4} {x}^{4} + {x}^{3} / 3\right)}_{0}^{1} = \frac{1}{10}$

You really don't need the variance Var for this problem, but I am calculating it for you for future problems, so you see how it is done. Typically you would need the Var is the question had asked the Correlation...

$V a {r}_{{f}_{X}} = {E}_{{f}_{X}} \left[{X}^{2}\right] - {\left\{{E}_{{f}_{X}} \left[X\right]\right\}}^{2} = \frac{1}{10} - {\left\{\frac{1}{4}\right\}}^{2} = \frac{6}{160}$

====marginal pdf, mean and variance with respect to x=======

${f}_{Y} \left(y\right) = \int {f}_{X , Y} \left(x , y\right) \mathrm{dx} = {\int}_{0}^{y} 6 \left(1 - y\right) \mathrm{dx} = 6 {\left[\left(1 - y\right) x\right]}_{0}^{y}$

${f}_{Y} \left(y\right) = 6 \left(y - {y}^{2}\right)$

${E}_{{f}_{Y}} \left[Y\right] = \int y {f}_{y} \left(y\right) \mathrm{dx} = 6 {\int}_{0}^{1} \left({y}^{2} - {y}^{3}\right) \mathrm{dx} = {\left[2 {y}^{3} - \frac{3}{2} {y}^{4}\right]}_{0}^{1}$

${E}_{{f}_{Y}} \left[Y\right] = \frac{1}{2}$

${E}_{{f}_{Y}} \left[{Y}^{2}\right] = \int {y}^{2} {f}_{y} \left(y\right) \mathrm{dy} = 6 {\int}_{0}^{1} {y}^{2} \left(y - {y}^{2}\right) \mathrm{dy} = 6 {\left({y}^{4} / 4 - {y}^{5} / 5\right)}_{0}^{1}$

${E}_{{f}_{Y}} \left[{Y}^{2}\right] = 6 \left(\frac{1}{4} - \frac{1}{5}\right) = \frac{3}{10}$

$V a {r}_{{f}_{Y}} = {E}_{{f}_{Y}} \left[{Y}^{2}\right] - {\left\{{E}_{{f}_{Y}} \left[Y\right]\right\}}^{2} = \frac{3}{10} - {\left\{\frac{1}{2}\right\}}^{2} = \frac{1}{20}$

=============Finally Covariance=============

to compute the covariance we also need to compute
${E}_{{f}_{X , Y}} \left[X Y\right] = {\int}_{0}^{1} {\int}_{0}^{y} x y f \left(x , y\right) \mathrm{dx} \mathrm{dy}$
${E}_{{f}_{X , Y}} \left[X Y\right] = 6 {\int}_{0}^{1} {\int}_{0}^{y} \left\{x \mathrm{dx}\right\} y \left(1 - y\right) \mathrm{dy}$
${E}_{{f}_{X , Y}} \left[X Y\right] = 6 {\int}_{0}^{1} {\left[{x}^{2} / 2\right]}_{0}^{y} y \left(1 - y\right) \mathrm{dy}$

${E}_{{f}_{X , Y}} \left[X Y\right] = 3 {\int}_{0}^{1} \left({y}^{3} - {y}^{4}\right) \mathrm{dy} = 2 {\left({y}^{4} / 4 - {y}^{5} / 5\right)}_{0}^{1} = \frac{3}{20}$

Now finally we compute the $C o {v}_{{f}_{X , Y}} \left[X , Y\right]$:
Cov_(f_(X,Y)) [X, Y]=E_(f_(X,Y)) [XY ] − E_(f_(X))[X] E_(f_(Y))[Y]
Cov_(f_(X,Y)) [X, Y]=3/20− 1/4*1/2 = 1/40