Uncorrelated Bernoulli and Poisson variables need not be independent (source code)

= Uncorrelated Bernoulli and Poisson variables need not be independent
{title2=$\operatorname{Cov}(X,Y)=p(e^{-p}-p),\quad p=e^{-p}\ \Longrightarrow\ \operatorname{Cov}(X,Y)=0$}

Here is an explicit joint distribution, for $0<p<0.8$: assign mass $(1+p)e^{-p}-p$ at $(0,0)$, mass $p(1-e^{-p})$ at $(1,0)$, mass $pe^{-p}$ at $(1,1)$, and mass $e^{-p}p^k/k!$ at $(0,k)$ for $k\geq2$; all other masses are zero. These are nonnegative: the first is decreasing in $p$, and at $p=0.8$ it is still positive. Summing over rows and columns gives a <Bernoulli distribution> with mean $p$ and a <Poisson distribution> with mean $p$, so the joint mass sums to one.

Only $(1,1)$ contributes to the mixed first <moment>, giving $\mathbb E[XY]=pe^{-p}$ and the <covariance> above. The strictly decreasing <function> $e^{-p}-p$ has a unique zero in $(0,0.8)$, approximately $0.567143$. At that parameter the variables are uncorrelated. They are nevertheless dependent, because $\mathbb P(X=1\mid Y=1)=1$ whereas $\mathbb P(X=1)=p<1$. The <Bernoulli independence from zero covariance> result requires both variables to be Bernoulli and does not apply here.