= Weighted inclusion-exclusion principle
{title2=$\sum_{x\notin\bigcup_i A_i}f(x)=\sum_{S\subseteq\{1,\ldots,m\}}(-1)^{|S|}\sum_{x\in\bigcap_{i\in S}A_i}f(x)$}
For finite <subsets> $A_i$ of a finite ambient <set> $X$, the <indicator function> of their complement is $\prod_i(1-\mathbf1_{A_i})$. Expanding this finite product and summing it against any weight $f:X\to\mathbb R$ proves the weighted formula. The empty intersection is $X$. Negative weights are allowed; finiteness removes every convergence issue.
Back to article page