Kernel isomorphic to cokernel in exact sequence Let $G$ be a finite abelian $p$-group and let $f:G \to G$ be a homomorphism of groups. Is it then true that $G/Im(f) \cong ker(f)$? I am familiar with the first isomorphism theorem, Structure theorem and also I am not interested in having a canonical isomorphism. It seems that if I choose a basis and use the Structure Theorem I get the result, but I am not sure if the steps I make are all good:
One can write, after choosing a basis
$$ G \cong \bigoplus\limits_{i=1}^{m} \mathbb{Z}/p^{a_i}\mathbb{Z}$$
$$ \ker(f) \cong \bigoplus\limits_{i=1}^{m} \mathbb{Z}/p^{b_i}\mathbb{Z},$$
with $0\leq b_i \leq a_i$, and from this, as we also know $Im(f)$ is in this case a subgroup of $G$, it seems that the result follows.
In case the result doesn't hold, I would be grateful for an explanation which also shows why my argument breaks down. Thank you very much.
 A: I think I have a counterexample, assuming I did my computations correctly. Let $G = \Bbb Z/8\Bbb Z\oplus\Bbb Z/4\Bbb Z\oplus\Bbb Z/2\Bbb Z\oplus\Bbb Z/2\Bbb Z$, and let $f$ be given by
\begin{align*}
G&\to G\\
(a,b,c,d) &\mapsto (2b,2c,d,d)
\end{align*}
(meaning $2\in\Bbb Z/4$ maps to $4\in\Bbb Z/8$, not $0$, and similarly for $\Bbb Z/2$ embedding into $\Bbb Z/4$). Then
$$
\ker f = \Bbb Z/8\Bbb Z\oplus 0\oplus0\oplus0\cong\Bbb Z/8\Bbb Z
$$
and
$$
\operatorname{im} f = 2(\Bbb Z/8)\oplus2(\Bbb Z/4)\oplus\{(a,a)\in\Bbb Z/2\oplus\Bbb Z/2\}\cong \Bbb Z/4\oplus\Bbb Z/2\oplus\Bbb Z/2
$$
But
$$
G/\operatorname{im}f\cong\Bbb Z/2\oplus\Bbb Z/2\oplus\Bbb Z/2.
$$
You don't even need to compute $G/\operatorname{im}f$, actually: just note that it can't possibly have an element of order $8$, which $\ker f$ does! Your argument seems to only look at sizes of the groups, and not the way the summands interact with each other via the map $f$ (although I must admit I'm not so clear on exactly what the argument is, you only write down the decompositions via the structure theorem and then conclude what you want). You might have tried to use the structure theorem in a more ``canonical fashion" than it actually applies: there's no reason that your choice of decomposition of the kernel will match up in any way with the decomposition of $G$ (although in my example it does, but dually the image decomposition as $\Bbb Z/4\oplus V_4$ doesn't tell you exactly how it appears within $G$, as there's more than one way to embed $\Bbb Z/4\oplus V_4$ in $G$).
