2. Twelve students participated in a theater festival consisting of $n$ different performances. Suppose there were six students in each performance, and each pair of performances had at most two students in common. Determine the largest possible value of $n$.
Solution: We label the students by $1,2, \ldots, 12$ and the performances by the subsets $P_{1}, \ldots, P_{n}$ of $\{1, \ldots, 12\}$. Then the problem now reduces to finding the maximum value of $n$ such that
(a) $\left|P_{i}\right|=6$ for all $1 \leq i \leq n$, and
(b) $\left|P_{i} \cap P_{j}\right| \leq 2$ for all $1 \leq i<j \leq n$.

We make a $12 \times n\{0,1\}$-matrix $M$ whose entries are defined as follows:
$$
M_{i j}=\left\{\begin{array}{ll}
1 & \text { if student } i \text { plays in performance } P_{j}, \\
0 & \text { if student } i \text { does not play in performance } P_{j} .
\end{array}\right.
$$

For each $i \in\{1, \ldots, 12\}$, let $r_{i}=\sum_{j=1}^{n} M_{i j}$ be the number of times $i$ appears in the sets $P_{1}, \ldots, P_{n}$. Then, by double-counting, we have $\sum_{i=1}^{12} r_{i}=6 n$. Let $\mathcal{R}$ be the set of all unordered pairs of 1 's that lie in the same row. Counting by rows, we see that in the $i$ th row, there are $r_{i}$ 1's and thus $\binom{r_{i}}{2}$ pairs. Thus, $|\mathcal{R}|=\sum_{i=1}^{12}\binom{r_{i}}{2}$. Counting by columns, we note that for any two columns, there are at most 2 pairs of 1's among these columns, so $|\mathcal{R}| \leq 2\binom{n}{2}=n(n-1)$. Thus,
$$
\sum_{i=1}^{12}\binom{r_{i}}{2} \leq n(n-1) \Longrightarrow \sum_{i=1}^{12} r_{i}^{2}-\sum_{i=1}^{12} r_{i} \leq 2 n(n-1) \Longrightarrow \sum_{i=1}^{12} r_{i}^{2} \leq 2 n^{2}+4 n \text {. }
$$

By the Cauchy-Schwarz inequality,
$$
36 n^{2}=\left(\sum_{i=1}^{12} r_{i}\right)^{2} \leq 12 \sum_{i=1}^{12} r_{i}^{2}=24 n^{2}+48 n,
$$
which implies that $n \leq 4$. For $n=4$, we have the following specific sets $P_{1}, \ldots, P_{4}$ satisfying the conditions of the problem:
$$
\begin{array}{cl}
P_{1}=\{1,2,3,4,5,6\}, & P_{2}=\{1,3,7,8,11,12\} \\
P_{3}=\{2,4,7,8,9,10\}, & P_{4}=\{5,6,9,10,11,12\} .
\end{array}
$$

Hence, the maximum value of $n$ is $n=4$.