I am trying to show that if $a$ is any integer relatively prime to $n$, then $a^{\phi(n)}\equiv 1\pmod n$, where $\phi(n)$ is Euler's totient function whose value is equal to the number of numbers less than $n$ that are relatively prime to $n$.
This seems number-theoretic, but given the context, is meant to be solved with group theory. I know that the order of $U(n)$ (the group of all numbers less than and relatively prime to $n$ under multiplication) is $\phi(n)$. Therefore, for any $g \in U(n)$ we know that $g^{\phi(n)}=1$. I have been trying to use this fact in my proof. Clearly $a$ need not be in $U(n)$, but I thought perhaps if it is congruent to a member of $U(n)$ I can get the desired result. For this reason, I applied the division algorithm to write $a=nm+r$ where $m$ is some integer and $1 \le r \le n-1$, and tried to show that $r$ is relatively prime to $n$, so that $a \equiv r \mod n$. I do not know that this is the best approach, but no others have borne fruit either.
I'd really appreciate a HINT, as always, on how to prove this. Thanks.