Prove that $g^{-1}hg\in H$ implies left and right cosets are the same. I'm dealing with the following task:

The solution we were provided from our class notes was the following:

$$
g^{-1}hg=k , k \in H \Rightarrow hg=gk \Rightarrow Hg=gH
$$

As you might imagine, I have no idea why the last statement follows. Any explanation would be appreciated; thank you in advance.
 A: Here's the solution in much more detail:
Let $g\in G$ and $h\in H$ be arbitrary. If we can show that $hg$ can always be written in the form $gk$ for some $k\in H$, then this implies $Hg=gH$. Indeed, since $H$ is closed under conjugation, we have $g^{-1}hg\in H$, so let $k:=g^{-1}hg\in H$. Then we have
$$gk=hg$$
as desired. So we actually only have $Hg\subset gH$ so far. But a similar argument considering $ghg^{-1}$ instead of $g^{-1}hg$ will show that $gH\subset Hg$, so we conclude $gH=Hg$.
A: We get:
\begin{alignat}{1}
\forall g\in G,\forall h\in H: g^{-1}hg\in H &\stackrel{(def.)}{\iff} \forall g\in G,\forall h\in H, \exists h'\in H\mid g^{-1}hg=h'\\
&\stackrel{}{\iff} \forall g\in G,\forall h\in H, \exists h'\in H\mid hg=gh'\\
&\stackrel{(def.)}{\iff} \forall g\in G:Hg\subseteq gH\\
\tag 1
\end{alignat}
But also:
\begin{alignat}{1}
\forall g\in G,\forall h\in H: g^{-1}hg\in H &\space\stackrel{(g'=g^{-1})}{\iff} \space\forall g'\in G,\forall h\in H: g'hg'^{-1}\in H\\
&\space\space\stackrel{(def.)}{\iff} \space\space\forall g'\in G,\forall h\in H, \exists h'\in H\mid g'hg'^{-1}=h'\\
&\space\space\stackrel{}{\iff} \space\space\forall g'\in G,\forall h\in H, \exists h'\in H\mid g'h=h'g'\\
&\space\space\stackrel{(def.)}{\iff} \space\space\forall g'\in G:g'H\subseteq Hg'\\
\tag 2
\end{alignat}
By $(1)$ and $(2)$:
$$\forall g\in G,\forall h\in H: g^{-1}hg\in H\iff \forall g\in G:Hg=gH\tag 3$$
