skip to content
← Scientific Spaces English

The Rearrangement Inequality and Its Generalizations

The rearrangement inequality is a classic inequality. It is not inherently difficult to understand, and many readers may have already encountered it during secondary school, especially those who prepared for math competitions. But the rearrangement inequality is also far from being as simple as it looks on the surface: it has a profound counterpart in the matrix realm—von Neumann's trace inequality; and it can be further generalized in the directions of "multiple sequences" and "multiple matrices".

Following this thread, this article connects these pieces together and introduces them.

Basic Form #

Suppose there are two real sequences sorted in descending order, and ; note that non-negativity constraints are not required here, and denotes any permutation of . Then the rearrangement inequality holds:

that is, "reversed product ≤ disordered product ≤ similarly ordered product". The standard way to prove the rearrangement inequality is the local adjustment method: suppose and , then

That is to say, if there is a pair of positions in the sequences that are out of order, swapping one side to make them ordered in the same direction ensures that the corresponding inner product will at least not decrease, and thus the maximum must be attained when they are completely in the same order. By repeating the same procedure on and , one can obtain the lower bound.

Note that the rearrangement inequality itself does not require the sequences to be non-negative, but later when we generalize it, we will add non-negativity constraints. It is worth pointing out that adding non-negativity constraints does not alter the coverage of the current rearrangement inequality, because any finite real sequence can be made non-negative by adding a sufficiently large constant without changing its ordering, and expanding both sides recovers the rearrangement inequality without non-negativity constraints.

Trace Inequality #

The rearrangement inequality has a very important counterpart in matrices: let be two real symmetric matrices, and let denote the -th eigenvalue sorted in descending order. Then the inequality holds:

Evidently, when are diagonal matrices, this is equivalent to the rearrangement inequality in the previous section. Thus, this is its matrix generalization, known as "Von Neumann's Trace Inequality" or "Ky Fan's Trace Inequality", and referred to simply as the "trace inequality" throughout this article.

When are general real matrices, the inequality holds:

denotes the -th singular value sorted in descending order. The trace inequality has widespread applications across mathematics and physics; for example, in deriving the Muon optimizer, knowing this inequality significantly reduces the proof difficulty. The general version of the inequality can be converted into the symmetric version via the Jordan–Wielandt symmetrization trick by constructing

, so we only need to focus on proving the symmetric version.

Orthogonal Optimization #

In this section, we prove the symmetric version . Without loss of generality, we can assume is a diagonal matrix; if not, it can be eigendecomposed as , after which we use , where is a diagonal matrix, and the eigenvalues of match those of .

There are many ways to prove von Neumann's trace inequality; here we consider a rather distinctive proof that is closer to von Neumann's original ideas. Introducing an orthogonal matrix , we clearly have

Next, we will show that, for , the maximum and minimum are precisely our desired upper and lower bounds. First consider the maximum, and suppose the maximum value is . Note that for any skew-symmetric matrix , the matrix exponential is always orthogonal. Consider the perturbation . By the assumption that is optimal, the derivative at should be . Direct calculation gives

where is usually called the commutator. In the simplification, we also used the skew-symmetry of . Substituting , setting it to zero, and using the arbitrariness of , we know that , that is, and commute. The same line of reasoning holds for the minimum.

Note that is a diagonal matrix. Further assume that the diagonal elements are pairwise distinct (if not, it can always be represented as the limit of a sequence of matrices satisfying this condition); then the only matrices that commute with are also diagonal matrices, so must be the eigenmatrix of , or in other words, must be the diagonalization of . Thus the problem reduces to the upper and lower bounds on the inner product of the eigenvalue vectors of the two matrices, which follows immediately from the rearrangement inequality.

Multiple Sequences #

A very natural question is: can the rearrangement inequality be generalized to multiple sequences? Let us take three sequences as an example, and consider non-negative sequences , and , where and denote any two permutations of . Then the maximum is still attained when they are similarly ordered:

The proof is not complicated and can be written in a single line:

The first equality uses summation by parts to perform an identity transformation (setting ); the second equality uses summation by parts to transform back; the crucial step is the inequality sign , which, under the condition , applies the rearrangement inequality to . Noting that have already been sorted from largest to smallest, is necessarily maximal, and can never exceed it no matter how they are re-paired, hence yielding this inequality.

This proof and result can be generalized recursively to any number of non-negative sequences. Note that non-negativity is necessary, because " can never exceed, regardless of how they are re-paired, " is guaranteed to hold only for non-negative sequences.

Automatic Balancing #

However, the minimum side cannot be generalized as simply as the maximum side.

The reason is also intuitive: "same ordering" satisfies transitivity—the Hadamard product of two monotonically decreasing non-negative sequences is still monotonically decreasing, so we can repeatedly reuse the binary rearrangement inequality to obtain the maximum. However, "reverse ordering" is inherently defined for two sequences; for multiple sequences, it is difficult to define what "reverse order" means, and the Hadamard product of an increasing non-negative sequence and a decreasing non-negative sequence also has no fixed monotonicity.

Nevertheless, we can still gain some insights regarding the minimum from the AM-GM inequality:

The equality holds if and only if all are equal. Of course, since we only change the ordering of , it is difficult to fulfill the condition that all are equal, but this gives us a qualitative direction: the permutation corresponding to the minimum will strive to make all balanced.

Experienced readers might keenly realize that solving such balanced pairing problems in discrete settings is usually quite difficult. And indeed it is: it can essentially be abstracted into a three-dimensional axial assignment problem, which is known to be NP-hard. In other words, there is no general analytical solution for the minimum side of the multi-sequence rearrangement inequality; this is the intrinsic difficulty of the problem.

Multiple Matrices #

Similarly, can trace inequalities be generalized to multiple matrices? Consider three matrices , we have

The proof is also similar:

That is, we first bound it once using the bivariate trace inequality, and then still apply summation by parts, bounding, and summation by parts, where the second uses the following inequality:

This can also be seen as a generalization of Eq. , and the idea of the proof is to first convert the left-hand side into a trace, and then apply Eq. . Specifically, let the SVD of be , then

The last inequality uses as well as the fact that are orthogonal. The same induction can be continued to obtain the version for any number of matrices.

Another Generalization #

Eq. generalizes Eq. , but how can Eq. be generalized? Suppose there are positive semi-definite matrices , and consider . The maximum side is trivial, namely Eq. ; can the minimum side be similarly written in the form of ?

The answer is no. The eigenvalues of positive semi-definite matrices are always non-negative, so is also necessarily non-negative, but the trace of the product of three positive semi-definite matrices can be negative! Therefore, a minimum of this form cannot hold. Where does the problem lie? Notice that for positive semi-definite matrices , we have

This guarantees non-negativity. From this, one might guess that a reasonable generalization for three matrices may be , rather than the simpler . Unfortunately, although this expression seems more "correct", one can construct counterexamples to show that its minimum is not necessarily equal to some , so it cannot serve as a generalization of Eq. on the minimum side.

However, indeed possesses some properties similar to the minimum side of the multi-sequence rearrangement inequality; for instance, we have

Equality holds when all singular values of are equal. This also means that when achieves its minimum, all singular values of will tend to be uniformly distributed; "automatic balancing" appears once again!

Summary #

Starting from the rearrangement inequality, this article traces its main generalizations along the two lines of "matrixification" and "multi-sequencing".