If $X\in\{0,1\}$, then $\frac{cov(X,Y)}{Var(X)}=\mathbb{E}(Y|X=1)-\mathbb{E}(Y|X=0)$ If $X\in\{0,1\}$, then $\frac{cov(X,Y)}{Var(X)}=\mathbb{E}(Y|X=1)-\mathbb{E}(Y|X=0)$
I have no idea what to address with the conditional expectation part.
Thank you for any comments, someone has provides a solution that I cannot understand. Please help me out with this question sincerely.
https://math.stackexchange.com/questions/4463922/if-x-in-0-1-then-fraccovx-yvarx-mathbbeyx-1-mathbbeyx

Use the fact that $E[X] = P(X=1)$, and
$E[XY] = E[Y\cdot 1|X=1]P(X=1) + E[Y\cdot0]P(X=0) = E[Y|X=1]E[X]$
