Understanding Homomorphism counting Good morning everyone,
I'd like to ask the following question :
I'm working with the following group $G = \mathbb{Z}_{n{\mathbb{Z}}} \times \mathbb{Z}_{m{\mathbb{Z}}}$, with $(n,m) \ne 1$ and i'd like to find the number of surjective Homomorphism in $G^{'} =\mathbb{Z}_{d{\mathbb{Z}}}$ (even injective are fine). 
I know from experience that number is equal to : $T= \{x \in G  : ord(x)=d \}$.
My question was : this is always true ?
My guess is no, i mean, i think there should be some other hypothesis, abelian or cyclic groups are nedeed ?
What if the two groups are not abelian or cyclic ?
I'd like to understand when i can use this fact, to count Homomorphism between two generic Groups.
Any help would be appreciated, 
Thanks anyway.
 A: Let $G$ be any group and $d$ an integer; write $C_d=\mathbb Z/d\mathbb Z$ for the cyclic group of order $d$. Then there is a bijection
$$\operatorname{Hom}(C_d, G)\xrightarrow{\cong}\{x\in G: \mathrm{ord}(x) \text{ divides }d\}$$
given by $f\mapsto f(1)$. This bijection restricts to a bijection
$$\{\text{injective homomorphisms }f\colon C_d\to G\}\xrightarrow{\cong}\{x\in G: \mathrm{ord}(x)=d\}.$$
This seems to be, at first glance, unrelated to what you are asking: you are asking about (surjective) homomorphisms to the cyclic group $C_n$ while I gave you a way to count (injective) homomorphisms from the cyclic group $C_n$.
But here is the punchline: given two finite abelian groups $A$ and $B$, the number of (surjective) homomorphisms from $A$ to $B$ is the same as the number of (injective) homomorphisms from $B$ to $A$.
Let me try to explain why:
To do so, I want to digress a little and talk about finite dimensional vector spaces first: Every finite dimensional vector space $V$ has a dual $V^\star$ such that the double dual $(V^\star)^\star$ can be canonically identified with $V$ itself. Given a map $f$, one can form its dual map $f^\star$; this procedure gives a bijection
$$\operatorname{Hom}(V,W)\cong\operatorname{Hom}(W^\star, V^\star)$$
(with inverse also given by $f\mapsto f^\star$) such that the injective linear maps one one side correspond precisely to the surjective linear maps to the other side.
But there is also a (noncanonical) isomorphism $V\cong V^\star$ (e.g. by choosing a basis) so that we get a (noncanonical) isomorphism
$$\operatorname{Hom}(V,W)\cong\operatorname{Hom}(W, V)$$
where the injective maps on one side correspond to the bijective maps on the other side.
It turns out, that for abelian groups, basically the same thing is true; prodived one uses a good notion of dual.
Consider the (infinite) abelian group $\mathbb C^\times$ (the multiplicative group $(\mathbb C\setminus \{0\},\cdot)$ of the field $\mathbb C$). Given any abelian group $A$, we can form a new abelian group $A^°:= \operatorname{Hom}(A,\mathbb C^\times)$. We call $A^°$ the dual of $A$ (or Pontryagin dual to be precise, if you want to look it up). Given any homomorphism $f\colon A\to B$, we obtain a homomorphism $f^°\colon B^°\to A^°$ given by $f^°(g):=g\circ f$.
There is always a canonical homomorphism $A\to (A^°)^°$ given (just as in the case of vector spaces) by $a\mapsto (g\mapsto g(a))$. This homomorphism is in fact an isomorphism, so that we can identify $A$ with its double dual $(A^°)^°$. Note, that under this identification we have $(f^°)^°=f$ for every $f\colon A\to B$. We have therefore produced a bijection
$$\operatorname{Hom}(A,B)\to \operatorname{Hom}(B^°,A^°)$$
given by mapping a homomorphism to its dual, $f\mapsto f^°$. The inverse is also given by $f\mapsto f^°$.
Under this bijection, injective maps on one side correspond to surjective maps on the other side.
Now a final question remains to be answered: what is the relation between $A$ and $A^°$? It turns out that for finite abelian groups a small miracle happens: $A$ and $A^°$ are (non-canonically) isomorphic, just as for vector spaces!
To see this, write an abelian group $A=C_{d_1}\oplus\dots\oplus C_{d_l}$ as a direct sum of cyclic groups. It is easy to check that $A^°=C^°_{d_1}\oplus\dots\oplus C^°_{d_l}$ so we are reduced to show $C_d\cong C^°_d$ for cyclic groups. Note that we have a bijection $C^°_d\cong \{d\text{-th roots of unity in }\mathbb C^\times\}$ (given by $f\mapsto f(1)$) and it is easy to see that the group structures match up. Finally, it is a well known fact that the $d$-th roots of unity in $\mathbb C^\times$ are a cyclic group of order $d$. So we conclude $C^°_d\cong C_d$.
If you know about categories, we can summarize this whole thing by saying that $(-)^°:=\operatorname{Hom}(-,\mathbb C^\times)$ induces a self-duality of the category $\mathbf{Ab}$ of finite abelian groups (i.e. an equivalence $\mathbf{Ab}\simeq\mathbf{Ab}^{\mathrm{op}}$) and that $A\cong A^°$ for every $A$ (non-canonically).
We have now arrived at the end of this journey: we have seen that there is a (non-canonical) bijection
$$\operatorname{Hom}(A,B)\cong\operatorname{Hom}(B,A)$$
for every pair of finite abelian groups $A$ and $B$. The injective maps on one side correspond to the surjective maps on the other side; in particular their numbers agree.

The corresponding statement for non-abelian groups is completely false.
Example: Denote by $S_3$ the symmetric group on $3$ letters. There are two injective homomorphisms $C_3\to S_3$ corresponding to the elements $(231)$ and $(312)$ in $S_3$; but there are no non-trivial homomorphisms $S_3\to C_3$.
