The numbers in the top row can be ordered n! ways, so the total number of latin rectangles is n! times the number of ways to construct a second row such that no conflict is implied.
There are n! total ways to arrange the elements of the second row, so there are less than n! ways that are ``good''.
I should be able to use Inclusion/Exclusion to count the number of permutations that fix 1, those that fix 2, those that fix 1 and 2, etc... and in doing so, I should be able to find out the size of the set of ``good'' permutations.
When I use Inclusion/Exclusion, I find that:
| = | ![]() |
(1) | |
| = | ![]() |
But each term contains
on the top, and hidden away in the bottom term, so they cancel out and leave
.
| = | ![]() |
(2) | |
| = | ![]() |
(3) |
But that sum is just an expansion of
1, as
,
so we have the number of ``good permutaions''
.
Then, as noted above, the total number of latin
rectangles
,
or
.