Finite abelian group generated by two elements Let $G$ be a finite abelian group generated by two elements $a$ and $b$. I am trying to prove that $G$ is isomorphic to the direct product of two cyclic group $C_r$ and $C_s$, where the value of $r$ and $s$ depend on $|a|$, $|b|, d = |\langle a \rangle \cap \langle b \rangle |.$ I have defined a map 
$$ \psi : \frac{\langle a \rangle}{\langle a \rangle \cap \langle b \rangle } \times \langle b \rangle  : \rightarrow  \langle a, b \rangle  $$
such that  $\psi(\bar{a^i}, b^j) = (a^i b^j).$ But this map is not well defined. Can we defined another map or how to prove that  $G$ is isomorphic to the direct product of two cyclic group $C_r$ and $C_s$, where the value of $r$ and $s$ depend on $|a|$, $|b|, d = |\langle a \rangle \cap \langle b \rangle |.$ Any help would be appreciated. Thank you.
 A: Here's a different approach:
Theorem: Let $A$ be an abelian group and suppose $A$ is generated by $a, b$, where $a$ and $b$ have finite order. Then $A$ is isomorphic to the product of two cyclic groups.
Proof: Take generators $a$ and $b$ of $A$, and write $C = \langle a \rangle \subset A$. $A /C$ is cyclic with generator $c = \overline{b}$. There is a canonical quotient map $\pi : A \rightarrow A/C$. $\pi (b) = c$. $c$ is a generator of $A/C$. The order of $b$ is divisible by the order of $A/C$. To see this, note that $\pi$ induces a surjective map $\pi' : \langle b \rangle \rightarrow A/C$, so that $|A/C| \cdot |\ker(\pi')| = \text{ord}(b)$. Write $\text{ord}(b) = n$ and $|A/C| = m$, and take $k \in \mathbb{N}$ such that $mk = n$. $b^k$ then has order $m$ and $\phi(b^k)$ is a generator of $A/C$ (why?).
We show that $\langle b^k \rangle \cap \langle a \rangle = \{ e \}$ and $\langle b^k \rangle  \langle a \rangle = A$. Suppose $b^{ki} = a^j$ for some $i, j \in \mathbb{N}$. Applying $\pi$, we see that $c^i = e$, so that $i$ is divisible by $m$. Then $ki$ is divisible by $n$, so that $b^{ki} = e$. Then $b^{ki} = a^j = e$. So $\langle b^k \rangle \cap \langle a \rangle = \{ e \}$. To see that $\langle b^k \rangle \langle a \rangle = A$, take $x \in A$, and take $i$ such that $\pi (x) = c^i$. Then $xb^{-ki} = c^i c^{-i} = e$. We can write $xb^{-ik} = a^j$ since $xb^{-ik} \in \ker(\pi)$. Then $x = a^j b^{ik}$.
It follows from a well known characterization of direct products that $A \cong \langle b^k \rangle \times \langle a \rangle$. Therefore $A$ is the product of two cyclic groups.
Note: Here's some intuition concerning direct products that might help. Suppose we have a quotient map $\pi: A \rightarrow B$. When is $A$ isomorphic to the direct product of $B$ and $\ker(\pi)$? It turns out that this is true whenever there is another map $\iota : B \rightarrow A$ such that $\pi \circ \iota = \text{Id}_B$. It is a good exercise to verify this (and it's similar to the proof above). In our case, we created such a situation as this by taking $\langle a \rangle = \ker(\pi)$, $B = A / \langle a \rangle$, and $\pi : A \rightarrow B$ the canonical quotient map. The rest of what we showed was actually equivalent to showing that we have a map $\iota : B \rightarrow A$ ($\iota : B \rightarrow A$ would send $c$ to $b^k$).
Note: This is actually a specific case of a much more general theorem. All finitely generated abelian groups have a decomposition into a product of cyclic groups (note $\mathbb{Z}$ is cyclic). You can read about the most general formulation of this, in terms of finitely generated modules over a PID, here.
