---
title: "C19-20 Multivariate Discrete Distributions"
author: "David Housman"
format: docx
editor: visual
---

## Introduction

Suppose $X$ and $Y$ are two discrete random variables with a joint probability distribution function

$$\begin{array}{l}
f(x,y) &=& P[X = x \wedge Y = y].
\end{array}$$

The marginal distributions are

$$\begin{array}{l}
f_X(x) &=& P[X = x] &=& \sum_y f(x,y) \\ 
f_Y(y) &=& P[Y = y] &=& \sum_x f(x,y)
\end{array}$$

which have means and variances

$$\begin{array}{l}
\mu_X &=& E[X] &=& \sum_x xf_X(x) & \sigma_X^2 &=& E[(X-\mu_X)^2] &=& \sum_x (x-\mu_X)^2f_X(x) \\ 
\mu_Y &=& E[Y] &=& \sum_y yf_Y(y) & \sigma_Y^2 &=& E[(Y-\mu_Y)^2] &=& \sum_y (y-\mu_Y)^2f_Y(y).
\end{array}$$

The conditional distributions are

$$\begin{array}{l}
f_{X|Y}(x|y) &=& P[X = x | Y = y] &=& f(x,y)/f_Y(y) \\ 
f_{Y|X}(y|x) &=& P[Y = y | X = x] &=& f(x,y)/f_X(x)
\end{array}$$

which have means and variances

$$\begin{array}{l}
\mu_{X|Y=y} &=& \sum_x xf_{X|Y}(x|y) & \sigma_{X|Y=y}^2 &=& \sum_x (x-\mu_{X|Y=y})^2f_{X|Y}(x|y) \\
\mu_{Y|X=x} &=& \sum_y yf_{Y|X}(y|x) & \sigma_{Y|X=x}^2 &=& \sum_y (y-\mu_{Y|X=x})^2f_{Y|X}(y|x).
\end{array}$$

The covariance is

$$\begin{array}{l}
\text{cov}(X,Y) &=& E[(X-\mu_X)(Y-\mu_Y)] &=& \sum_x\sum_y (x-\mu_x)(y-\mu_Y)f(x,y),
\end{array}$$

and the correlation coefficient is

$$\begin{array}{l}
\rho &=& E\left[\dfrac{X-\mu_X}{\sigma_X}\dfrac{Y-\mu_Y}{\sigma_Y}\right] 
&=& \displaystyle\sum_x\sum_y \dfrac{x-\mu_X}{\sigma_X}\dfrac{y-\mu_Y}{\sigma_Y}f(x,y) 
&=& \dfrac{\text{cov}(X,Y)}{\sigma_X\sigma_Y}.
\end{array}$$

The discrete random variables $X$ and $Y$ are independent if

$$\begin{array}{l}
f(x,y) &=& f_X(x)f_Y(y),
\end{array}$$

for all $x$ and $y$ (that is, the events $X = x$ and$Y = y$ are independent for all $x$ and $y$).

## Exercises

1.  An urn contains ten balls marked with numbers: two are marked with a 0 and eight are marked with a 1. Draw, with replacement, two balls from the urn. Let $X$ be the maximum of the numbers drawn, and let $Y$ be the sum of the two numbers. Find the joint and marginal probability distribution functions. Calculate the means, variances, standard deviations, covariance, and correlation coefficient. Determine whether $X$ and $Y$ are independent. Find the conditional distributions and their means and variances.

2.  Prove: If $X$ and $Y$ are independent random variables, then $\text{cov}(X,Y) = 0$.

3.  Let $X$ and $Y$ be discrete random variables with joint probability distribution function $f$, and let $a$ and $b$ be real numbers. We have previously shown that $\sigma_X^2 = E[X^2] - \mu_X^2$. Find similar formulas for $\text{cov}(X,Y)$, $\mu_{aX+bY}$, $\sigma_{aX+bY}^2$, $\mu_{XY}$, and $\sigma_{XY}^2$.

4.  Two sides of a rectangle were measured to be 20.0 ± 0.1 cm and 30.0 ± 0.3 cm. Find the perimeter and area of the rectangle including the possible errors in the answers.
