The following was a question from math.enthusiast @ https://math.stackexchange.com/questions/5011758/determinants-of-matrices-defined-by-subsets-of-a-cartesian-product , which answers the present question. Not my content; just me reposting a deleted post.
======
Let $n \geq 3$ and $S = \{1, 2, \ldots, n\}$. For any subset $T \subseteq S \times S$, define the $n \times n$ matrix $A_T = (a_{ij})$ by $a_{ij} = \max\{i,j\}$ if $(i,j) \in T$ and $a_{ij} = \min\{i,j\}$ if $(i,j) \notin T$. Show that $\sum_{T \subseteq S \times S} \det(A_T) = 0$.
My attempt (I would appreciated any help in finding the correct solution):
On the diagonal, we have $a_{ii} = \min(i,i) = \max(i,i) = i$. Thus the diagonal entries do not depend on $T$; they are always fixed at $a_{ii} = i$.
For off-diagonal entries with $i \neq j$:
$$
\min(i,j) + \max(i,j) = i + j.
$$
Specifically, if $i < j$, then $\min(i,j) = i$ and $\max(i,j) = j$. If $i > j$, $\min(i,j) = j$ and $\max(i,j) = i$.
Consider the determinant expansion via permutations. The determinant of $A_T$ is
$$
\det(A_T) = \sum_{\sigma \in S_n} \text{sgn}(\sigma) \prod_{i=1}^n a_{i,\sigma(i)}.
$$
When we sum over all subsets $T$, each entry $a_{i,j}$ will take on both $\min(i,j)$ and $\max(i,j)$ in half of the summands (since we are choosing all subsets $T$ of $S\times S$).
More precisely, summing over all $T$ means for each pair $(i,j)$, $(i,j)$ is either in $T$ or not, giving two choices. Thus, each off-diagonal position is chosen to be $\min(i,j)$ or $\max(i,j)$ equally often, and all combinations appear.
Fix a permutation $\sigma \in S_n$. Consider the product $\prod_{i=1}^n a_{i,\sigma(i)}$. As we sum over all $T$, the choice for each $(i,\sigma(i))$ can be either $\min(i,\sigma(i))$ or $\max(i,\sigma(i))$. Thus for the specific set of positions $\{(i,\sigma(i)) : 1 \leq i \leq n\}$, as we vary $T$, these entries independently can be min or max.
The number of all subsets $T$ is $2^{n^2}$. Of these, $2^{n^2-n}$ combinations fix the entries outside the $\sigma$-chosen positions. Since the product $\prod_{i} a_{i,\sigma(i)}$ does not depend on the choices of entries not in $\{(i,\sigma(i))\}$, those outside choices contribute a factor of $2^{n^2-n}$.
Now, focus on the entries $(i,\sigma(i))$:
$$
\sum_{\text{min/max choices on } (i,\sigma(i))} \prod_{i=1}^n a_{i,\sigma(i)} = \prod_{i=1}^n (\min(i,\sigma(i)) + \max(i,\sigma(i))).
$$
Since $\min(i,\sigma(i)) + \max(i,\sigma(i)) = i + \sigma(i)$, we get
$$
\prod_{i=1}^n (i + \sigma(i)).
$$
Including the factor from the outside choices:
$$
\sum_{T} \prod_{i=1}^n a_{i,\sigma(i)} = 2^{n^2-n} \prod_{i=1}^n (i + \sigma(i)).
$$
Thus,
$$
\sum_{T} \det(A_T) = \sum_{T} \sum_{\sigma \in S_n} \text{sgn}(\sigma) \prod_{i} a_{i,\sigma(i)}.
$$
Interchange the sums:
$$
\sum_{T} \det(A_T) = \sum_{\sigma \in S_n} \text{sgn}(\sigma) \left(\sum_{T} \prod_{i=1}^n a_{i,\sigma(i)}\right).
$$
$$
\sum_{T} \det(A_T) = \sum_{\sigma \in S_n} \text{sgn}(\sigma) \left( 2^{n^2-n} \prod_{i=1}^n (i + \sigma(i)) \right).
$$
Factor out $2^{n^2-n}$:
$$
\sum_{T} \det(A_T) = 2^{n^2-n} \sum_{\sigma \in S_n} \text{sgn}(\sigma) \prod_{i=1}^n (i + \sigma(i)).
$$
Recognize that $\sum_{\sigma} \text{sgn}(\sigma)\prod_{i}(i+\sigma(i))$ is the determinant of the $n \times n$ matrix $C = (c_{ij})$ with $ c_{ij} = i + j $.
Consider $ C = (i+j)_{1 \leq i,j \leq n} $. This matrix is of rank at most 2 because each entry can be written as $i+j$, which decomposes as $(1,2,\ldots,n)^T + (1,2,\ldots,n)$ essentially forming a sum of a column vector plus a row vector. Concretely, the space spanned by the rows (or columns) is at most 2-dimensional. For $n \geq 3$, a rank $\leq 2$ matrix cannot be full rank, hence $\det(C) = 0$.
Since $\det(C) = 0$ for $n \geq 3$, we have
$$
\sum_{T} \det(A_T) = 2^{n^2-n} \cdot \det(C) = 2^{n^2-n} \cdot 0 = 0.
$$
Thus, for $n \geq 3$,
$$
\sum_{T \subseteq S \times S} \det(A_T) = 0.
$$