# $E(X-EX)\cdot (Y-EY)$ when Y is Bernoulli

I'd like to calculate $E(X-EX)\cdot (Y- EY)$, where $X$ is continuous with some continuous density $f$ on $[0,1]$ interval and $Y$ is a Bernoulli random variable with $P(Y=1) = 0.95$ and $P(Y=0) = 0.05$. The condition is that, they are not independent.
I feel I'm having a complete 'mind eclipse'. I go like this:

$$E(X-EX)\cdot (Y-EY)=E[(X-EX)\cdot (-0.95)\cdot 1_{0<y<0.05}+(X-EX)\cdot 0.05\cdot 1_{0.05<y<1}]=-0.95\cdot E[(X-EX)\cdot 1_{0<y<0.05}]+0.05\cdot E[(X-EX)\cdot 1_{0.05<y<1}]$$

and the question is it really all what can be done?

• If $X$ and $Y$ are independent this is obviously $0$ – Henry Feb 21 '17 at 14:52
• @Henry, I forgot to add the information that they're not independent... I updated the question. – Lil'Lobster Feb 21 '17 at 14:53

You have found $E[Y]=0.95$.

You will have $E[E[X](Y-E[Y])]=E[X]E[(Y-E[Y])]=0$

Then the covariance is $$E[(X-EX)\cdot (Y- EY)] = E[X (Y- EY)]$$ $$= (1-0.95)\, P(Y=1)\, E[X\mid Y=1] +(0-0.95)\,P(Y=0) \,E[X\mid Y=0]$$ $$= 0.05 \times 0.95 \, E[X\mid Y=1] - 0.95 \times 0.05 \,E[X\mid Y=0]$$ $$= 0.0475 \Big(E[X\mid Y=1] - E[X\mid Y=0]\Big)$$

• But I didn't assume that $EX=0$... – Lil'Lobster Feb 21 '17 at 15:14
• No you did not; $E[X]$ is a constant between $0$ and $1$ and so is independent of $Y$. But you can use $E[Y-E[Y]]=E[Y]-E[E[Y]]= 0.95-0.95=0$ – Henry Feb 21 '17 at 15:37
• Ok, I don't understand this passage after second equality sign. What leads to this formula with conditioning? – Lil'Lobster Feb 21 '17 at 21:05
• @Lili: I have added an extra step – Henry Feb 21 '17 at 23:32

Because we know $Y\sim\mathcal{Ber}(0.95)$ then the covariance of $X,Y$ will be:


Nothing more can be found without a means to obtain these two conditional expectations.

• Here, you used this property: EXY=Y*E(X|Y) as I can recognize. But these two solutions differ very much with EX. Is it just 'visual' difference or one of them is wrong? – Lil'Lobster Feb 22 '17 at 8:03