# A matrix that keeps its triangular form if multiplied by itself

Suppose that there is a set of matrices, and these matrices commute.

When matrices are multiplied, they are not triangular, but when the multiplication of matrices are multiplied with one of its matrices - that is if the multiplication is ABCD, then multiply with either A, B, C or D - it becomes triangular. (It does not matter whether the original matrices are triangular or not.)

So are there any matrices that satisfy these properties?

Edit: So, this is what I want exactly:

1) Suppose there are $n$ matrices. These $n$ matrices may be triangular or not triangular.

2) We do any $n$ multiplications - that is $ABCD....A_n$ (any combination - it might be $AC...A_n$ and so on). When there contains any two matrices that are same, it becomes triangular. Otherwise, it's not triangular.

3) The question also, is this set of matrices possible for all numbers for $n$?

-

Let $$A=B=\pmatrix{0&1&0\cr0&0&1\cr1&0&0\cr}$$ Then $A$ and $B$ commute, $AB$ is not triangular, but $A^2B$ and $AB^2$ are triangular.

It should be clear how to generalize this to allow for larger matrices, a larger number of matrices, matrices that aren't equal to each other, and so on.

EDIT: A possibly more interesting example. Let $a,b,c,d,e,f,g,h,i$ be 9 of your favorite nonzero numbers. Let $$A=\pmatrix{0&a&0&0&0\cr0&0&b&0&0\cr c&0&0&0&0\cr0&0&0&0&d\cr0&0&0&e&0\cr}$$ Let $B=fA$, $C=gA$, $D=hA$, $E=iA$. Then $A,B,C,D,E$ all commute, $ABCDE$ is not triangular, but if $F$ is any one of $A,B,C,D,E$, then $ABCDEF$ is (diagonal, a fortiori) triangular.

MORE EDIT: As to the most recent incarnation of the question, here's an example for $n=2$. Let $$A=\pmatrix{0&1&0&0\cr1&0&0&0\cr0&0&1&0\cr0&0&0&1\cr},\qquad B=\pmatrix{1&0&0&0\cr0&1&0&0\cr0&0&0&1\cr0&0&1&0\cr}$$ Then $A,B$ commute, the product $AB$ is not triangular, but $A^2$ and $B^2$ are triangular.

-
I am still not getting how to generalize this... Especially how to keep it commute. – TTTY Oct 28 '12 at 22:51
A permutation matrix is a zero-one matrix with a single 1 in each row and in each column. It commutes with all its powers, and some power of it is the identity. So, for example, there is a $5\times5$ matrix $A$ whose 6th power is the identity. 5 copies of that matrix, when multiplied, will not give a triangular matrix, but multiply by the 6th copy and you get the identity. If you want the matrices to be different, all that matters is the pattern of zeros and nonzero entries --- you can change the 1s to any nonzero numbers. – Gerry Myerson Oct 28 '12 at 22:55
But then, the problem is, for $5 \times 5$ matrix, $ABCDE = I$ where I is identity (or say, diagonal) matrix. Am I mistaken...? – TTTY Oct 29 '12 at 0:45
Yes, you are mistaken. There is, as I said, a $5\times5$ matrix whose 6th power, not its 5th power, is the identity. – Gerry Myerson Oct 29 '12 at 1:04
Then I don't understand your original question, which did not seem to ask for $AFA$ to be triangular, but only for $ABCDEA,ABCDEB,\dots,ABCDEE$ to be triangular. Perhaps you could edit your question so it says what you really wnat it to say? – Gerry Myerson Oct 29 '12 at 1:58