# Uniqueness of unitarily upper triangular matrix

Suppose A is a matrix in $\mathbb{C}^{n\times n}$ with n distinct eigenvalues $\lambda_1,\dots,\lambda_n$. Then by Schur's theorem, for any fixed order of $\lambda_1,\dots,\lambda_n$, we know there exists an unitary matrix $U$ s.t. $U^*AU$ is an upper triangular matrix with $\lambda_1,\dots,\lambda_n$ of required order on the diagonal. The question is is $U$ unique? If not, what freedom do we have to choose U?

I know how to solve $A$ is unitarily diagonal (not unitarily upper triangular), then $U^*AU=\,\text{diag}(\lambda_i)\iff AU=U\,\text{diag}(\lambda_i)=[\lambda_1U_1,\dots,\lambda_nU_n]$. Then ith column of $U$ must be an eigenvector of $\lambda_i$ and $|U_i|=1$. Therefore we can choose $U$ up to multiplying a diagonal matrix whose diagonal entries have norm 1. But this method seems not fit the unitarily upper triangular case.

Key fact: if $BT=TB$ and $T$ is upper triangular with distinct diagonal entries, then $B$ is upper triangular (proof below). Now, if $$UTU^*=VTV^*,$$ then $V^*UT=TV^*U$. So $V^*U$ is an upper triangular unitary. As such, it is diagonal. Thus, $V$ is of the form $DU$ with $D$ diagonal and $|D_{kk}|=1$. In other words, the situation you observed for diagonal $A$ still occurs in general (it is essential that the diagonal entries are distinct).
Proof that $TB=BT$ implies $B$ diagonal. Consider the $n,1$ entry: $$(TB)_{n1}=\sum_kT_{nk}B_{k1}=T_{nn}B_{n1},$$ while $$(BT)_{n1}=\sum_kB_{nk}T_{k1}=B_{n1}T_{11}.$$ As $T_{11}\ne T_{nn}$, we deduce that $B_{n1}=0$. Now consider the $n,2$ entry: $$(TB)_{n2}=\sum_kT_{nk}B_{k2}=T_{nn}B_{n2},$$ while $$(BT)_{n2}=\sum_kB_{nk}T_{k2}=B_{n1}T_{12}+B_{n2}T_{22}=B_{n2}T_{22}.$$ As $T_{22}\ne T_{nn}$, we get that $B_{n2}=0$. Continuing inductively, after showing that $B_{n1},\ldots,B_{nr}=0$, we have $$(TB)_{n,r+1}=\sum_kT_{nk}B_{k,r+1}=T_{nn}B_{n,r+1},$$ while $$(BT)_{n,r+1}=\sum_kB_{nk}T_{k,r+1}=\sum_{k=1}^{r+1}B_{nk}T_{k,r+1}=B_{n,r+1}T_{r+1,r+1}.$$ As $T_{r+1,r+1}\ne T_{nn}$, we get that $B_{n,r+1}=0$. Now start doing the same with the $n-1,1$ entry, then $n-1,2$, etc.