If $f\in\hbox{Hom}_{\mathbb{Z}}(\prod_{i=1}^{\infty }\mathbb{Z},\mathbb{Z})$ and $f\mid_{\bigoplus_{i=1}^{\infty } \mathbb{Z}}=0$ then $f=0$.

Prove that if $f\in \hbox{Hom}_{\mathbb{Z}}(\prod_{i=1}^{\infty }\mathbb{Z},\mathbb{Z})$ and $f\mid_{\bigoplus_{i=1}^{\infty } \mathbb{Z}}=0$ then $f=0$.

I took an element of $\prod_{i=1}^{\infty }\mathbb{Z}$, that is, $(m_{1},m_{2},…)$, and because $f$ is homomorphism we have $f(m_{1},m_{2},…)=f(m_{1},0,0,…)+f(0,m_{2},0,…)+\cdots$ and because $f$ is zero on $\bigoplus_{i=1}^{\infty } \mathbb{Z}$ so $f(m_{1},m_{2},…)=0$, but I am not sure that my solution is right. Please tell me if it is right or wrong, and if it is wrong, please help me to make it right. Thank you.

Solutions Collecting From Web of "If $f\in\hbox{Hom}_{\mathbb{Z}}(\prod_{i=1}^{\infty }\mathbb{Z},\mathbb{Z})$ and $f\mid_{\bigoplus_{i=1}^{\infty } \mathbb{Z}}=0$ then $f=0$."

Let $f:\Bbb Z^{\Bbb N}\to\Bbb Z$ such that $f$ is zero on $\Bbb Z^{(\Bbb N)}$ (the direct sum of countable copies of $\Bbb Z$), and let $x=(x_n)_{n\ge 0}\in\Bbb Z^{\Bbb N}$. We want to prove that $f(x)=0$. Write $x_n=2^nu_n+3^nv_n$ with $u_n,v_n\in\Bbb Z$. (We can do this since $\gcd(2^n,3^n)=1$ for all $n\ge 0$.) Set $u=(2^nu_n)_{n\ge 0}$ and $v=(2^nv_n)_{n\ge 0}$. Then $u,v\in \Bbb Z^{\Bbb N}$ and $f(x)=f(u)+f(v)$. But $$f(u)=f(u_0,2u_1,\dots,2^{n-1}u_{n-1},0,\dots)+f(0,\dots,0,2^nu_n,\dots).$$ Since $f$ is zero on $\Bbb Z^{(\Bbb N)}$ we get $f(u_0,2u_1,\dots,2^{n-1}u_{n-1},0,\dots)=0$, so $f(u)=f(0,\dots,0,2^nu_n,\dots)$. But $f(0,\dots,0,2^nu_n,\dots)=2^nf(0,\dots,0,u_n,2u_{n+1},\dots)$ and therefore $2^n\mid f(u)$ for all $n\ge 0$, so $f(u)=0$. Analogously $f(v)=0$.