I am reading these notes on Modules over PID.
Exercise 67 (pg 24) asks to prove that:
Problem. Let $A$ and $B$ be $n\times n$ matrices with complex entries. Then $A$ and $B$ are simultaneously diagonalizable if and only if both $A$ and $B$ are diagonalizable and $AB=BA$.
Exercise 76 (pg 25) asks to prove that:
Problem. Show that the group of units of $\mathbf Z/n\mathbf Z$ is cyclic if and only if $n$ is either $2$, or $4$, or a power of an odd prime.
I know proofs of both these problems which do not use structure theorem. But since these notes revolve around the structure theorem, I think may be these can be attacked via some interesting application of the same.
Can anybody see how the structure theorem can be used here, if at all?