Let $A\in R^{n\times m}$ be a matrix over a PID $R$. Show that $A$ and its transpose $A^T$ have the same Smith normal form, meaning that the ideals $\{0_R\}\subsetneq \langle d_r \rangle \subseteq \dots \subseteq \langle d_2 \rangle \subseteq \langle d_1 \rangle$ and $r$ are the same for both matrices.
My attempt is pretty fast and "too easy" that's why I want to check if it's correct and I didn't miss anything.
Let $A \in R^{n\times m}$ and $S,T$ matrices such that $SAT=\text{diag}(d_1,...,d_r)$. Then: \begin{align*} \Rightarrow \quad A = S^{-1}\text{diag}(d_1,...,d_r)T^{-1} \end{align*} in which $S^{-1}, T^{-1}$ exist since they are invertible by definition. \begin{align*} \Rightarrow \quad A^T &= (S^{-1}\text{diag}(d_1,...,d_r)T^{-1})^T = (T^{-1})^T (\text{diag}(d_1,...,d_r))^T(S^{-1})^T \\ &=(T^{-1})^T \text{diag}(d_1,...,d_r)(S^{-1})^T \end{align*} because the transpose of a matrix with entries only on its main diagonal stays the same. So $A^T$ seems to have the same invariants $d_1,...,d_r$ as $A$.
Is this correct or am I missing something?