Let $f:\mathbb{Z}_n\rightarrow \mathbb{Z}_n$ a group homomorphism. Prove $f\in\text{Aut}(\mathbb{Z}_n)\Longleftrightarrow f([1]_n)\in \mathcal{U}(\mathbb{Z}_n)$ $\mathcal{U}(\mathbb{Z})_n:=\{[a]_m\in\mathbb{Z}_m|\gcd(a,m)=1\}$
My proof
$\Rightarrow$
$\forall [x]\in \mathbb{Z}_n $ $$f([x])=f(x[1])=xf([1])$$
So can I say $f([1])$ is a generator and then $f([1])\in\mathcal{U}(\mathbb{Z}_n)$ ?
$\Leftarrow $
$f$ is injective: for $[x],[y]\in \mathbb{Z}_n$ such that $f([x])=f([y])$ $$f([x])=f([y])$$ $$f(x[1])=f(y[1])$$ $$xf([1])=yf([1])$$ $$x=y$$ $$[x]=[y]$$
$f$ is surjective: for $[y]\in \mathbb{Z}_n$ exists $[x]=[yf^{-1}(1)]$ such that $$f([x])=f([yf^{-1}(1)])=yf([f^{-1}(1)])=y$$
Is my proof correct?