TITLE: An interesting combinatorics problem
QUESTION [15 upvotes]: $A$ is a set containing $n$ elements. A subset $P_1$ of $A$ is chosen. The set is reconstructed by replacing the elements of $P_1$. Then a subset $P_2$ is chosen and again the set is reconstructed by replacing the elements of $P_2$. In this way $m$ subsets $P_1,......,P_m$ are chosen where $m>1$.
Find the number of ways of choosing $P_1,.......,P_m$ such that no two of them  are pairwise disjoint.
I don't have any clue how to start this problem
I tried a lot of things but couldn't even get close to a conclusion.

Edit: An equivalent (and hopefully simpler and neater) way of putting it.
Given a set $A$ with $n$ elements, let $B=(P_1,P_2 \cdots, P_m)$ be a tuple of $m$ non-empty subsets of $A$, $P_i \subset A$ such that $P_i \cap P_j \ne \varnothing$. How many different $B$ there are?

REPLY [5 votes]: As far as I know there is no known general formula for $S(n,m)$, the number of binary $(m\times n)$ matrices with the property that any two rows have a common $1$. In the paper On the number of Boolean functions in the Post classes $F_8^{\mu}$ by V. Jovović and G. Kilibarda (1999) the authors provide $S(n,m)$ for small values of $m$ ($1\leq m\leq 8)$.

Here we consider in some detail the formula for $S(n,4)$ which is given for non-negative integer values $n$ as (see the other answer for references)
  \begin{align*}
\color{blue}{S(n,4)}&\color{blue}{=16^n -6\cdot 12^n +12\cdot 10^n -9^n}\\
&\qquad\color{blue}{-16\cdot 8^n +15\cdot 7^n -6\cdot 6^n +5^n}\tag{1}
\end{align*}

Since the representation (1) is not that obvious (for me) I wanted to better understand what's going on. The nice contributions from the others clearly indicate that the inclusion-exclusion principle is a proper technique to attack the problem. But to even better see the details a refined approach using graphs is convenient.

Overview:
We consider binary $(4\times n)$ matrices and denote the four rows with $(P_1,P_2,P_3,P_4)$ in accordance with OPs notation. We represent each matrix as graph. The four rows of a matrix are the four nodes of the graph and an edge connects two nodes if and only if the corresponding rows of the matrix are orthogonal, i.e. they have no common $1$.
A graph with $m$ nodes may have $0$ up to $\binom{m}{2}$ edges so that the number of different graphs is
  \begin{align*}
\sum_{k=0}^{\binom{m}{2}}\binom{\binom{m}{2}}{k}=2^{\binom{m}{2}}
\end{align*}
In the current situation we have $m=4$ and since $\binom{4}{2}=6$ there is a total of
  \begin{align*}
\sum_{k=0}^{6}\binom{6}{k}=2^6=64
\end{align*}
  graphs which can be divided into $7$ different groups corresponding to graphs with  $0$ up to $6$ edges.
The following table lists the $64$ different graphs organised in $7$ groups. We can see a correspondence of graphs with $k\ (0\leq k\leq 6)$ nodes and those with $6-k$ nodes. Note that within a group not all graphs are  isomorphic. Graphs within a group which are not isomorphic are separated by dotted lines. We see there are two different types of isomorphic graphs in the group with $2$ and the group with $4$ edges and three different types in the group with $3$ edges.

                                   

Results:
We start with the core figures which will be proved in the next section. We select representatives for each of the isomorphic graphs and provide the number of  matrices accordingly.

The table below lists in each row figures for graphs with $k$ edges. This means that there are (at least) $k$ pairs of nodes which are (pairwise) orthogonal. In order to identify different isomorphic graphs within a group with the same $k$ we use  a subscript a,b and c where appropriate.
The number $N_k$ gives the number of different graphs which are isomorphic with the representative (see the calculation below which provides the representatives).
The number $A_k$ gives the number of different matrices  corresponding to the representative.

$$
\begin{array}{llccl}
k&N_k&&&A_k\\
\hline
0&1&&&16^n\\
1&6&&&12^n\\
2_a,2_b&12,3&&&10^n,9^n\\
3_a,3_b,3_c&4,12,4&&&8^n,8^n,9^n\\
4_a,4_b&12,3&&&7^n,7^n\\
5&6&&&6^n\\
6&1&&&5^n\\
\end{array}
$$

$$ $$

Calculation:
$k=0$:
                                                                       
No constraints are given, for each of the nodes $P_i,1\leq i\leq 4$ there are $2^n$ different possibilities. We obtain a total of
  \begin{align*}
\color{blue}{A_0}=2^n2^n2^n2^n\color{blue}{=16^n}
\end{align*}

$k=1$:
                                                                       
The representative has an edge connecting $P_1$ and $P_2$. We are looking for the number of matrices where row $P_1$ and row $P_2$ are orthogonal. We obtain
  \begin{align*}
\color{blue}{A_1}&=2^n2^n\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}\\
&=4^n3^n\\
&\color{blue}{=12^n}
\end{align*}

$k=2_a$:
                                                                       
The representative has an edge connecting $P_1$ and $P_2$ and another edge connecting $P_1$ with $P_3$. We are looking for the number of matrices where row $P_1$ and row $P_2$ are orthogonal as well as where row $P_1$ and row $P_3$ are orthogonal. We obtain
  \begin{align*}
\color{blue}{A_{2_a}}&=2^n\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}2^{n-q_1}\\
&=2^n\sum_{q_1=0}^n\binom{n}{q_1}4^{n-q_1}\\
&=2^n5^n\\
&\color{blue}{=10^n}
\end{align*}

$k=2_b$:
                                                                       
The representative has an edge connecting $P_1$ and $P_2$ and another edge connecting $P_3$ with $P_4$. We are looking for the number of matrices where row $P_1$ and row $P_2$ are orthogonal as well as where row $P_3$ and row $P_4$ are orthogonal. We obtain
  \begin{align*}
\color{blue}{A_{2_b}}&=\left(\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}\right)^2\\
&=\left(3^n\right)^2\\
&\color{blue}{=9^n}
\end{align*}


The next calculations are done similarly. An index $q_i$ is used when counting the number of admissible ways of  $P_i$.

$k=3_a$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{3_a}}&=2^n\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^n\binom{n-q_1}{q_2}2^{n-q_1-q_2}\\
&=2^n\sum_{q_1=0}^n\binom{n}{q_1}3^{n-q_1}\\
&=2^n4^n\\
&\color{blue}{=8^n}
\end{align*}

$k=3_b$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{3_b}}
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{n-q_2}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}2^{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{n-q_1-q_2}\\
&=2^n\sum_{q_1=0}^n\binom{n}{q_1}3^{n-q_1}\\
&=2^n4^n\\
&\color{blue}{=8^n}
\end{align*}

$k=3_c$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{3_c}}
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}2^{n-q_1}2^{n-q_1}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}8^{n-q_1}\\
&\color{blue}{=9^n}
\end{align*}

$k=4_a$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{4_a}}
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{n-q_1-q_2}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{n-q_1}3^{n-q_1}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}6^{n-q_1}\\
&\color{blue}{=7^n}
\end{align*}

$k=4_b$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{4_b}}
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}\sum_{q_3=0}^{n-q_2}
\binom{n-q_2}{q_3}2^{n-q_3}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{q_2}\sum_{q_3=0}^{n-q_2}
\binom{n-q_2}{q_3}2^{n-q_2-q_3}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{q_2}3^{n-q_2}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{q_2}3^{n-q_1-q_2}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}2^{q_1}5^{n-q_1}\\
&\color{blue}{=7^n}
\end{align*}

$k=5$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{5}}
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}\sum_{q_3=0}^{n-q_1-q_2}
\binom{n-q_1-q_2}{q_3}2^{n-q_1-q_3}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{q_2}\sum_{q_3=0}^{n-q_1-q_2}
\binom{n-q_1-q_2}{q_3}2^{n-q_1-q_2-q_3}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}2^{q_2}3^{n-q_1-q_2}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}5^{n-q_1}\\
&\color{blue}{=6^n}
\end{align*}

$k=6$:
                                                                       
We obtain
  \begin{align*}
\color{blue}{A_{6}}
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}\sum_{q_3=0}^{n-q1-q_2}
\binom{n-q_1-q_2}{q_3}2^{n-q_1-q_2-q_3}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}\sum_{q_2=0}^{n-q_1}\binom{n-q_1}{q_2}3^{n-q_1-q_2}\\
&=\sum_{q_1=0}^n\binom{n}{q_1}4^{n-q_1}\\
&\color{blue}{=5^n}
\end{align*}

Conclusion:
Finally we can put all together and obtain according to the inclusion-exclusion principle from the results of the last section and the values $N_k$ stated in the table above
\begin{align*}
\color{blue}{S(4,n)}&=N_0A_0-N_1 A_1+(N_{2_a}A_{2_a}+N_{2_b}A_{2_b})\\
&\qquad-(N_{3_a} A_{3_a}+N_{3_b} A_{3_b}+N_{3_c} A_{3_c})\\
&\qquad+(N_{4_a} A_{4_a}+N_{4_b} A_{4_b})-N_5 A_5+N_6A_6\\
&=16^n-6\cdot 12^n+(12\cdot 10^n+3\cdot 9^n)\\
&\qquad-(4\cdot 8^n+12\cdot 8^n+4\cdot 9^n)\\
&\qquad+(12\cdot 7^n+3\cdot 7^n)-6\cdot 6^n+5^n\\
&\color{blue}{=16^n -6\cdot 12^n +12\cdot 10^n -9^n}\\
&\qquad\color{blue}{-16\cdot 8^n +15\cdot 7^n -6\cdot 6^n +5^n}
\end{align*}
and the claim follows.