On the number of matrices and a random matrix with prescribed row and column sums and 0-1 entries
Alexander Barvinok
Introduction and main results
Matrices with 0-1 entries and prescribed row and column sums is a classical object which appears in many branches of pure and applied mathematics. In combinatorics, such matrices encode hypergraphs with prescribed degrees of vertices and related structures, see, for example, [LW01]. In algebra, certain structural constants in the ring of symmetric functions and, consequently, in the representation theory of the symmetric and general linear groups are expressed as numbers of 0-1 matrices with prescribed row and column sums, see Chapter 1 of [Ma95]. In statistics, 0-1 matrices with prescribed row and column sums are known as binary contingency tables, see [C+05].
Let be a positive integer -vector and let be a positive integer -vector such that
Let be the set of all matrices (binary contingency tables) such that
In words: is the set of 0-1 matrices with row sums and column sums . Vectors and are called margins of a matrix .
Our first main result provides an estimate of the cardinality of .
Then for the number of zero-one matrices with row sums and column sums we have
Let us estimate the ratio between the lower and the upper bounds for using Stirling’s formula
the “ ” contributions from Stirling’s formula cancel each other out and we obtain
We note that in many interesting cases we have , see also Section 3.1, in which case the estimate of Theorem 1.1 captures the logarithmic order of .
Suppose that margins are such that the set is not empty and let us consider as a finite probability space with the uniform measure. Let us pick a random matrix . What is likely to look like? This question is of some interest to statistics: a binary contingency table may represent certain statistical data (for example, may be equal to 1 or 0 depending on whether or not Darwin finches of the -th species can be found on the -th Galapagos island, as in [C+05]). One can condition on the row and column sums and ask what is special about a particular table , considering all tables in as equiprobable, see [C+05]. To answer this question we need to know what a random table looks like.
We prove that with high probability is close to a particular matrix with row sums and column sums and entries between 0 and 1, which we call the maximum entropy matrix.
For let us consider the entropy function
As is known, is a strictly concave function with .
For an matrix such that for all , we define
Assume that is non-empty. Let us consider the polytope of matrices such that
Since is strictly concave, it attains a unique maximum on , which we call the maximum entropy matrix with margins .
For example, if all are equal, then by the symmetry argument we must have where for all .
The following observation characterizes the maximum entropy matrix as the solution to the problem that is convex dual to the optimization problem of Theorem 1.1.
The condition that the polytope has a non-empty interior is equivalent to the requirement that for every choice of and there is a matrix , , such that and there is a matrix , , such that . One can take to be the average of all matrices . In other words, we require the set to be reasonably large. We also observe that if for all (recall that is the total sum of the matrix entries) one can choose .
We prove that with high probability a random matrix is close to the maximum entropy matrix as far as sums over subsets of entries are concerned.
and an matrix , let us denote
the sum of the entries of indexed by .
In what follows, we are interested in the case of the density separated from 0. Without loss of generality, we assume that .
Let us fix numbers and . Then there exists a number such that the following holds.
Let be margins such that and the polytope has a non-empty interior, and let be the maximum entropy matrix. Let S\subset\bigl{\{}(i,j):\quad i=1,\ldots,m,\ j=1,\ldots,n\bigr{\}} be a subset such that and let
The following interpretation of the maximum entropy matrix was suggested to the author by J.A. Hartigan, see [BH09].
Let be the maximum entropy matrix with margins and let us suppose that the polytope has a non-empty interior. Let be the random matrix of independent Bernoulli random variables such that
The distribution of the random matrix in Theorem 1.5 can be characterized as the maximum entropy distribution in the class consisting of all probability distributions on the set of matrices with 0-1 entries whose expectations lie in the affine subspace consisting of the matrices with row sums and column sums , see [BH09].
Extensions and ramifications
Our results hold in a somewhat greater generality. Let us fix an non-negative matrix , which we call the matrix of weights. Let us consider the following partition function
In particular, if for all then . If then the partition function counts binary contingency tables with zeros assigned to some positions: the value of is equal to the number of matrices such that the row sums of are , the column sums of are , for all , and, additionally, if . In combinatorial terms, the set can be interpreted as the set of all subgraphs with prescribed degrees of vertices of a given bipartite graph. Binary contingency tables with preassigned zeros are of interest in statistics, see [C+05].
Then for the partition function we have
Let us assume now that for all and let us consider the set of all binary contingency tables with the additional constraint that if . Assuming that is not empty, we consider this set as a finite probability space with the uniform measure. We call matrix the pattern. We are interested in what a random table looks like. We define the maximum entropy matrix as before.
Suppose that the set is non-empty. Let us consider the polytope of matrices such that
Thus is a face of polytope of Section 1.2.
Let be the entropy function of Section 1.2. Since is strictly concave, it attains a unique maximum on polytope , which we call the maximum entropy matrix with margins and pattern .
For to have a non-empty interior is equivalent to the requirement that for every pair such that there is a matrix , , such that and there is a matrix , , such that . In other words, we require the set to be reasonably large.
We prove an analogue of Theorem 1.4. We consider subsets
As before, we denote by the sum of the entries of a matrix indexed by the subset .
Let us fix numbers and . Then there exists a number such that the following holds.
Let be margins such that and the polytope has a non-empty interior, and let be the maximum entropy matrix. Let S\subset\bigl{\{}(i,j):\quad w_{ij}=1\bigr{\}} be a subset such that and let
The statement of the theorem is, of course, vacuous unless pattern contains ones.
Suppose that the polytope has a non-empty interior and let be the maximum entropy matrix. Let be the random matrix of independent Bernoulli random variables such that
Comparisons with the literature
There is a vast literature on 0-1 matrices with prescribed row and column sums and with or without zeros in prescribed positions, see for example, Chapter 16 of [LW01], [Ne69], [Be74], [GC77], recent [CM05], [G+06], [C+08], [GM09] and references therein. A simple and efficient criterion for the existence of a 0-1 matrix with prescribed row and column sums is given by the classical Gale-Ryser Theorem; in the case of enforced zeros, the question reduces to the existence of a network flow, see for example, Chapter 16 of [LW01]. Estimating the number of such matrices also attracted a lot of attention. Precise asymptotic formulas for the number of matrices were obtained in sparse cases for which and [Ne69], [Be74], [G+06], the regular case of all row sums equal and all column sums equal [C+08] and cases close to regular [C+08], [GM09]. Formulas of Theorems 1.1 and 2.1 are not so precise but they are applicable to a wide class of margins and they uncover some interesting features of the numbers and .
The following construction provides some insight into the combinatorial interpretation of the number from Theorem 1.1.
Let us fix some margins for which the set is not empty, and, moreover, the polytope contains an interior point, so the conditions of Lemma 1.3 are satisfied. Let and . For a positive integer , let us define the -vector
In other words, we obtain margins if we choose a matrix and then create a new block matrix by arranging copies of into a matrix. Then is the vector of row sums of and is the vector of column sums of . Clearly, the conditions of Lemma 1.3 are satisfied for .
Indeed, the infimum is attained at a certain point
It is not hard to see that the infimum is attained at
(3.2) Asymptotic repulsion in the space of matrices
A natural candidate for an approximation of is the “independence estimate”
The intuitive meaning of (3.2.1) is as follows. Let us consider the set of all matrices with 0-1 entries and with the total sum of entries equal to as a finite probability space with the uniform measure. Let us consider the two events in this space: the event consisting of the matrices with row sums and the event consisting of the matrices with column sums . One can see that
Thus the value of (3.2.1) equals if the events and are independent. It turns out that (3.2.1) indeed approximates reasonably well in the sparse and near-unform cases, see [G+06] and [C+08].
However, for generic and , the independence estimate overestimates by a factor. To see why, let us fix some margins and such that not all row sums are equal and not all column sums are equal and the conditions of Lemma 1.3 are satisfied. Let us consider the cloned margins and as in Section 3.1.
where is the entropy function, see Section 1.2. To compare (3.2.2) and (3.1.1) we use Lemma 1.3 and the multivariate entropy function
On the other hand, applying Lemma 1.3, we can rewrite (3.1.1) as
where is the maximum entropy matrix for margins .
We now use some classical entropy inequalities, see, for example, [Kh57]. Namely, by the inequality relating the entropies of two partitions of a probability space and the entropy of their intersection, we have
However, if we have both (3.2.3) and (3.2.4), we must have , so unless all row sums are equal or all column sums are equal, we have
Therefore, as grows, the independence estimate (3.2.1) overestimates the number of 0-1 matrices with row sums and column sums by a factor of . In probabilistic terms, as grows, the event consisting of the 0-1 matrices with row sums and the event consisting of the 0-1 matrices with column sums repel each other (the events are negatively correlated) instead of being asymptotically independent.
The procedure of cloning described in Section 3.1 produces margins of increasing size with the following features: the density remains separated from 0 and 1, and if the margins were non-uniform initially, they stay away from uniform. One can show that for more general sequences of margins that share these two features, we have the asymptotic repulsion of the event consisting of the 0-1 matrices with prescribed row sums and the event consisting of the 0-1 matrices with prescribed column sums. This is in contrast to the case of contingency tables (non-negative integer matrices with prescribed row and column sums), where we have the asymptotic attraction of the events [Ba09].
(3.3) Randomized counting and sampling
Jerrum, Sinclair, and Vigoda [J+04] showed how to apply their algorithm for computing the permanent of a non-negative matrix to construct a fully polynomial randomized approximation scheme (FPRAS) to compute and, more generally, , where is a 0-1 pattern, see also [B+07]. Furthermore, they obtained a polynomial time algorithm for sampling a random and from a “nearly uniform” distribution. This problem arises naturally in statistics, see, for example, [C+05]. The estimates of Theorem 1.1 and Theorem 2.1 are not nearly as precise as those of [J+04], but they are deterministic, easily computable, and amenable to analysis. Similarly, we do not provide a sampling algorithm but show instead in Theorems 1.4 and 2.4 what a random matrix is likely to look like.
(3.4) An open question
Theorem 1.5 allows us to interpret Theorem 1.4 as a law of large numbers for binary contingency tables: with respect to sums for sufficiently “heavy” sets of indices, a random binary contingency table behaves approximately as the matrix of independent Bernoulli random variables whose expectation is the maximum entropy matrix . Similar concentration results can be obtained for other well-behaved functions on binary contingency tables. One can ask whether the distribution of a particular entry of a random table converges in distribution to the Bernoulli distribution with expectation as the dimensions and of the table grow in some regular way, for example, when the margins are cloned as in Section 3.1.
Our approach, based on estimating combinatorial quantities via solutions to optimization problems, reminds one of that of Gurvits [Gu08]. The appearance of entropy in combinatorial counting problems reminds one of recent papers of Cuckler and Kahn [CK09a], [CK09b], although methods and results seem to be quite different.
In the rest of the paper, we prove the results stated in Sections 1 and 2.
Preliminaries: permanents and scaling
Let be an matrix. The permanent of is defined by the expression
where is the symmetric group of all permutations of the set . The relevance of permanents to us is that both values of and can be expressed as permanents of matrices. This result is not new, for it was observed, for example, in [JS90]. For , where is a 0-1 pattern, a construction is presented in [J+04]. We give a general construction for , where is an arbitrary matrix, which is slightly different from that of [J+04].
Let us choose margins , and an matrix of weights. Let us construct an matrix as follows.
The rows of are split into disjoint blocks having rows respectively (blocks of type I)
blocks having rows respectively (blocks of type II). The columns of are split into disjoint blocks of columns in each. For the entry of that lies in a row from the -th block of rows of type I and in a column from the -th block of columns is equal to 1.
For and the entry of that lies in a row from the -th block of rows of type II and the -th column from the -th block of columns is equal to .
First, we express as a coefficient in a certain polynomial. Let be formal variables and let
be the elementary symmetric polynomial of degree . Thus is
Summarizing, we conclude that is
To express the last coefficient as the permanent of a matrix, we use a convenient scalar product in the space of polynomials, see, for example, [Ba96] and [Ba07]. Namely, for monomials
Then, for polynomials and we have
where is the complex conjugate of , see for example, Section 4 of [Ba07].
The convenient property of the scalar product is that if
where is the matrix defined by
see Lemma 4.5 of [Ba07] or, for a more general identity, Theorem 3.8 of [Gu04]. Thus we may write
Let be an matrix. Matrix is called doubly stochastic if
The classical bound conjectured by van der Waerden and proved by Falikman and Egorychev, see Chapter 12 of [LW01] and also [Gu08] for exciting new developments, states that
Linial, Samorodnitsky, and Wigderson [L+00] introduced the following very useful scaling method of approximating permanents of non-negative matrices. Given a non-negative matrix one finds non-negative numbers and and a doubly stochastic matrix such that
and an estimate of (such as the van der Waerden estimate) implies an estimate of . If is strictly positive, such doubly stochastic matrix and scaling factors , always exist. In our situation, matrix constructed in Lemma 4.1 is only non-negative. We will not always be able to scale it to a doubly stochastic matrix exactly, but we will scale it approximately.
We restate a weaker form of Proposition 5.1 from [L+00] regarding almost doubly stochastic matrices.
For any there exists an and a function , , such that
and for any non-negative matrix such that
for some , we have
From [L+00], one can choose and .
Proofs of Theorems 1.1 and 2.1
We prove Theorem 2.1 only since Theorem 1.1 is a particular case of Theorem 2.1. We start with a straightforward observation.
and the sum is taken over all margins .
Let be an non-negative matrix such that
follows from Lemma 5.1. Let us prove the lower bound.
If then and the lower bound follows. Hence we assume that .
For we multiply every row of in the -th block of type II by
For and we multiply the -th column in the -th block of columns of by
Finally, we claim that is close to a doubly stochastic matrix. Indeed, For and the entry of that lies in a row from the -th block of rows of type I and in the -th column from the -th block of columns is equal to
For and the entry of that lies in a row from the -th block of rows of type II and the -th column from the -th block of columns is equal to
All other entries of are 0s. Let us compute the row sums of .
For a row in the -th block of rows of type I the sum equals
by the inequalities of Lemma 5.2, we have
For a row in the -th block of rows of type II the sum equals
By the inequalities of Lemma 5.2, we have
Let us compute the column sums of .
For the -th column from the -th block of columns the sum equals
Clearly, is non-negative and hence by Lemma 4.3, we have
The proof now follows by (5.3.1) as . ∎
Proofs of Lemmas 1.3 and 2.3
We prove Lemma 2.3 only since Lemma 1.3 is a particular case of Lemma 2.3.
Since , the value of the derivative at is (we consider the right derivative there), the value of the derivative at is (we consider the left derivative there) and the value of the derivative is finite for any . Suppose that for the maximum entropy matrix we have for some such that . If , , is a matrix such that whenever then
which contradicts to the choice of . Hence
Therefore, the gradient of at is orthogonal to the affine subspace of matrices having row sums , column sums , and such that whenever . Hence
and some and . Hence
and when , we obtain a matrix . Moreover, the gradient of at satisfies (6.1) with and , so is the maximum entropy matrix.
Proofs of Theorems 1.5 and 2.5
We prove Theorem 2.5 only, since Theorem 1.5 is a particular case of Theorem 2.5.
and some and . Then, for all such that and any , we have
Consequently, for any , , we have
Proofs of Theorems 1.4 and 2.4
We prove Theorem 2.4 only since Theorem 1.4 is a particular case of Theorem 2.4.
We will use standard large deviation inequalities for bounded random variables, see, for example, Corollary 5.2 of [Mc89].
By Theorem 2.5, Lemma 2.3 and Theorem 2.1, we get
Combining (8.2.1)–(8.2.3), we conclude that for any and all sufficiently large we have
Acknowledgment
I am grateful to Alex Samorodnitsky for emphasizing the importance of matrix scaling in permanent computations during many enlightening conversations. I benefitted from conversations with Catherine Greenhill about asymptotic enumeration during the 2008 Schloss Dagstuhl meeting on design and analysis of randomized and approximation algorithms. After the first version of this paper was written, John Hartigan pointed out to connections with the maximum entropy principle and suggested Theorem 1.5 to me (cf. [BH09]), which led to a substantial simplification of the original proof and some strengthening of Theorems 1.4 and 2.4.