Find the number of $n\times n$ matrices whose entries are each 1 or -1 be such that the sum of the entries in each row and in each column is 0. ($n$ is given even)
I attempted this question in a way similar to an existing similar question about multiplication - Number of ways of filling $n \times n$ binary matrix.
I tried a similar approach here. Fill the upper-left $(n-1)\times(n-1)$ matrix with 1 or -1 arbitrarily. But the problem here is that if a single row gets filled with more than $n/2$ $1$s, then it's impossible to put the sum zero for that row. Similar is the problem with the column.
So, I could instead start at a $(n-2)\times(n-2)$ matrix, but again, I'm not quite sure how that evades the problem.
So, what is the logic for the better method?
Important note: the original question had $n=4$, but I have attempted to post a generalized question here. Hopefully, that does not make the answer too complex. If it does, please post a solution for $4\times4$ instead. Though, I'll still be more than happy to reward an answer with a bounty, if they are able to solve the general $n\times n$ case.
I attempted to count by hand for $4\times4$ matrices, hopefully it gives the people an intuition to count the general case as well.
Let us first set two $1$s in the first row in $^4C_2$ ways. The second row has three cases of placing 1s:
- both 1s below the first 1s - in only one way
- one 1 below the first one - in four ways
- neither of the 1s below the first row 1s - in only one way
Note that, in case 1, the rest of the matrix elements will be set automatically - to satisfy the property that the sum of the rows and the sum of columns is zero.
In case 2, for each way, we'll be able to fix automatically a few of the columns and rows, but four squares will be left - below the columns which have a 1 and -1 at their head. We have two more ways of placing 1s in those squares.
In case 3, only the first two rows are automatically fixed, and each columns would be similar to each other. So, wlog, choose the first column, place 1 and -1 below it in two ways. Similarly place 1 and -1 below the next one in two more ways. The remaining four squares are now automatically fixed.
This gives a total of $6\times(1\times1+4\times2+1\times2\times2)=78$ as the total number of ways. Unfortunately, this is the wrong answer. (acc my textbook) But, I've been unable to find the mistake here either.