Help to show that $\bigoplus_{i\in\mathbb{N}}\mathbb{Z}\cong\operatorname{Hom}(\prod_{i\in\mathbb{N}}\mathbb{Z},\mathbb{Z})$.

This is a lovely theorem, due – if I'm not mistaken – to Reinhold Baer. For convenience, we will denote $\prod_{i\in\mathbb{N}}\mathbb{Z}$ by $\mathbb{Z}^\mathbb{N}$ and $\bigoplus_{i\in\mathbb{N}}\mathbb{Z}$ by $\mathbb{Z}^{\oplus\mathbb{N}}$. Let $e_0=(1,0,0,\dots)$, $e_1=(0,1,0,\dots)$ denote the canonical basis for the submodule $\mathbb{Z}^{\oplus\mathbb{N}}<\mathbb{Z}^\mathbb{N}$. We wish to define an inverse to your map $f$; the naive way of doing this is to try to define $g:\operatorname{Hom}(\mathbb{Z}^\mathbb{N},\mathbb{Z})\rightarrow\mathbb{Z}^{\oplus\mathbb{N}}$ by $\phi\mapsto (\phi(e_1),\phi(e_2),\dots)$. Unfortunately, a priori, there is no guarantee that this is well-defined; we need to show that only finitely many of the $\phi(e_i)$ will be non-zero.


Claim 1: for any morphism $\phi:\mathbb{Z}^\mathbb{N}\rightarrow\mathbb{Z}$, $\phi(e_i)$ is non-zero for only finitely many $i$.

Proof: Suppose for contradiction we have some $\phi$ for which this is not the case. Then, by considering $-\phi$ if necessary, we may assume that $\phi(e_i)$ is strictly positive for infinitely many $i$. Say $n_1<n_2<\dots\in\mathbb{N}$ are such that $\phi(e_{n_i})>0$. Then, by considering the homomorphism $\mathbb{Z}^\mathbb{N}\rightarrow\mathbb{Z}^\mathbb{N}$ taking the $i$-th copy of $\mathbb{Z}$ in the first direct product to the $n_i$-th copy of $\mathbb{Z}$ in the second direct product, we may assume that $\phi(e_i)>0$ for all $i$.

Now, choose $(n_i)_{i\in\mathbb{N}}$ a sequence of integers such that $2^{n_{i+1}}>2^{n_i}\phi(e_i)$ for each $i$, and let $\bar{x}=(2^{n_0},2^{n_1},2^{n_2},\dots)\in\mathbb{Z}^\mathbb{N}$. Note that $\bar{x}-\sum_{i=0}^{k-1}2^{n_i}e_i$ is divisible by $2^{n_k}$ in $\mathbb{Z}^\mathbb{N}$, for every $k\in\mathbb{N}$. This means that $$\phi(\bar{x}-\sum_{i=0}^{k-1}2^{n_i}e_i)=\phi(\bar{x})-\sum_{i=0}^{k-1}2^{n_i}\phi(e_i)$$ is divisible by $2^{n_k}$ in $\mathbb{Z}$ for every $k$. Along with the construction of the $n_i$, this means that, in the binary expansion of $\phi(\bar{x})$, the entries between the $2^{n_i}$-th place and the $2^{n_{i+1}}$-th place coincide with the binary expansion of $\phi(e_i)$. In particular, since every $\phi(e_i)$ is strictly positive, $\phi(\bar{x})$ has strictly positive entries arbitrarily high in its binary expansion, a contradiction. (Every integer has all but finitely many entries in its binary expansion equal to zero.)


Thus the map $g$ is indeed well-defined. It is now easy to verify that $g$ is a $\mathbb{Z}$-module morphism, and also that $g\circ f=\operatorname{id}_{\mathbb{Z}^{\oplus\mathbb{N}}}$; I'll let you check this. Thus we need only show that $f\circ g=\operatorname{id}_{\mathbb{Z}^{\mathbb{N}}}$. For this, we claim it suffices to show that $\operatorname{Hom}(\mathbb{Z}^\mathbb{N}\big/\mathbb{Z}^{\oplus\mathbb{N}},\mathbb{Z})\cong\{0\}$. Indeed, if this is true, then any two maps $\mathbb{Z}^\mathbb{N}\rightarrow\mathbb{Z}$ that coincide on $\mathbb{Z}^{\oplus\mathbb{N}}$ are in fact the same (their difference will map $\mathbb{Z}^{\oplus\mathbb{N}}$ to $0$, and hence by the desired result be identically zero). Since the $e_i$ are a basis for $\mathbb{Z}^{\oplus\mathbb{N}}$, showing that two maps coincide on $\mathbb{Z}^{\oplus\mathbb{N}}$ amounts to showing that they coincide on the $e_i$, and it is easy to compute that $(f\circ g)(e_i)=\operatorname{id}_{\mathbb{Z}^\mathbb{N}}(e_i)$, as needed. Thus, after the claim below, we will be done.


Claim 2: $\operatorname{Hom}(\mathbb{Z}^\mathbb{N}\big/\mathbb{Z}^{\oplus\mathbb{N}},\mathbb{Z})\cong\{0\}$.

Proof: For an arbitrary $\mathbb{Z}$-module $M$, we say that $m\in M$ is infinitely divisible if, for infinitely many $k\in\mathbb{Z}$, there is some $n_k\in M$ such that $m=kn_k$. The only infinitely divisible element of $\mathbb{Z}$ is $0$, so any $\mathbb{Z}$-module morphism from $M$ to $\mathbb{Z}$ must send all infinitely divisible elements of $M$ to $0$. Thus, to show our claim, it will suffice to show that $M:=\mathbb{Z}^\mathbb{N}\big/\mathbb{Z}^{\oplus\mathbb{N}}$ is generated by infinitely divisible elements. (Indeed, if a module morphism maps some collection of generators of a module to $0$, then it maps every element of the module to $0$.)

$M$ has an ample supply of infinitely divisible elements. For instance, given a fixed $k\in\mathbb{N}\setminus\{0\}$, and any $\bar{x}=(x_0,x_1,\dots)\in\mathbb{Z}^\mathbb{N}$, denote the coset of $(x_0,kx_1,k^2x_2,\dots,k^ix_i,\dots)$ in $M$ by $\bar{x}^{(k)}$. We claim that $\bar{x}^{(k)}$ is divisible by every power of $k$, and thus is infinitely divisible. To see this, fix $i\in\mathbb{N}$. We have that $$(x_0,kx_1,k^2x_2,\dots)=k^i(0,\dots,0,x_i,kx_{i+1},k^2x_{i+2},\dots)+(x_0,kx_1,\dots,k^{i-1}x_{i-1},0,0,\dots).$$ The first term in the sum on the right hand side is divisible by $k^i$, while the second term is an element of $\mathbb{Z}^{\oplus\mathbb{N}}$. Thus $(x_0,kx_1,k^2x_2,\dots)$ differs from a $k^i$-divisible element of $\mathbb{Z}^\mathbb{N}$ by an element of $\mathbb{Z}^{\oplus\mathbb{N}}$, and so $\bar{x}^{(k)}$ (its image in $M$) is $k^i$-divisible in $M$.

We claim now that $M$ is generated by the collection $\{\bar{x}^{(2)},\bar{x}^{(3)}:\bar{x}\in\mathbb{Z}^\mathbb{N}\}$. To see this, recall that $2^i$ and $3^i$ are coprime for any $i$. Thus, given an arbitrary element $\bar{y}\in\mathbb{Z}^\mathbb{N}$, for each $i$ we can find some $a_i,b_i\in\mathbb{Z}$ such that $y_i=a_i2^i+b_i3^i$. This means that $\bar{y}+\mathbb{Z}^{\oplus\mathbb{N}}=\bar{a}^{(2)}+\bar{b}^{(3)}$ as elements of $M$, as desired. Thus $M$ is generated by a collection of infinitely divisible elements, so any map $M\rightarrow\mathbb{Z}$ must be trivial, and so we are done.