In Mathematica there is a very convenient function called JordanDecomposition[]. It takes a square matrix A as an argument and either diagonalizes it, or puts it into a block diagonal form A' and provides the transformation matrix s (such that A can be recovered by A=s.A'.Inverse[s]).

I was looking for a similar function which would anti-diagonalize the matrix A instead of diagonalizing it (see http://en.wikipedia.org/wiki/Anti-diagonal_matrix) and would also return a corresponding transformation matrix s. Is there such a function in Mathematica? Or maybe one can implement it? Thanks for any suggestion!


Some comments below suggest for me to better specify what I want to achieve. Let us look at an example:

A = DiagonalMatrix[{1, 2, 3}];
B = Table[Subscript[b, i, j], {i, 1, 3}, {j, 1, 3}];
Bi = Inverse[B] // Simplify;
vars = Flatten[B];
sol = FindInstance[{(Bi.A.B)[[1, 1]]==0,(Bi.A.B)[[2, 1]]==0,(Bi.A.B)[[3, 2]]==0,(Bi.A.B)[[3, 3]]==0,Det[B]==1},vars][[1]];

Note how the condition Det[B]==1 enforces the sought after transformation to be determinant preserving. The result I get is:

Bi.A.B /. sol // MatrixForm

$$ \left( \begin{array}{ccc} 0 & -\frac{5}{2} & -11 \\ 0 & 6 & 24 \\ 1 & 0 & 0 \end{array} \right) $$

As you can see, the transformation by an explicitly found B has put originally diagonal matrix A into a block anti-diagonal form. By inspection you can convince yourself that trying to get Bi.A.B to be even more anti-diagonal by introducing more constraints in FindInstance[...] will not yield any solution any more. This suggests that a block anti-diagonal form of the type found above is the best we can do for the matrix A. It is certainly true that if A was the unit matrix, it would already automatically be in its best block anti-diagonal form. However, having one such special example does not render the question invalid for other more general classes of matrices. Basically, I am looking for a solution that robustly automates the above procedure done "by hand" for matrices of arbitrary dimension and returns the transformation matrix B for a best-possible anti-diagonalisation of A.

  • 3
    $\begingroup$ I'm voting to close this question as off-topic because it seems to be based on a mathematical misconception. $\endgroup$ – Jens Mar 22 '15 at 5:55
  • $\begingroup$ It would be OK to keep this open if a more detailed explanation of the necessary mathematical background or goals were provided, since Mathematica doesn't seem to have this functionality. $\endgroup$ – Jens Mar 22 '15 at 6:12
  • $\begingroup$ @Jens As you suggested, I have added an example to the question, outlining what exactly I would like to achieve. Hope this adds more substantiality to my question! $\endgroup$ – Kagaratsch Mar 22 '15 at 14:41
  • $\begingroup$ One would first have to investigate what constitutes a "best anti-diagonal form" as stated in the question. Then one would have to check whether it is unique in some sense to be defined. Without that knowledge, it's not at the level of a Mathematica question, but a math question. $\endgroup$ – Jens Mar 22 '15 at 16:19
  • $\begingroup$ I tried to imply that "best anti-diagonal form" is supposed to be defined as one with smallest possible blocks on the anti-diagonal. It is quite straightforward to see that this form will not be unique in general. If we substitute the FindInstance[] function above by Reduce[] we will see that there exists a whole class of matrices B with adjustable elements. I do not think there is anything profound left to investigate mathematically, since I am looking for just a solution and not "the" special solution. What is left to be found is an implementation. That is why I ask the question here. $\endgroup$ – Kagaratsch Mar 22 '15 at 16:44

The answer is that it's mathematically impossible to do what you ask in a general setting. As a counter-example, consider how you would bring the 3-dimensional unit matrix into anti-diagonal form. It would require a permutation with signature

Signature[{3, 2, 1}]

(* ==> -1 *)

so that the determinant of the anti-diagonal matrix has the opposite sign as the original matrix. But you're looking for a similarity transformation between the two. Since similarity transformations don't change the determinant, there exists no such transformation.

  • $\begingroup$ Please note that I am not demanding full anti-diagonalizability, but am looking for a block anti-diagonal form. Just as block-diagonal forms do exist for non-invertible matrices, the unit matrix will have a block anti-diagonal form. $\endgroup$ – Kagaratsch Mar 22 '15 at 4:22
  • $\begingroup$ No, the unit matrix will never have a block-anti-diagonal form that can be achieved by a similarity transformation. For other matrices, my determinant argument is one way of disproving the claim. $\endgroup$ – Jens Mar 22 '15 at 5:54
  • $\begingroup$ Of course, one could say that any matrix is itself block-anti-diagonal if we allow the single block to be the entire matrix. So I guess what I'm saying is that the problem isn't well-defined. $\endgroup$ – Jens Mar 22 '15 at 6:14

Reverse each row:

B = Reverse/@ A
  • $\begingroup$ Could you elaborate on what reversing each row should accomplish? I defined B = Reverse/@ A as you suggested and played around with the results of JordanDecomposition[B]. For example, I tried applying the resulting transformation matrix to A, but it did not seem to yield an anti-diagonalized matrix. $\endgroup$ – Kagaratsch Mar 22 '15 at 1:33
  • $\begingroup$ Reversing each row means moving terms on the right to terms on the left. It is in effect a reflection with respect to a vertical line through the center of the matrix. This transformation thus takes a diagonal matrix into an anti-diagonal one. Try it on a diagonal matrix to see. $\endgroup$ – David G. Stork Mar 22 '15 at 9:09
  • $\begingroup$ Oh! I see what you mean. Unfortunately that is not what I am looking for, since this operation of reflection is not a smooth transformation. In particular I am looking for transformations which preserve the determinant of the matrix A but still put it into block anti-diagonal form. $\endgroup$ – Kagaratsch Mar 22 '15 at 14:52
  • $\begingroup$ @Kagaratsch Can you give a simple $4 \times 4$ example of what you seek, just to show that it is mathematically possible? (I'm not sure it is.) $\endgroup$ – David G. Stork Mar 22 '15 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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