I need to show the following:
Let $A,B \in GL(n)$ so that both of them are upper triangular matrices and $A*B^t$ or $A^t*B$ is a diagonal matrix. Show that $A$ and $B$ are diagonal matrices as well.
I tried it for small $n$ and it is kinda clear but i don't know how to prove it. I tried contraposition but it did not work well. Some help would be appreciated!