0
$\begingroup$

Background

Somebody asked a question on the Chinese Q&A website ZhiHu(知乎), which roughly translates to the following: given an $n\times n$ matrix $M$ consisting of $n^2$ distinct real numbers, consider the two ways of shuffling its elements:

1). First, apply an intra-row shuffle $\mathcal R$ (which means shuffling the elements within each row for all rows), and then apply an intra-column shuffle $\mathcal C$ (defined similarly) . We get a random matrix $\mathcal C(\mathcal R(M))$.

2). Directly apply an elementwise full shuffle $\mathcal E$ (which means embedding $M$ as a vector in $\Bbb R^{n^2}$ and then shuffling its entries).

The original question is: Does $\mathcal C(\mathcal R(M))$ equal $\mathcal E(M)$ in distribution?

The answer is no. And there are more than one ways to prove it, the quickest perhaps being direct counting: $\mathcal C(\mathcal R(M))$ yields at most $(n!)^{2n}$ outcomes, but $\mathcal E(M)$ yields exactly $(n^2)!$ outcomes. A not-so-difficult analysis using Stirling approximation shows $(n^2)! > (n!)^{2n}$ for all $n\ge 2$. (See this anwer (in Chinese) for example).

The Question

What if we continue to apply additional layers of $\mathcal C$'s and $\mathcal R$'s on $M$? Would the resulting matrix be sufficiently "stochastic" and hence possibly equal $\mathcal E(M)$ in distribution? For example, Does $\mathcal R(\mathcal C(\mathcal R(M)))$ (or $\mathcal C(\mathcal R(\mathcal C(\mathcal R(M))))$ and so on, suppose we can apply more layers if necessary) equal $\mathcal E(M)$ in distribution? Or, at least, can these additional layers of operation span the entirety of outcomes of $\mathcal E(M)$?

My Thought

Counting might still help but is perceivably much more difficult. Because $(n!)^{kn} \gg (n^2)! $ for $k \ge 3$ already, we cannot simply chain-multiply the number of outcomes of each operation. Surely we will have to eliminate a lot of duplicated outcomes to achieve a reasonable estimate of the number of outcomes after multiple $\mathcal C,\mathcal R$. But removing multiplicities itself doesn't seem that easy.

Another possible way to disprove this guess is to use some other algebraic or analytical features of a square matrix. The observation is that, if $X=Y$ in distribution as random vectors, then $f(X)=f(Y)$ must also equal in distribution where $f$ can be a more or less arbitrary function, such as $\det$ or $\text{rank}$ or $\sum_i\lambda_i$ etc. The most difficult part is clearly finding a suitable $f$ which is somehow tractable under operations $\mathcal C,\mathcal R$ (unfortunately $\det$ doesn't fall under this category...), then spot a discrepancy between the distribution $f(\mathcal R(\mathcal C(\mathcal R(M))))$ and $f(M)$.

$\endgroup$

1 Answer 1

0
$\begingroup$

With the aid of AI, I think I'm now able to answer my own questions. Feel free to comment.

1). Does there exist a chain of $\mathcal C,\mathcal R$ that spans $\mathcal E$? Yes. For any given square matrix $M$, if the chain $\mathcal L$ of $\mathcal C,\mathcal R$ compositions goes long enough, $\mathcal L$ will always span the full image of $\mathcal E$.

(Update: thanks to @bof's answer, it is proven that only $3$ layers of operations are needed for any $n$, i.e. $\mathcal C(\mathcal R(\mathcal C(M)))$ can generate all possible outcomes of $\mathcal E(M)$.)

Proof: for a swap between elements $(i,j)$ and $(k,l)$, the only non-trivial case happens when $i\ne k$ and $j\ne l$ (otherwise the swap is already included in either $\mathcal C$ or $\mathcal R$.) Define $r_{i}(j_1,j_2)\in\mathcal R$ as the swap of $(i,j_1)$ and $(i,j_2)$. Similarly define $c_{j}(i_1,i_2)\in\mathcal C$. Then the swap of $(i,j)$ and $(k,l)$ is just a chain of three such actions $$r_i(j,l)\to c_l(i,k)\to r_i(j,l)$$ Therefore any specific full elementwise shuffle $e$ can be decomposed into a finite chain of intra-row and intra-column operations.

2). Can such a $k$-chain $\mathcal L$ equal $\mathcal E$ in distribution? Never.

Proof: $\mathcal L$ is a chain of operations sampled from a Cartesian product arising from $k$ sets of intra-row and intra-column operations. Define a function $f$ that maps a specific $k$-chain $l\in\mathcal L$ to an element $e\in\mathcal E\sim S_{n^2}$ (where $S$ is the symmetry group) such that $l(M)=e(M)$. Since $\mathcal E$ is a uniform distribution on $S_{n^2}$, it is required that $$\#(f^{-1}(e_1))=\#(f^{-1}(e_2)),\quad \forall e_1,e_2\in\mathcal E$$ which further requires $\#(S_{n^2})$ divides the size of $\mathcal L$'s sample space, or equivalently $(n^2)!$ divides $(n!)^{nk}$. But the divisibility doesn't hold, due to Bertrand's postulate, by which there must exist at least one prime factor of $(n^2)!$ that doesn't divide $n!$.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.