Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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$?

share|cite|improve this question
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
up vote 9 down vote accepted

You find your series in the online encyclopedia of integer series.

Note that the given formulas are all recursive, sums or asymptotic results.

In particular, the generating function is related to the generating functions of derangements, permutations without fixed points.

share|cite|improve this answer
Finding this is not too hard. Calculating by had the numbers 0,1,6,90 for orders 1-4 brings it right up. – Ross Millikan Apr 25 '11 at 15:11
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. Apr 25 '11 at 15:28
Asymptotically, it is $$\frac{n!^2}{\sqrt{n\pi e}}$$ – Ross Millikan Apr 26 '11 at 12:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.