# How to show operations on two random variables (each Bernoulli) are dependent but not correlated?

I was looking at the following question from "One Thousand Exercises in Probability" by Grimmett, page 25, question 16 (not homework just self-study):

Let $X$ and $Y$ be independent Bernoulli random variables with $p = 1/2$. Show that $X + Y$ and $|X − Y|$ are dependent though uncorrelated.

Now, the solution given on page 176 goes as follows:

$\mathrm{cov}(X+Y, |X-Y|) = E[(X+Y)\cdot(|X-Y|)] - E[X+Y]\cdot E[|X-Y|]$

I can work out that

$E[X+Y] = (0)(1/4) + (1)(1/2) + (2)(1/4) = 1$

and

$E[|X-Y|] = (0)(1/2) + (1)(1/2) = 1/2$

But I can't work out how to do

$E[(X+Y)\cdot(|X-Y|)]= ?$

The solution in the book for the covariance is:

$1/4 + 1/4 - 1(1/2) = 0$

To show dependence, the book provides the following solution:

$P(X+Y=0, |X-Y|=0) = 1/4$ is not the same as $P(X+Y=0)\cdot P(|X-Y|=0) = 1/8$

• Just use the definition of expectation: $E[(X+Y)\cdot(|X-Y|)]=\sum_{y=0}^{1}\sum_{x=0}^{1}(x+y)\cdot|x-y|P(X=x)P(Y=y)$ – assumednormal Oct 27 '12 at 18:04
• @Max That's it! I get the expected answer of $E[(X+Y)⋅(|X−Y|)] = 0 + 1/4 + 1/4 + 0 = 1/2$. Thanks! – Clair Crossupton Oct 27 '12 at 18:25

$X = 0; Y = 0 \Rightarrow |X - Y| = 0;(X+Y) = 0;(X+Y)|X-Y| = 0$
$X = 1; Y = 0 \Rightarrow |X - Y| = 1;(X+Y) = 1;(X+Y)|X-Y| = 1$
$X = 0; Y = 1 \Rightarrow |X - Y| = 1;(X+Y) = 1;(X+Y)|X-Y| = 1$
$X = 1; Y = 1 \Rightarrow |X - Y| = 0;(X+Y) = 2;(X+Y)|X-Y| = 0$
By giving a $1/4$ weight to each of these cases, you should find that the expected value of $E\left((X+Y)|X-Y|\right)$ is $1/2$ and not $0$. But the covariance is
$$E\left((X+Y)|X-Y|\right) - E(X+Y)E(|X-Y|) = 1/2 - 1 \cdot 1/2 = 0.$$