Suppose we have to form a matrix as follows:
$4 \times 4$ matrix formed using only $1$ and $-1$ as elements such that sum of all elements in any row and column is $0$.
I wanted to know how many such matrices are possible?
As sum of all elements of each column and row is $0$ each row and column must contain exactly to two $1$'s and two $-1$'s. There are $6$ different ways to permute two $1$'s and two $-1$'s in a line. Thus if we start with the 1st row there are six ways to fill it. In the $6$ ways to fill $3$ start with $1$ and other $3$ with $-1$. Now if we want to fill the first column the first element is already decided due to the filling of 1st row. So there are $3$ ways to fill the first column.
I cannot go beyond this please give me some suggestions as to how I should proceed further.
The first two rows are independent, so there are 36 ways to fill them. Similarly the last two rows. So the question is how many of the $36^2$ combinations of top half and bottom half are valid. If you cluster pairs of rows by the number of ones in each column they fall into 19 equivalence classes. Each equivalence class for the top half is compatible with one equivalence class for the bottom half.
We can further cluster the equivalence classes: