retraction induced homomorphism is surjective I am having a hard time proving this although it looks trivial...
Let $r:X\to A$ be a retraction between a topological space $X$ and $A\subset X$ such that $r(a_0)=a_0$ for $a_0\in A$
then the induced homomorphism $r_*:\pi_1(X,a_0)\to \pi_1(A,a_0)$ is surjective.
I tried to prove it as follows:
I showed that if $g$ is a loop in $A$ based at $a_0$ then it is a loop also in $X$ based at $a_0$
So, given $[g]\in \pi_1(A,a_0)$,  let us take $[g]\in \pi_1(X,a_0)$ (which will stand for a different homotopy class) 
So we get: $$r_*([g])=[r\circ g]=[id_A\circ g]=[g]$$ that's since  $Im(g)\subset A$ and $r$ is a retraction.
I believe that something is off in that proof in the part with the homotopy classes, so help please 
 A: Consider $i$ canonical  injection $i\colon A \to X$.
The fact that $r$ is a retract means
$$r \circ i = \mathrm{id}_A$$
From this we get
$$r_* \circ i_* = \mathrm{id}_{\pi_1(A)}$$ 
and this implies $r_*$ surjective since it has a right inverse.
A: this follows by functoriality of $\pi_1$, i.e. the fact that $f_*g_*=(fg)_*$ and $(id_A)_* = id_{\pi_1(A)}$.
Just note that a retract $r$ is a map $X \to A$ sucht that $A  \hookrightarrow  X \to A$ is the identity. This means that the composition $\pi_1(A,a_0)  \to \pi_1(X,a_0) \stackrel {r_*} \to \pi_1(A,a_0)$ induces actually the identity. This means that $r_*$ has a right inverse induced by the inclusion, which implies surjectivity of $r_*$.

To comment on your solution: you shouldn't give $[g]$ two different meanings. Call $g$ a loop in $A$ and $[g]$ its equivalence class in $\pi_1(A,a_0)$ and $i_*([g])$ its equivalence class in $\pi_1(X,a_0)$.

The following is a clean-up of your proof:
We want to show that an arbritary element in $x \in \pi_1(A,a_0)$ is in the image. We know that this element is represented by a loop $g$ based in $a_0$, ie. $[g]=x$. We want to consider the element $i_*([g]) \in \pi_1(X,a_0)$. The claim is, that this element hits $x$. Indeed, by definition of induced maps (which is well-defined, hence the equality signs): $r_*(i_*([g])) = r_*([i\circ g]) = [r \circ i \circ g]= [id_A \circ g] = [g] =x$.
