Possible range of correlation between two random variables I was given this question in a job interview and I wasn't sure how to answer it.
Suppose you have two random variables, $X,Y$.
Let us say that $X=1$ with probability $50\%$ and $0$ otherwise,
$Y=1$ with probability of $30\%$ and $0$ otherwise.
The first question was what is the range of probabilities for the event $X=1 ,Y=1$? The answer to that would be from $0\%$ to $30\%$, so this is not the focus of my question
The second question, which I was unsure of, is the following - what is the range of the correlation between both variables? The standard formula for correlation seemed quite unhelpful, especially since the question wasn't phrased like that with 0 and 1 (it was framed in the sense that $X$ or $Y$ occurred or did not occur)
 A: Since $P(X=1,Y=1)\leq \min \{P(X=1),P(Y=1)\}=0.3,$ we have $$P(X=1,Y=1)\in [0,0.3].$$ Further, since $X\sim Bern(0.5),Y\sim Bern(0.3),$ we know $E[XY]=P(X=1,Y=1)$ and
$$E[X]=0.5,E[Y]=0.3,Var(X)=0.5(1-0.5)=0.25,Var(Y)=0.3(1-0.3)=0.21.$$
Thus, $$\text{Corr(X,Y)}=\frac{E[XY]-E[X]E[Y]}{\sqrt{Var(x)Var(Y)}}=\frac{E[XY]-(0.5)(0.3)}{\sqrt{(0.25)(0.21)}}\\
\in \left[\frac{0-(0.5)(0.3)}{\sqrt{(0.25)(0.21)}},\frac{0.3-(0.5)(0.3)}{\sqrt{(0.25)(0.21)}}\right]\approx \left[-0.65,+0.65\right].$$

To see a concrete example where any value of this range can be realized, flip two coins in succession. The first coin is fair. If the first coin lands heads, the second coin that is used will be weighted with probability $p$ of landing heads. If the first coin lands tails, the second coin that is used will be weighted with probability $0.6-p$ of landing heads. Let $X,Y$ be indicators for coin 1, coin 2 respectively landing heads. This setup meets the assumptions of the problem, and since $0.6-p\geq 0\implies p\in [0,0.6],$ we have $$P(X=1,Y=1)=0.5p\in [0,0.3].$$
A: Visualisation:
Take a line segment of length $1$.   Mark $0.50$ as the event $X=1$.  Place aside it another line segment of length $0.30$ to mark the event $Y=1$.  Slide it along the first segment to identify the possible range of the joint event's probability.
At a minimum, there is no overlap.  At a maximum, there is complete overlap (of the longer segment over the shorter).
Thus: $~0\leqslant\mathsf P(X{=}1,Y{=}1)\leqslant 0.30$

The formula for correlation is: $$\begin{align}\mathsf{Corr}(X,Y)&=\dfrac{\mathsf{Cov}(X,Y)}{~\sqrt{\raise{2ex}~{\mathsf{Var}(X)~\mathsf{Var}(Y)}~}~}\\[2ex]&=\dfrac{\mathsf E(XY)-\mathsf E(X)\,\mathsf E(Y)}{~\sqrt{\big(\mathsf E(X^2)-\mathsf E(X)^2\big)\,\big(\mathsf E(Y^2)-\mathsf E(Y)^2\big)~}~}\\[2ex]~\end{align}$$
Where $$\begin{align}\mathsf {E}(X)&=1~\mathsf P(X{=}1)+0~\mathsf P(X{=}0)\\ &=\mathsf P(X{=}1)\\\text{et cetera}\end{align}$$
