Prove that an arbitrary function
$$h:X\to P = \Pi_{i\in M} X_i$$
of a module $X$ over $R$ into the direct product module $P$ is a homomorphism $\iff$ the composition
$$p_i\circ h:X\to X_i$$
with the natural projection $p_i:P\to X_i$ is a homomorphism for every $i\in M$
Let's first suppose that the composition is a homomorphism, that is:
$$(p_i\circ h )(a+b) = (p_i\circ h) (a) + (p_i\circ h) (b)$$ $$(p_i\circ h )(\lambda a) = \lambda(p_i\circ h)(a) $$
we must show that $h$ itself is a homomorphism, that is, $h(a+b) = h(a)+h(b)$ and $h(\lambda a) = \lambda h(a)$. If we don't have $h$ homomorphism, then $p_i(h(a+b))\neq p_i(h(a) + h(b))$ but I don't see this as helping in anything. Or maybe it helps... Shouldn't the projection itself be a homomorphism? So if $(p_i\circ h)(a+b) \neq p_i(h(a)+h(b))$ then $(p_i\circ h)(a+b)$ can't possibly be $p_i(h(a)) + p_i(h(b))$, or can it?
Now, for the reverse, I don't even know how to begin, because the definition of a direct product is too obscure for me, as I already questioned here, but didn't understand a thing of the answer.