# Number of $(0,1)-$matrices with exactly two $1$'s in each row and column

Consider a matrix $A$ of size $n\times n$. I want to fill it with one and zero such that there are exactly two entries one in each row and each column, and the other entries are zero.
In how many different ways I can fill $A$?

• I don't see much relation to matrices or permutations here. It's mostly combinatorics, ways to order things under certain constraints. – Asaf Karagila Apr 25 '11 at 14:15
• Well, I can see a relation to matrices and permutations and I do not see the utility of removing the tags. – Phira Apr 25 '11 at 14:40
• @user9325: You can always put them back, but in case you do - please elaborate why. – Asaf Karagila Apr 25 '11 at 14:43
• @Asaf I think that the onus is on you to justify why you took them away instead of asking me to elaborate. The number is related to derangements, the matrices are matrices that are a direct generalization of permutation matrices, the column number in each row can be chained together to form a fixed-point free permutation and I find it highly ironic to say that you do not see the relation to permutations because it is only about the ways to order things. – Phira Apr 25 '11 at 14:55
• There is also the question what tags are good for. I think that "permutation" and "matrix" is exactly what comes to mind if one tries to find this question. (I certainly do not disagree with the tag combinatorics.) – Phira Apr 25 '11 at 14:57

• I'll just note the closed form $n(n-1)\frac{(2n-2)!}{2^{2n-2}}{}_1 F_1\left(2-n;\frac32-n;-\frac12\right)$ listed in the OEIS. – J. M. is a poor mathematician Apr 25 '11 at 15:28
• Asymptotically, it is $$\frac{n!^2}{\sqrt{n\pi e}}$$ – Ross Millikan Apr 26 '11 at 12:52