# If X and Y are uncorrelated, are X^2 and Y also uncorrelated?

If two random variables $X$ and $Y$ are uncorrelated, can we also know that $X^2$ and $Y$ uncorrelated? My hypothesis is yes.

$X, Y$ uncorrelated means $E[XY]=E[X]E[Y]$, or

$$E[XY]=\int xy f_X(x)f_Y(y)dxdy=\int xf_X(x)dx\int yf_Y(y)dy=E[X]E[Y]$$

Does that also mean the following? $$E[X^2Y]=\int x^2y f_X(x)f_Y(y)dxdy=\int x^2f_X(x)dx\int yf_Y(y)dy=E[X^2]E[Y]$$

• Yes. This question has been asked and answered before but I cannot find a specific reference from my mobile device. – Dilip Sarwate Sep 9 '17 at 11:33
• @DilipSarwate it seems that the accepted answer already gives a counter example. – Vim Sep 9 '17 at 15:25
• @DilipSarwate You must have meant "No" instead of "Yes" in your comment! – amoeba Sep 9 '17 at 18:31
• @amoeba The original version of the question asked about independence for which the answer is indeed Yes. It has since been edited to ask about uncorrelated random variables. I can't change my comment now. – Dilip Sarwate Sep 9 '17 at 19:32
• The original question was quite confused, as it used a wrong definition of independence. The current question is still confused, as it asserts an inappropriate deduction from being uncorrelated (it assumes $f_{XY}(x,y)=f_X(x)f_Y(y)$). I hope @vegardstikbakke reads up on the proper definitions of independent and uncorrelated, with some examples. – Meni Rosenfeld Sep 10 '17 at 7:57

No. A counterexample:

Let $X$ be uniformly distributed on $[-1, 1]$, $Y = X^2$.

Then $E[X]=0$ and also $E[XY]=E[X^3]=0$ ($X^3$ is odd function), so $X,Y$ are uncorrelated.

But $E[X^2Y] = E[X^4] = E[{X^2}^2] > E[X^2]^2 = E[X^2]E[Y]$

The last inequality follows from Jensen's inequality. It also follows from the fact that $E[{X^2}^2] - E[X^2]^2 = Var(X) > 0$ since $X$ is not constant.

The problem with your reasoning is that $f_X$ might depend on $y$ and vice versa, so your penultimate equality is invalid.

• No need for making it more complicated with Jensen's inequality; $X^4$ is a non-negative random variable, and is not $0$ w.p. 1, so $E[X^4] >0$ (or you can just do $\int_{-1}^1 x^4 dx$ and easily see its positive). – Batman Sep 9 '17 at 17:02
• You should also add a plot. I had been considering a similar example (Y=|X| on -1:+1) but would have presented that visually. – Has QUIT--Anony-Mousse Sep 10 '17 at 8:27
• @Batman I don't really see how it gives you anything since we're interested if $E[{X^2}^2] - E[X^2]^2 > 0$ – Jakub Bartczuk Sep 10 '17 at 12:05
• @Anony-Mousse No need to restrict Y. Y = |X| meets the requirement. – Loren Pechtel Sep 11 '17 at 3:55
• LorenPechtel for visualization. Because IMHO it is better to see why this can happen, and not just that the math outcome is as desired. – Has QUIT--Anony-Mousse Sep 11 '17 at 6:34

Even if $\operatorname{Corr}(X,Y)=0$, not only is it possible that $X^2$ and $Y$ are correlated, but they may even be perfectly correlated, with $\operatorname{Corr}(X^2,Y)=1$:

> x <- c(-1,0,1); y <- c(1,0,1)
> cor(x,y)
[1] 0
> cor(x^2,y)
[1] 1


Or $\operatorname{Corr}(X^2,Y)=-1$:

> x <- c(-1,0,1); y <- c(-1,0,-1)
> cor(x,y)
[1] 0
> cor(x^2,y)
[1] -1


In case you cannot read R code, the first example is equivalent to considering two random variables $X$ and $Y$ with a a joint distribution such that $(X,Y)$ is equally likely to be $(-1,1)$, $(0,0)$ or $(1,1)$. In the perfectly negatively correlated example, $(X,Y)$ is equally likely to be $(-1,-1)$, $(0,0)$ or $(1,-1)$.

Nevertheless, we can also construct $X$ and $Y$ such that $\operatorname{Corr}(X^2,Y)=0$, so all extremes are possible:

> x <- c(-1,-1,0,1,1); y <- c(1,-1,0,1,-1)
> cor(x,y)
[1] 0
> cor(x^2,y)
[1] 0


The error in your reasoning is that you write the following about $E[h(X,Y)]$: $$E[h(X,Y)]=\int h(x,y) f_X(x)f_Y(y)dxdy$$ while in general $$E[h(X,Y)]=\int h(x,y) f_{XY}(x,y)dxdy.$$ The two coincide if $f_{XY}(x,y)=f_X(x)f_Y(y)$, i.e. if $X$ and $Y$ are independent. Being uncorrelated is a necessary but not sufficient condition for being independent. So if two variables $X$ and $Y$ are uncorrelated but dependent, then $f(X)$ and $g(Y)$ may be correlated.