# How do I find the variance of a jointly distributed random variable?

Suppose a random variable J is joint distributed between X and Y. Then,

$$E(J) = \int_{-\infty}^\infty \int_{-\infty}^\infty f(x, y) dxdy$$

However, how do I calculate the variance of $J$? Had $J$ been a non-jointly distributed random variable, then we can use $Var(J) = E(J^2) - E(J)^2$. However, what is $E(J^2)$ in this case?

By the law of the unconscious statistician, $E(J^2) = \int_{-\infty}^\infty \int_{-\infty}^\infty j^2 f(x, y) dxdy$.

What should I supply for $j^2$ though? $x^2$ or $y^2$?

-
Presumably $f(x,y)$ is the joint density function. Then our double integral is $1$. For the expectation of $J$, we need to know something about $J$. Maybe $J=g(X,Y)$? Then we can find the mean and variance of $J$. – André Nicolas Nov 4 '12 at 4:52
Thanks! $f(x, y)$ is indeed the joint density function. What is $g(x, y)$ though? How does that differ from the joint density function? What if $X$ and $Y$ are independent? – David Faux Nov 4 '12 at 4:54
You presumably want to find the variance of some random variable. I assumed that you were calling that random variable $J$. If we know $J$ as a function of $X$ and $Y$, we can do the calculation. So to be specific, what do you want to find the variance of? It has to be a random variable. – André Nicolas Nov 4 '12 at 4:57
Specifically, the variance of $J$. – David Faux Nov 4 '12 at 4:58
Like say $J$ is the minimum of $X$ and $Y$ ... – David Faux Nov 4 '12 at 5:04

The question has evolved in the comments, and now may be asking the following. Let $J$ be the minimum of $X$ and $Y$. What is the variance of $J$? We assume that the joint density function of $X$ and $Y$ is $f(x,y)$.

An answer goes as follows. Let $m(x,y)$ be the minimum of $x$ and $y$. Then $$E(J)=\int_{-\infty}^\infty\int_{-\infty}^\infty m(x,y)f(x,y)\,dx\,dy.$$ As for the variance, it is $E(J^2)-(E(J))^2$, and $$E(J^2)=\int_{-\infty}^\infty\int_{-\infty}^\infty (m(x,y))^2f(x,y)\,dx\,dy.$$

In evaluating the integrals, we probably will want to use the following strategy, which we illustrate with the integral for the mean of $J$. Divide the plane into two parts, the part below $y=x$ and the part above. Then our integral is the sum of the integrals over the two parts.

In the part with $y\lt x$, we have $m(x,y)=y$. So our integral over this part is $$\int_{x=-\infty}^\infty\int_{y=-\infty}^x yf(x,y)\,dy\,dx.$$ The integral over the part where $x\lt y$ is obtained in the same way, except for some minor changes. It is $$\int_{y=-\infty}^\infty\int_{x=-\infty}^y xf(x,y)\,dx\,dy.$$ Add these.

The integral for calculating $E(J^2)$ can be broken up in exactly the same way. Instead of integrating $yf(x,y)$ or $xf(x,y)$ over suitable regions, we will be integrating $y^2f(x,y)$ and $x^2f(x,y)$ over the same regions.

-
Thanks for being so thorough! – David Faux Nov 4 '12 at 5:59

Let $\bar F:(x,y)\mapsto\mathbb P(X\geqslant x,Y\geqslant y)$ denote the complementary CDF of $(X,Y)$ and $G=-(\partial_x\bar F+\partial_y\bar F)$. Then $t\mapsto G(t,t)$ is the PDF of $J=\min\{X,Y\}$ hence $$\mathbb E(J)=\int tG(t,t)\mathrm dt,\qquad\mathbb E(J^2)=\int t^2G(t,t)\mathrm dt,$$ from which the variance of $J$ follows.

In the case when $(X,Y)$ is independent, $\bar F(x,y)=\bar F_X(x)\bar F_Y(y)$ where $\bar F_X$ and $\bar F_Y$ are the complementary CDF of $X$ and $Y$ respectively, defined by $\bar F_X(x)=\mathbb P(X\geqslant x)$ and $\bar F_Y(y)=\mathbb P(Y\geqslant y)$. If furthermore the distributions of $X$ and $Y$ have densities $f_X$ and $f_Y$, then $\partial_x\bar F_X(x)=-f_X(x)$ and $\partial_y\bar F_Y(y)=-f_Y(y)$ hence $$G(x,y)=f_X(x)\bar F_Y(y)+f_Y(y)\bar F_X(x),$$ and the formulas above apply, with $$G(t,t)=f_X(t)\bar F_Y(t)+f_Y(t)\bar F_X(t)=f_X(t)\mathbb P(Y\geqslant t)+f_Y(t)\mathbb P(X\geqslant t).$$

-