how to write the formula to calculate all possible union sets combination of size 2 or more

52 Views Asked by At

Given a collection of sets $A= \{A_1,A_2,A_3\}$. I want to calculate the following sum $2^{X-|A_1 \cap A_2|} + 2^{X-|A_1 \cap A_3|}+ 2^ {X-|A_2 \cap A_3|}+ 2^ {X-|A_1 \cap A_2 \cap A_3|} $. how to write the formula to calculate this sum when $A = \{A_1,...,A_n\}$?

1

There are 1 best solutions below

0
On BEST ANSWER

I think the best way to generalize what you have would be the following:

\begin{align} \Sigma_{i_1<i_2} 2^{X - |A_{i_1} \cap A_{i_2}|} + \Sigma_{i_1<i_2<i_3}2^{X-|A_{i_1}\cap A_{i_2} \cap A_{i_3}|} + \ldots + \Sigma_{i_1<i_2<\ldots<i_n}2^{X-|A_{i_1}\cap A_{i_2}\cap\ldots\cap A_{i_n}|}, \end{align}

with $i_k \leq n$ for all $k$.