9

I am looking to calculate the number of $m\times n$ matrices which have no empty rows or columns (at least one $1$ in each row and column).

I have looked at the answers to a few similar questions such as 35019 and 329932 but I am struggling to make these approaches work in this case.

1 Answers1

10

Let $C$ be a fixed set of $k$ columns; we’ll count the binary matrices that have a $1$ in every row but have no $1$ in any of the columns in $C$. In each row there are $2^{n-k}-1$ ways to choose a non-empty subset of the remaining $n-k$ columns in which to place ones, and there are $m$ rows, so there are $\left(2^{n-k}-1\right)^m$ such matrices. There are $\binom{n}k$ ways to choose $C$, so a standard inclusion-exclusion calculation then shows that there are

$$\sum_{k=0}^n\binom{n}k(-1)^k\left(2^{n-k}-1\right)^m\tag{1}$$

$m\times n$ binary matrices with no zero rows or columns.

As noted in the comments, the case $m=n$ of $(1)$ is OEIS A048291; the fact that no closed form is given even for the square case suggests that no closed form is known, or at least that no nice closed form is known.

Brian M. Scott
  • 616,228
  • Your formula for C, for n = 3, m = 1, k = 1, gives 9 = 3(4-1). This over counts the actual number (6 in this case). In fact, the total number of 1 by 3 matrices (with entries from {0,1}) would be 8. – Andrew Kelley Mar 18 '16 at 17:48
  • @Andrew: What I wrote about $\binom{n}k(2^{n-k}-1)^m$ was indeed incorrect, since that expression of course counts some matrices twice, but the inclusion-exclusion argument corrects for that, and the conclusion is okay. I simply removed the incorrect (and irrelevant) assertion. Thanks for catching it. – Brian M. Scott Mar 18 '16 at 18:02