# Does $\mathbb{Cov} \left(f(X),Y\right) = 0 \; \forall \; f(.)$ imply independence of $X$ and $Y$?

Does $\mathbb{Cov} \left(f(X),Y\right) = 0 \; \forall \; f(.)$ imply independence of $X$ and $Y$?

I am only familiar with the following definition of independence between $X$ and $Y$.

$$f_{x,y}(x,y) = f_x(x)f_y(y)$$

• You need $\mathbb{Cov} \left(f(X),g(Y)\right) = 0 ~\text{for all (measurable)} ~f(\cdot), g(\cdot)$, not just $\mathbb{Cov} \left(f(X),Y\right) = 0 \; \forall \; f(\cdot)$ Oct 22, 2017 at 17:13

Let's begin with the intuition. The slope of the ordinary least squares regression of $Y$ against $h(X)$, for any function $h$, is proportional to the covariance of $h(X)$ and $Y$. The assumption is that all regressions are all zero (not just the linear ones). If you imagine $(X,Y)$ represented by a point cloud (really, a probability density cloud), then no matter how you slice it vertically and reorder the slices (which carries out the mapping $h$), the regression remains zero. This implies the conditional expectations of $Y$ (which are the regression function) are all constant. We could screw around with the conditional distributions while keeping the expectations constant, thereby ruining any chance of independence. We therefore should expect that the conclusion does not always hold.

There are simple counterexamples. Consider a sample space of nine abstract elements $$\Omega = \{\omega_{i,j}\mid -1 \le i,j,\le 1\}$$ and a discrete measure with probability determined by

$$\mathbb{P}(\omega_{0,0})=0;\ \mathbb{P}(\omega_{0,j})=1/5\,(j=\pm 1);\ \mathbb{P}(\omega_{i,j}=1/10)\text{ otherwise.}$$

Define $$X(\omega_{i,j})=j,\ Y(\omega_{i,j})=i.$$

We could display these probabilities as an array

$$\pmatrix{1&2&1\\1&0&1\\1&2&1}$$

(with all entries multiplied by $1/10$) indexed in both directions by the values $-1,0,1$.

The marginal probabilities are $$f_X(-1)=f_X(1)=3/10;\, f_X(0)=4/10$$ and $$f_Y(-1)=f_Y(1)=4/10;\, f_Y(0)=2/10,$$ as computed by the column sums and row sums of the array, respectively. Since $$f_X(0)f_Y(0)=(4/10)(2/10)\ne 0=\mathbb{P}(\omega_{0,0})=f_{XY}(0,0),$$ these variables are not independent.

This was constructed to make the conditional distribution of $Y$ when $X=0$ different from the other conditional distributions for $X=\pm 1$. You can see this by comparing the middle column of the matrix to the other columns. The symmetry in the $Y$ coordinates and in all the conditional probabilities immediately shows all conditional expectations are zero, whence all covariances are zero, no matter how the associated values of $X$ might be reassigned to the columns.

For those who might remain unconvinced, the counterexample may be demonstrated through direct computation--there are only $27$ functions that have to be considered and for each of them the covariance is zero.