Overlap in the union bound (source code)

= Overlap in the union bound
{title2=$\sum_i\mathbb P(A_i)-\mathbb P(\bigcup_iA_i)=\mathbb E[N-\mathbf1_{\{N\geq1\}}]$}

For a finite family, the <random variable> $N=\sum_i\mathbf1_{A_i}$ counts the <events> that occur. <Linearity of expectation> gives $\mathbb E N=\sum_i\mathbb P(A_i)$, while $\mathbb P(N\geq1)$ is the exact <union> <probability>. Their difference is
$$
\sum_i\mathbb P(A_i)-\mathbb P\left(\bigcup_i A_i\right)=\mathbb E\left[N-\mathbf1_{\{N\geq1\}}\right].
$$
An outcome in exactly $k\geq1$ <events> contributes $k-1$ extra counts, weighted by its <probability>. This nonnegative difference vanishes exactly in <equality in Boole's inequality>. For two <events> it is $\mathbb P(A\cap B)$, as the <inclusion-exclusion principle for probabilities> shows. For more <events>, the <Bonferroni inequalities> use pairwise and higher <intersection> information to bound the exact <union> <probability>; blindly subtracting pairwise <intersections> from the sum gives a lower bound, rather than a corrected upper bound.

Severe overlap can make the <union bound> arbitrarily pessimistic. Let all $m$ <events> be the same <event> $A$ with <probability> $1/m$, where $m\geq1$ is an <integer>. A concrete model is the <discrete uniform distribution> on $\{1,\ldots,m\}$ with $A=\{1\}$. The exact <union> <probability> is $1/m$, whereas the sum and capped bound are both one. The ratio is $m$: adding more names for the same <event> does not create more ways to fail. The identity above describes the gap in the uncapped sum; capping at one can reduce that gap.