What is the number of permutations of a $N \times N$ square grid where the rows of the grid contain $N$ different numbers?

47 Views Asked by At

I was trying to program a way of storing all possible permutations of a $6\times6$ grid where every row of the grid contained the numbers 1 through 6 once. I initially thought that this number was relatively small, along the lines of $6^6$ though I quickly noticed that I was very wrong. I tried to do a couple of calculations and got to the answer of $(6!)^6$ and was wondering if this was correct, and if not, what the correct answer is?

1

There are 1 best solutions below

0
On BEST ANSWER

Just to clarify, when you say

all possible permutations of a $6\times6$ grid where every row of the grid contained the numbers 1 through 6 once

do you mean all possible $6 \times 6$ grids such that each row contains the numbers $1$ through $6$ once? Using the word "permutation" makes it sound like we're moving around the entries of a preexisting grid of numbers.

If so, you're right. The idea is that there are $6!$ possibilities for each row: the first entry can be any of the numbers from 1 to 6, and the second entry can be any of the five remaining numbers, and the third entry can be any of the four remaining numbers, etc. for total number of possibilities of $6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1 = 6!$. From there, we notice that each row can be chosen independently: there are $6!$ possibilities for each row, so there are $6! \cdot 6! \cdot 6! \cdot 6! \cdot 6!\cdot 6! = (6!)^6$ total possibilities for the grid.