Condition for Independence from Product of Expectations

Theorem
Let $\struct {\Omega, \Sigma, \Pr}$ be a probability space.

Let $X$ and $Y$ be discrete random variables on $\struct {\Omega, \Sigma, \Pr}$.

Let $E$ denote the expectation function.

Then $X$ and $Y$ are independent :
 * $\map E {\map g x \map h y} = \map E {\map g x} \map E {\map h y}$

for all functions $g, h: \R \to \R$ for which the latter two expectations exist.

Sufficient Condition
Suppose that $X$ and $Y$ were not independent.

That is:
 * $\map \Pr {X = a, Y = b} \ne \map \Pr {X = a} \map \Pr {Y = b}$

for some $a, b \in \R$.

Now, suppose that
 * $\map E {\map g x \map h y} = \map E {\map g x} \map E {\map h y}$

for all functions $g, h: \R \to \R$ for which the latter two expectations exist.

Let us define $g$ and $h$ as examples of such functions as follows:


 * $(1): \quad \map g x := \begin{cases}

1 & : x = a \\ 0 & : x \ne a \end{cases}$


 * $(2): \quad \map h y := \begin{cases}

1 & : y = b \\ 0 & : y \ne b \end{cases}$

where $a \in \R$ and $b \in \R$ are arbitrary real numbers.

Then:

So by hypothesis:
 * $\map \Pr {X = a, Y = b} = \map \Pr {X = a} \map \Pr {Y = b}$

But also by hypothesis:
 * $\map \Pr {X = a, Y = b} \ne \map \Pr {X = a} \map \Pr {Y = b}$

This contradicts our supposition that:
 * $\map E {\map g x \map h y} = \map E {\map g x} \map E {\map h y}$

for all functions $g, h: \R \to \R$ for which the latter two expectations exist.

So, if the above supposition holds, then $X$ and $Y$ have to be independent.

Necessary Condition
Suppose $X$ and $Y$ are independent.

Let $g, h: \R \to \R$ be any real functions such that $\map E {\map g x}$ and $\map E {\map h y}$ exist.

Then:

thus proving that
 * $\map E {\map g x \map h y} = \map E {\map g x} \map E {\map h y}$

whatever $g$ and $h$ are.