# Bernoulli random variables and correlation coefficient

Let's consider two random variables $$X$$ and $$Y$$ following a Bernoulli distribution such that: $$P(X=1) = p\\ P(Y=1) = q$$ The correlation coefficient $$\rho$$ is given and my goal is to compute $$P(X \cap Y)$$: $$\rho = \frac{E[XY]-E[X] E[Y]}{\sqrt{Var(X)*Var(Y)}} = \frac{P(X\cap Y)-pq}{\sqrt{p\cdot (1-p) \cdot q\cdot (1-q)}} \\ P(X \cap Y) = \rho \cdot \sqrt{p \cdot (1-p) \cdot q\cdot (1-q)} + pq\\$$ When $$X$$ and $$Y$$ and perfectly anti-correlated, $$\rho = -1$$ and I expect to have $$P(X \cap Y)=0$$. But a quick numerical application taking $$p=q=\frac{1}{1000}$$ gives: $$P(X \cap Y)=-0.000999$$ What am I missing?

• You have proven that two such distributions cannot be perfectly anticorrelated. At stats.stackexchange.com/a/160669/919 I proved generally, for any two finite-variance random variables $X$ and $Y,$ that perfect anticorrelation implies $X$ and $Y$ must be linearly related (with a negative coefficient): but this is impossible unless $p=1-q.$
– whuber
Commented Feb 24, 2022 at 15:59
• Indeed that makes sense now.
– bfgt
Commented Feb 24, 2022 at 16:14
• The general principle that whuber is illustrating is known as the Frechet-Hoeffding bounds. The marginal distributions of two random variables impose some (weak) constraints on the joint distribution, that prevents examples like the one you presented. Commented Feb 24, 2022 at 16:16