Let $H,K\le G$, abelian $G$, and let $\phi:G\to H$ be a hom. s.t. 1) $\phi(h)=h\forall h\in H$, 2) $\text{Ker }\phi=K$. Show $G=H\oplus K$ 
Let $H$ and $K$ be subgroups of an Abelian group $G$ and let $\phi:G\rightarrow H$ be a homomorphism such that

*

*$\phi(h)=h$ for all $h\in H$.

*$\text{Ker }\phi=K$.

Show that $G=H\oplus K$
Hint:  for all $x\in G$ consider $x-\phi(x)$.

I am thinking of letting $\phi(h)=h+K$, then as the identity for the coset element $h+K$ is $K$, which satisfies $(2)$. I am not sure how to proceed from here.
The conclusion of the question requires me to show $G$ can be written as a direct sum $x=h+k$ for $x\in G$, $h\in H$, $k\in K$ and also show that $H\cap K=\{0\}$.   I think I am suppose to use the hint somehow to conclude that $x=h+k$.  
Can someone tell me what I am doing wrong or how I can proceed further into the question?
Thank you in advance.
Edit:  Since the book the question is from is not a popular one, I am including the relevant definitions, theorems and corollary from the section chapter where the question is from: 
Definition:  Let $H_1, H_2, \ldots H_n$ be subgroups of an Abelian group $G$.  Then $\sum_{i=1}^{n} H_i$ is called a direct sum and is written $\oplus_{i=1}^{n} H_i$ if for every $x\in \sum_{i=1}^{n} H_i$, we have $x=\sum_{i=1}^{n} h_i = \sum_{i=1}^{n} h'_i$ with $h_i, h'_i \in H_i$ if and only if $h_i=h'_i$ for all $i$, $1 \leq i \leq n$.
Theorem 1:  Let $G$ be an Abelian group and $H_1, H_2, \ldots H_n$ be subgroups of $G$.  Then the following statements are equivalent:  
$(1)$ $\sum_{i=1}^{n} H_i$ is a direct sum.   
$(2)$ $(\sum_{i=1}^{j-1} H_i + \sum_{i=j+1}^{n} H_i)\cap H_j=\{0\}$ 
$(3)$ $(\sum_{i=1}^{j-1} H_i)\cap H_j=\{0\}$ 
$(4)$ $\sum_{i=1}^{n} h_i=0$ where $h_i \in H_i$ for all $i$, $1\leq i \leq n$, implies $h_i=0$ for all $i$, $1\leq i \leq n$. 
Corollary: Let $G$ be a finite Abelian group and let $H$ and $K$ be subgroups of $G$ such that
$(1)$ $H\cap K=\{0\} $ 
$(2)$ $|H+K|=|G|$ 
Then $G=H\oplus K\cong H\times K$
Theorem 2:  Let $G$ be an Abelian group such that $G=\oplus_{i=1}^{n} H_i.$  Then $G=\times_{i=1}^{n} H_i$
 A: Let $x\in G$. Since $\phi:G\to H$, know that $\phi(x)\in H$ so we can think of $\phi$ as extracting an $H$-content of $x$. Then $\phi(\phi(x))=\phi(x)$ because $\phi$ is identity on $H$. This is the intuition for the element $y=x-\phi(x)$ of the hint, since $\phi(y)=0$ and hence $y\in K$.
Then $x=\phi(x)+x-\phi(x)$ is in $H+K$. Now we have to show that the sum is direct. Let $z\in H\cap K$. Then $\phi(z)=0$  since $z\in K$ and $\phi(z)=z$ since $z\in H$. Thus $z=0$.
A: This is done in three steps:

*

*$H,K\unlhd G$ since each subgroup of an abelian group is normal.


*Let $g\in H\cap K$. Since $g\in H$, we have $\phi(g)=g$, but $g\in K$, so $0=\phi(g)=g$. Thus $H\cap K=\{0\}$.


*We have $$H+K=\{ h+k\in G\mid h\in H, k\in K\}\subseteq G.$$ Let $g\in G$. Consider $f=\phi(g-\phi(g))$. We know $\phi(g)\in H$ by definition of $\phi$. Then $$\begin{align}f&=\phi(g)-\phi(\phi(g))\\ &=\phi(g)-\phi(g)\\ &=0;\end{align}$$ therefore, $g-\phi(g)\in \ker(\phi)=K$, meaning $$g=\phi(g)+(g-\phi(g))\in H+K,$$ so $G\subseteq H+K$; thus $G=H+K$.
Hence $G=H\oplus K\cong H\times K$ by Theorem 2.
A: Hint  The short exact sequence $$1\to K\hookrightarrow G\overset{\phi}{\to }H\to1$$ is left split.  The morphism $\psi:G\to K$ being $\psi(x)=x-\phi(x)$.
