Showing a function is invertible I came across this problem and not sure how to prove it.

Show that if $ f\circ f \circ g\circ g \circ f\circ f $ is invertible then $ g $ is invertible.

I'm not sure if it's correct to say that  $f$ is invertible because it's the most left function and then show that $g$ is invertible.
 A: Let $h$ be an inverse for $f\circ f \circ g\circ g \circ f\circ f$.
$id=(f\circ f \circ g\circ g \circ f\circ f)\circ h=f\circ (f \circ g\circ g \circ f\circ f\circ h)$ implies that $f$ is surjective.
$id=h\circ (f\circ f \circ g\circ g \circ f\circ f)=(h\circ f\circ f \circ g\circ g \circ f)\circ f$ implies that $f$ is injective.
Thus, $f$ is a bijection and so has an inverse $f'$.
Then
$g\circ g = f' \circ f' \circ (f\circ f \circ g\circ g \circ f\circ f) \circ f' \circ f'$.
This implies that $g\circ g$ is invertible, because it is the composition of invertible functions.
Finally, $g$ is invertible by repeating the argument used for $f$.
More precisely, let $k$ be an inverse for $g\circ g$. Then:
$id=(g\circ g) \circ k= g\circ (g \circ k)$
implies that $g$ is surjective.
$id=k \circ(g\circ g)=(k \circ g)\circ g$
implies that $g$ is injective.
Thus, $g$ is a bijection and so invertible.
More generally,

If $F \circ G \circ F$ is invertible, then $F$ and $G$ are invertible.

Apply this once to $F=f \circ f$ and $G=g\circ g$ and get that $g\circ g$ is invertible.
Apply it again to $F=g$ and $G=id$ and get that $g$ is invertible.
A: *

*1) $r$ is by definition a retraction if $r\circ s=\text{id}$ for some
$s$.

*2) $s$ is by definition a section if $r\circ s=\text{id}$ for some
$r$.

*3) If $h$ is both a retraction and a section then $h$ is invertible:
let $h\circ s$ and $r\circ h$ be identities. Then $r=r\circ h\circ s=s$
showing that $r=s$ serves as inverse of $h$.

*4) If $r\circ s$ is invertible and $h$ is its inverse then $r\circ\left(s\circ h\right)=\text{id}$
and $\left(h\circ r\right)\circ s=\text{id}$ showing that $r$ is
a retraction and $s$ is a section.
The fact that $f\circ (f \circ g\circ g \circ f\circ f)$ is invertible implies that $f$ is a retraction (by 4).
The fact that $(f\circ f \circ g\circ g \circ f)\circ f$ is invertible implies that $f$ is a section (by 4).
Then $g\circ g=f^{-1}\circ f^{-1}\circ f\circ f\circ g\circ g\circ f\circ f^{-1}\circ f^{-1}$ is invertible (by 3) hence $g$ is a retraction and a section (by 4). 
Then $g$ is invertible (by 3).
