Let $x\_1, \ldots, x\_n$ be **possibly dependent** random variables, each taking values $x\_i \in \{0, 1, 2\}$. Suppose further that in every outcome the number of random variables that equal 2 is exactly 1. Now for each $i \in \{1, \ldots, n\}$ define
$$
f\_i = \begin{cases}
\Pr[x\_i = 2 \mid x\_i \geq 1] & \text{if } x\_i \geq 1\\
0 & \text{if } x\_i =0
\end{cases},
$$
and let
$
f = \sum\_i f\_i.
$


My question is how large can the variance of $f$ be? My conjecture is that we should be able to bound it by $O(1)$ but don't know how to prove this.




---


Note: In case it helps, it is easy to prove that $E[f] = 1$:
$$
E[f] = \sum\_i E[f\_i] = \sum\_i \Pr[x\_i \geq 1] \times \Pr[x\_i = 2 \mid x\_i \geq 1] = \sum\_i \Pr[x\_i = 2] = 1,
$$
where the last equality comes from our initial assumption that in all outcomes exactly one of the $x\_i$'s equals 2.



Bounds on variance of sum of dependent random variables
$Var\,f$ can be on the order of $n$ (but not more than that).


Indeed, let $U$ and $N$ be independent random variables such that $P(U=1)=:p=1-P(U=0)=:q$ and $P(N=i)=1/n$ for all $i\in[n]:=\{1,\dots,n\}$. Let
$$x\_i:=1(U=1,N\ne i)+2\times1(N=i).
$$
Then with $p=1/n$
$$Var\,f\sim n/4\tag{1}$$
(as $n\to\infty$).


On the other hand,
$$Var\,f\le Ef^2=\sum\_{i,j\in[n]}Ef\_if\_j\le\sum\_{i,j\in[n]}Ef\_i
=n\sum\_{i\in[n]}Ef\_i=n.$$




---


Details on (1): We have
$$Ef^2=\sum\_{i,j\in[n]}Ef\_if\_j \\
=\sum\_{i,j\in[n]}P(x\_i=2|x\_i\ge1)P(x\_j=2|x\_j\ge1)
P(x\_i\ge1,x\_j\ge1),\tag{2}$$
$$P(x\_i\ge1)=1-P(x\_i=0)=1-P(U=0)P(N\ne i)=1-q(1-1/n)=p+q/n,$$
$$P(x\_i=2)=P(N=i)=1/n,$$
$$P(x\_i=2|x\_i\ge1)=\frac{P(x\_i=2)}{P(x\_i\ge1)}=\frac{1/n}{p+q/n},$$
and
$$P(x\_i\ge1,x\_j\ge1)=1-P(x\_i=0\text{ or }x\_j=0)=1-P(x\_i=0)-P(x\_j=0)+P(x\_i=0,x\_j=0)
=1-2q(1-1/n)+q(1-2/n)=1-q=p$$
for $i\ne j$. Choosing now $p=1/n$, we have  

$$Ef^2\sim n/4.$$
Since $Ef=1$, (1) now follows.




---


Looking back at (2), now the idea behind the construction should become transparent: We want to make $P(x\_i\ge1,x\_j\ge1)$ for $i\ne j$ much greater than $P(x\_i\ge1)P(x\_j\ge1)$ and at the same time not to make $P(x\_i\ge1,x\_j\ge1)$ too small. The choice $p=1/n$ is nearly optimal in this regard.


