Covariance of binary and continuous variable Suppose $y$ is a continuous random variable and $d$ is a binary random variable that takes the value $1$ with probability $p$ and $0$ with probability $1-p$. 
How do I show that $\text{Cov}(y,d)=(E[y|d=1]-E[y|d=0])p(1-p)$?
 A: \begin{eqnarray}
Cov(y,d) &=& E(y \cdot d) - E(y) \cdot E(d) \\
&=& p \cdot E(y|d=1)-[p \cdot E(y|d=1) + (1-p) \cdot E(y|d=0)] \cdot p \\
&=& p \cdot (1-p) \cdot [E(y|d=1) - E(y|d=0)] 
\end{eqnarray}
A: This answer (and all the comments from the second comment onwards on the main question) comes from a question, now-closed as a duplicate of the one above by ophelie, from Thevesh Theva who asked for a proof of
$$\operatorname{cov}(X,Y) = E[Y\mid X=1] - E[Y\mid X=0],
\tag{1}$$ which is a false result. In fact, for $X \sim \text{Bernoulli}(p)$ for which $E[X]=p$,
\begin{align}\require{cancel}
\operatorname{cov}(X,Y) &= E[XY]-E[X]E[Y]\\
&= \big(E[XY\mid X=1]\cdot p + E[XY\mid X=0]\cdot(1-p)\big) - p\cdot E[Y]\\
&= E[1\cdot Y\mid X=1]\cdot p + \cancel{E[0\cdot Y\mid X=0]}\cdot(1-p) - p\cdot E[Y]\\
&= E[Y\mid X=1]\cdot p - p\cdot \big(E[Y\mid X=1]\cdot p + E[Y\mid X=0]\cdot (1-p)\big)\\
&= E[Y\mid X=1]\cdot p(1-p) - E[Y\mid X=0]\cdot p(1-p)\\
&= \big(E[Y\mid X=1] - E[Y\mid X=0]\big)\cdot p(1-p) \tag{2}
\end{align}
where we have an extra factor of $p(1-p)$ (with maximum value $\frac 14$)
compared to Thevesh Theva's claim $(1)$.  This result also matches the one asked for above by ophelie which is 
proved more succinctly in this answer by Skullduggery.
The claim $(1)$ is a misreading of a result about the ratio of two covariances:
$$\frac{\operatorname{cov}(X,Y)}{\operatorname{cov}(X,Z)} =
\frac{E[Y\mid X=1] - E[Y\mid X=0]}{E[Z\mid X=1] - E[Z\mid X=0]}$$
in which the $p(1-p)$ common factor in the numerator and denominator has cancelled out, misleading unwary readers into believing that the authors of the paper are claiming that $\operatorname{cov}(X,Y) = E[Y\mid X=1] - E[Y\mid X=0]$.
