Question about direct sum of groups  I have trouble understanding this question and its supposed answer.

Let $A$ be a subgroup of $G$. Prove that $A$ is a direct summand of $G$ if and only if there is a homomorphism $p:G \to A$ with $p(a)=a$ for all $a \in A$. Here we talk about internal direct sum.

When I see this, I was thinking, why do homomorphism of that ($p:G \to A$) implies it is a direct summand of $G$? That is strange. Considering simple application of homomorphism can give us whether a subgroup $A$ is a direct summand of $G$. 
Any advice on how to prove this is most appreciated. thanks.
 A: Hint for $\Rightarrow$:


*

*Prove that the map $$t: G \to A \oplus \text{ker}(p)$$ given by $$g \mapsto (p(g),p(g)g^{-1})$$ is a homomorphism of groups

*Prove that $t$ is injective and surjective (i.e. an isomorphism)
Hint for $\Leftarrow$: Consider the projection $p: G = A \oplus B \to A$
A: Sebastian has given you hints on how to prove this. Let me give you a bit of intuition for why the relation between direct sums and maps.
When you have a direct sum, $G=A\oplus B$, you have two pairs of maps that relate $A$, $B$, and $G$. You have projections $\pi_A\colon G\to A$ and $\pi_B\colon G\to B$ (with $\pi_A(a,b) = a$ and $\pi_B(a,b) = b$) and you have injections $i_A\colon A\to G$ and $i_B\colon B\to G$ (with $i_A(a) = (a,1_B)$ and $i_B(b) = (1_A,b)$, where $1_A$ and $1_B$ are the identities of $A$ and $B$, respectively). The maps are related by the property that $\pi_A\circ i_A = \mathrm{id}_A$ and $\pi_B\circ i_B = \mathrm{id}_B$. 
If you identify $A$ with $i_A(A)$, then this translates exactly to the condition in the problem. So the problem is telling you that these conditions are in fact characterized by the existence of the maps. Why?
Consider the situation where you have a homomorphism $f\colon G\to A$ that is onto. If $B=\mathrm{ker}(f)$, then for each $a\in A$ you can pick an element $g_a\in G$ such that $f(g_a) = a$ (a pre-image). In general, these will not form a subgroup; sometimes, you can pick the elements cleverly enough so that they will form a subgroup, sometimes not. For example, if you map $C_{15}\to C_3$ (cyclic group of order 15 to cyclic group of order 3) by sending the generator $x$ to the generator $y$, then you can pick any of $1,x^3,x^6,x^9,x^{12}$ as $g_{1}$, any of $x,x^4,x^7,x^{10},x^{13}$ as $g_y$, and any of $x^2,x^5,x^8,x^{11},x^{14}$ as $g_{y^2}$. If you were to pick, say, $1$, $x^4$, and $x^{11}$ as you preimages, they don't form a group, but if you pick $1$, $x^{10}$, and $x^{5}$, then they do form a subgroup that is isomorphic to $C_3$. On the other hand if you take $C_4\to C_2$, again mapping generator to generator, the possible preimages of $1$ are $1,x^2$ and the possible preimages of $y$ are $x,x^3$. There is no way to pick an element of $\{1,x^2\}$ and an element of $\{x,x^3\}$ so that the two are a subgroup of $C_4$. So sometimes you can, sometimes you cannot.
When you can, if you let $\mathcal{A}$ be the subgroup of $G$ that is isomorphic to $A$ via the original map $p\colon G\to A$, then every element of $G$ will be written as an element of $\mathcal{A}$ and an element of $B=\mathrm{ker}(p)$. But in general this will not be a direct product, because you will have $(ab)(a'b') = a(ba')b' = aa'(a'^{-1}ba')b'$; unless $a'^{-1}ba'=b$ for all $b$, you don't get a direct product. So you it's not enough to be able to "retract" the projection, there's more needed. 
