Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone have an example of two dependent random variables, that satisfy this relation?

$E[f(X)f(Y)]=E[f(X)]E[f(Y)]$ for every function $f(t)$.


*edit: I still couldn't find an example. I think one should be of two identically distributed variables, since all the "moments" need to be independent: $Ex^iy^i=Ex^iEy^i$. That's plum hard...

share|cite|improve this question
No, and in fact no such examples can exist by considering the indicator functions of measurable sets. – Chris Janjigian Nov 26 '12 at 16:38
Thanks. But I know that the condition for independence is that this holds for every f(X) and g(Y), here this is a weaker condition, so I would expect that they would not be independent... – yoki Nov 26 '12 at 16:43
Ah I see. I read what you wrote wrong. There may be a way to show this with $\pi-\lambda$ but I think you may be right. – Chris Janjigian Nov 26 '12 at 17:11
Unfortunately I don't know about $\pi-\lambda$. Is there a simpler example? – yoki Nov 26 '12 at 19:59
Just as a random thought about how to approach this: the condition you have there is (I am pretty sure) equivalent to conditional independence of $X$ and $Y$ given the $\sigma-$ algebra generated by measurable rectangles of the form $A \times A$ where $A \in \mathcal{B}$. The first step here would be to show that that sigma algebra is not the entire Borel $\sigma-$algebra. Showing that should give a bit of insight as to what kind of random variables to look at, since you need to find a set not in that algebra to have any hope of this working. I'm a bit busy today, but tomorrow I may try it. – Chris Janjigian Nov 26 '12 at 22:02
up vote 16 down vote accepted

Here is a counterexample. Let $V$ be the set $\lbrace 1,2,3 \rbrace$. Consider random variables $X$ and $Y$ with values in $V$, whose joint distribution is defined by the following matrix :

$$ P=\left( \begin{matrix} \frac{1}{10} & 0 & \frac{1}{5} \\ \frac{1}{5} & \frac{1}{10} & 0 \\ \frac{1}{30} & \frac{7}{30} & \frac{2}{15} \end{matrix} \right)= \left( \begin{matrix} \frac{3}{30} & 0 & \frac{6}{30} \\ \frac{6}{30} & \frac{3}{30} & 0 \\ \frac{1}{30} & \frac{7}{30} & \frac{4}{30} \end{matrix}\right) $$

Thus, for example, $P(X=1,Y=2)=0$ while $P(X=1)P(Y=2)=(\frac{1}{10} + \frac{1}{5})(\frac{1}{10} + \frac{7}{30}) >0$. So $X$ and $Y$ are not independent.

Let $f$ be an ARBITRARY (I emphasize this point because of a comment below) function defined on $X$ ; put $x=f(1),y=f(2),z=f(3)$. Then

$$ \begin{array}{rcl} {\mathbf E}(f(X)) &=& \frac{3(x+y)+4z}{10} \\ {\mathbf E}(f(Y)) &=& \frac{x+y+z}{3} \\ {\mathbf E}(f(X)){\mathbf E}(f(Y)) &=& \frac{3(x+y)^2+7(x+y)z+4z^2}{30} \\ {\mathbf E}(f(X)f(Y)) &=& \frac{3x^2+6xy+3y^2+7xz+7yz+4z^2}{30} \\ \end{array} $$

The last two are equal, qed.

share|cite|improve this answer
We have here two dependent variables, and a specific function $f(t)$ for which the original equation holds. This is not the question - I can find many dependent variables with a specific $f$ that satisfies this. The question is rather do two variables $X,Y$ exist such that the original equation holds (for all $f$'s) but are dependent. – yoki Nov 29 '12 at 12:28
@ido : what do you mean “specific” ? My $f$ is not specific at all, it is completely free and arbitrary, as are $x$, $y$ and $z$. – Ewan Delanoy Nov 29 '12 at 12:53
Can you say a few words about how you came up with these numbers? It would be interesting to have a more "natural" example. – Nate Eldredge Nov 29 '12 at 14:15
@PeterR: $E(f(X)) = f(1) P(X=1) + f(2) P(X=2) + f(3) P(X=3)$. It's the most basic definition of expectation. – Nate Eldredge Nov 29 '12 at 14:17
@NateEldredge : Basically, what happens is this : the distribution space has dimension $3 \times 3-1=8$ (the $-1$ is because probabilities sum to $1$). Complete independence is equivalent to four independent linear relations, while “weak independence” (in the sense of the OP) yields only three relations. Of course, you must also take into account the positivity constraints for the probabilities, but luckily for us they do not interfere here. – Ewan Delanoy Nov 29 '12 at 14:24

Here is a continuous counterexample. It has discrete analogues, some of which are given at the end. We start with a general remark, which may help understand where the counterexamples come from. (For a short version of the answer, go to the picture and ponder it, really it says everything.)

Assume that $(X,Y)$ has PDF $p$ and that there exists some measurable function $q$ such that, for every $(x,y)$, $$ p(x,y)+p(y,x)=2q(x)q(y). $$ One can assume without loss of generality that $q$ is a PDF. Then, for every function $f$, $$ E[f(X)f(Y)]=\iint f(x)f(y)p(x,y)\mathrm dx\mathrm dy=\iint f(x)f(y)p(y,x)\mathrm dx\mathrm dy, $$ hence $$ E[f(X)f(Y)]=\iint f(x)f(y)q(x)q(y)\mathrm dx\mathrm dy=\left(\int f(x)q(x)\mathrm dx\right)^2. $$ Thus, if, furthermore, $$ q(x)=\int p(x,y)\mathrm dy=\int p(y,x)\mathrm dy, $$ then indeed, $$ E[f(X)f(Y)]=E[f(X)]E[f(Y)]. $$ Now, a specific counterexample: assume that $(X,Y)$ is uniformly distributed on the set $$ D=\{(x,y)\in[0,1]^2\,;\,\{y-x\}\leqslant\tfrac12\}, $$ where $\{\ \}$ is the function fractional part. In words, $D$ (the black part in the image of the square $[0,1]^2$ below) is the union of the parts of the square $[0,1]^2$ between the lines $y=x+\frac12$ and $y=x$, and below the line $y=x-\frac12$.


Then $(Y,X)$ is uniformly distributed on the image of $D$ by the symmetry $(x,y)\to(y,x)$ (the white part in the image of the square $[0,1]^2$ above), which happens to be the complement of $D$ in the square $[0,1]^2$ (actually, modulo some lines, which have zero Lebesgue measure). Thus, our first identity holds with $q=\mathbf 1_{[0,1]}$, that is:

If $(X,Y)$ is uniformly distributed on $D$, then $X$ and $Y$ are both uniformly distributed on $[0,1]$, $(X,Y)$ is not independent, and, for every function $f$, $E[f(X)f(Y)]=E[f(X)]E[f(Y)]$.

Note that $(X,Y)$ can be constructed as follows. Let $U$ and $V$ be i.i.d. uniform on $[0,1]$, then $(X,Y)=(U,V)$ if $(U,V)$ is in $D$, else $(X,Y)=(V,U)$.

An analogue of this in the discrete setting is to consider $(X,Y)$ with joint distribution on the set $\{a,b,c\}^2$ described by the matrix $$ \frac19\begin{pmatrix}1&2&0\\0&1&2\\2&0&1\end{pmatrix}. $$ Then the random set $\{X,Y\}$ is distributed like $\{U,V\}$ where $U$ and $V$ are i.i.d. uniform on $\{a,b,c\}$. For example, considering $S=\{(a,b),(b,a)\}$, one sees that $$ P[(X,Y)\in S]=\tfrac29=P[(U,V)\in S], $$ since $[(X,Y)\in S]=[(X,Y)=(a,b)]$, while $$ P[(U,V)\in S]=P[(U,V)=(a,b)]+P[(U,V)=(b,a)]=\tfrac19+\tfrac19. $$ Thus, $$ E[f(X)f(Y)]=E[f(U)f(V)]=E[f(U)]E[f(V)]=E[f(X)]E[f(Y)]. $$ This example can be extended to any sample space of odd size. A more general distribution on $\{a,b,c\}^3$ is, for every $|t|\leqslant1$, $$ \frac19\begin{pmatrix}1&1+t&1-t\\1-t&1&1+t\\1+t&1-t&1\end{pmatrix}. $$

share|cite|improve this answer

The relation $E[XY]=E[X]E[Y]$ holds if and only if the covariance of $X$ and $Y$ is zero, that is, $X$ and $Y$ are uncorrelated.

So, you are actually asking is there dependent but uncorrelated random variables $X$ and $Y$ such that every function $f$ would preserve the uncorrelatedness.

Consider a function $f(x) = a$, where $a$ is some constant. Now, $f(X) = a$ and $f(Y) = a$, and therefore $f(X)$ and $f(Y)$ are correlated. Thus, the answer to your question is that there are no such variables.

share|cite|improve this answer
But $a^2=E[a^2]=E[f(X)f(Y)]$ and $a^2=aa=E[f(X)]E[f(Y)]$ so it still holds – Jean-Sébastien Nov 30 '12 at 2:25
therefore f(X) and f(Y) are correlated... The opposite holds: these are UN- correlated. (Upvoters: why the upvote?) – Did Jul 17 '13 at 7:54

If you take dependent random variables $X$ and $Y$, and set $X^{'} = X - E[X]$ and $Y^{'} = Y - E[Y]$, then $E[f(X^{'})f(Y^{'})]=E[f(X^{'})]E[f(Y^{'})]=0$ as long as $f$ preserves the zero expected value. I guess you cannot show this for all $f$.

share|cite|improve this answer

If $X$ and $Y$ are dependent then this equality can not hold for every function $f$.You may find some $f$ such that this is true but not for all $f$. This is by definition of independent random variables.

share|cite|improve this answer
How is this by definition? There's a definition which specifies that if for every f,g this holds (replacing one f with g in the original message) then they're independent. Here it's a weaker condition. – yoki Nov 26 '12 at 16:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.