How many homomorphisms and isomorphisms This is a rather elementary question but I am teaching myself group theory and want to make sure I am getting the basics right!
I am considering how many isomorphisms there are $C_n \rightarrow C_n$. For an isomorphism, an element of some order $k$ must be mapped onto an element of order $k$. So I thought that, if $a$ was the generator in the first group, then the homomorphism could map this onto any of the elements $b^i$ in the second group were $b$ generates the second group and $i$ has to be coprime with $n$, because any of the $b^i$ with $i$ being coprime with $n$ can be thought of as the generators for the group of order $n$? Is this correct?
Secondly, I am asked how many homomorphisms there are $D_{2n}\rightarrow C_n$ Now for a homomorphism $f$, the order of $f(a)$ must divide the order of $a$. I will call the generator of order n in $D_{2n}$ r, and of order 2 $s$. And I will call a generator of order n in $C_n$ as $a$. Splitting the problem into cases according to the value of n:


*

*When n=1 have trivial case that both elements $e,s \in D_{2n}$ are both in the kernel of f 

*When n=2, can choose either $f(r)=a$ and $f(s)=e$ ($e$ the ide9antity) or vice versa to satisfy the 'generator' requirement. For $n>2$, since $f(s)$ can only be order 1 or 2, it must be mapped to the identity and $f(r)=a$.
But I am rather stuck as to what happens to the elements in $D_{2n}$ which are of the form $sr^i$ for some $i=1,2,...n-1$.
If I consider the simple case of n=2, then I can think of $f(s\bullet r)=f(s)f(r)=ef(r)=a$ by definition for a homomorphism. Now if I consider $f(sr\bullet s)=f(sr)f(s)=f(sr)=f(r)=a$ which happens to be consistent here because $r$ is of order two and is self-inverse, so if we take $srs=ssr^{-1}=r^{-1}$ by definition for the dihedral group, this happens to be $r$ so indeed we get back $f(r)=a$ on the left hand side.
But this does not work with any $n>2$ in general. In particular, if I assume as above that $f(s)=e$ and $f(r)=a$, then still the first case where I tried $f(s\bullet r^j)=f(s)f(r^j)=a^j$ suggesting that the $sr^j$ are mapped to $a^j$, like the $r^j$. On the other hand this suggests the second operation becomes $f(sr^j\bullet s)=f(sr^j)f(s)=f(r^j)=a^j$ but by definition for the dihedral group $sr^js=s^2r^{-j}=r^{-j}$, and clearly $f(r{-j})=a^{-j}\neq a^j$!
I am not sure if I am doing something wrong here, or perhaps there aren't any homomorphisms? I would greatly appreciate any help.
 A: 
1) Isomorphisms of $C_n$

We could start by counting the number of maps from $C_n$ to itself. This would be $n^n$ as each element has $n$ possible elements it can be mapped to. 
Now, any homomorphism must have $\rho(e)=e$ (try and prove it). Notice that $C_n$ is cyclic and so is generated by a single element, say $a$. Now, we have $n$ possible choices for $\rho(a)$. Notice that this will determine the homomorphism as $\rho(x)^n = \rho(x^n)$. So I'm counting via a bijection from homomorphisms from $C_n$ to itself and possible values of $\rho(a)$. [If you ever study representation theory, you'll learn this result generalises in a very cool way. Also if I really wanted to be a pedant, I would make the bijection more explicit and also prove I've not over counted, but I'll leave that to you :)]
Now we have obviously overcounted for isomorphisms and we do indeed need $b:= \rho(a)$ to have order $n$. From number theory, we know that this is the same as $b = a^i$ where $i$ is coprime to $n$ (again, one ought to prove this claim to understand it fully). Thus the number of isomorphisms of $C_n$ is $\phi(n)$ where $\phi$ is the Euler Phi Function.

2) Homomorphisms from $D_{2n}$ to $C_n$ 

I'll use the same generators as you. Again the homomorphism will be entirely determined by its action on $r$ and $s$. We only need $\mathrm{ord}(\rho(r))|\mathrm{ord}(r)=n$ and  $\mathrm{ord}(\rho(s))|\mathrm{ord}(s)=2$ and that $\rho(s^{-1}rs) = \rho(r^{-1})$ or equivalently $\rho(r)^2 = e$. 
The "equivalently" comes from (lengthy but basic) algebra. So $C_n$ is commutative as it is cyclic, so  $\rho(s^{-1}rs) = \rho(s^{-1})\rho(r)\rho(s) = \rho(s^{-1})\rho(s)\rho(r) =\rho(r)$. But from before, $\rho(r) = \rho(r^{-1})$, so we have $\rho(r)^2 = \rho(r^{-1})\rho(r)= \rho(r^{-1}r)=\rho(e)=e$. Note that this can be summarised as $\rho(r^2) = e = \rho(s^2)$.
Consider $s$, then $\mathrm{ord}(\rho(s)) = 1$ or $\mathrm{ord}(\rho(s))=2$. The first case implies $\rho(s) = e$ and the second is only viable when $n$ is even. The same argument holds for $r$ and thus we have:
 $|\mathrm{Hom}(D_{2n}, C_n)| = \begin{cases}
1,  & \text{if $n$ is odd} \\
4, & \text{if $n$ is even.}
\end{cases}$
