Prove that $G\cong H\times K$ if and only if there are homomorphisms... I have some questions for the following following exercise which came from Hungerford's undergraduate Abstract algebra An introduction 3rd edition text in chapter 9, section 1.

Let $G$ be an additive abelian group with subgroups $H$ and $K$.  Prove that $G\cong H\times K$ if and only if there are homomorphisms 
$${\stackrel{\large{H}\stackrel{\large\large\pi_1}{\stackrel{\longleftarrow}{\longrightarrow}}\large{G}}{\small\small\delta_1}}{\stackrel{\stackrel{\large\large\pi_2}{\stackrel{\longrightarrow}{\longleftarrow}}\large{K}}{\small\small\delta_2}}$$
such that $\delta_1(\pi_1(x))+\delta_2(\pi_2(x))=x$ for every $x\in G$ and $\pi_1\circ \delta_1=i_H,\pi_2\circ \delta_2=i_K,\pi_1\circ \delta_2=0,\pi_2\circ \delta_1=0,$ where $i_X$ is the identity map on $X$, and $0$ is the map that sends every element onto the zero (identity) element.

First I think the homomorphic maps are as follows:  let $x\in G,$  and $x=(x_1, x_2)\in H\times K$, we define the mapps $\delta_1:H\rightarrow H\times \{e\}$ and $\delta_2:K\rightarrow \{e\}\times K$ then respectively,
$\delta_1(x)=(x_1, 0)$ and $\delta_2(x)=(0,x_2)$.
Since $\pi_i$ for $i=1,2$ are projection maps, then
$\pi_1(\delta_1(x))=x_1$,
$\pi_1(\delta_2(x))=0$,
$\pi_2(\delta_2(x))=x_2$ and
$\pi_2(\delta_1(x))=0$.  Also
$\delta_1(\pi_1(x))=x_1$,
$\delta_2(\pi_2(x))=x_2$,
In sum, $\delta_1(\pi_1(x))+\delta_2(\pi_2(x))=(x_1,0)+(0,x_2)=(x_1,x_2)=x$
Since this is an if and only if question.  In one direction, after figuring out what the explicit homomorphisms are, I am suppose to show that $G\cong H\times K$.  But in the other direction, I assume that $G\cong H\times K$, then figure out what the explicit homomorphism maps are suppose to be?Isn't the way the question is phrased just asking me to show that $G\cong H\times K$ given explicit homomorphism maps.
If someone can tell me if my homomorphic maps are defined correctly and also how to what i need to show for the proof in both directions.
Thank you.
 A: *

*"Since $\pi_i$ are projection maps"...  Are you defining them as the projection maps? In this part of the problem you are required to explicitly define the maps and show they have the desired properties. You are not given that the $\pi_i$ are projection maps, you must tells us what the $\pi_i$ are, just as you told us what the $\delta_j$ maps were. Moreover, you seem to be assuming that $G$ is equal to $H\times K$. That is not your assumption; your assumption is that $G$ is isomorphic to $H\times K$. It won't be hard to add the necessary corrections, but right now you have not proven that if $G$ is isomorphic to $H\times K$ then the morphisms with the relevant properties exist, you have only established this fact for the group $H\times K$  itself.


*Yes, this is an if-and-only-if, so you have only done half the problem. Now you must show that if you have maps $\delta_1,\delta_2,\pi_1,\pi_2$ satisfying the given conditions, then you can define an isomorphism between $G$ and $H\times K$. Note that the only thing you will know about the maps is what you are told, and you are expected to use the maps and the properties listed to define the isomorphism.

Here is what a model solution might look like, in my opinion:
For the "only if"  direction: assume first that $G= H\times K$; we define $\delta_1(h) = (h,0)$, $\delta_2(k) = (0,k)$, $\pi_1(h,k) = h$, and $\pi_2(h,k) = k$. Then ... verify as you do that the maps have the desired properties..., proving the claim for $H\times K$.
Now assume that $\psi\colon G\to H\times K$ is an isomorphism. Then we take the maps $\psi^{-1}\circ\delta_1\colon H\to G$, $\psi^{-1}\circ\delta_2\colon K\to G$, $\pi_1\circ\psi\colon G\to H$, and $\pi_2\circ\psi\colon G\to K$. Then ...verify that because $\psi$ is an isomorphism, these maps will have the desired properties as well.
Conversely, for the "if" clause, assume we are given morphisms $\pi_1,\pi_2,\delta_1,\delta_2$ with the listed properties. We must use these morphisms to show that $G$ is isomorphic to $H\times K$.
Define $\psi\colon G\to H\times K$ by $\psi(g) = (\delta_1(\pi_1(g)),\delta_2(\pi_2(g)))\in H\times K$. We must now verify that (i) $\psi$ is a homomorphism; and (ii) $\psi$ is bijective.
