First and foremost I'm very new to math exchange so sorry for the lack of mathematical symbols used. Right now I'm studying algebraic structures with elementary group theory.
Prior to the problem in question I was asked to prove that there exists a subgroup $H$ of order $p$ in the group $G$ with order $2p$ (p is prime). I did that by taking an element $a$ out of $G$ with order $p$ and making the subgroup $H = \langle a \rangle$
The problem now is: prove that for any $g$ in $G$ that $g^2$ is in $H$. For $|g| = 2$ that's quite easy since it's just $e$ and $e$ is in H. Since $H$ is a subgroup composed of elements with order $p$, $|g| = p$ would also be in $H$. But why is it that an element $g$ with order $2p$ has $g^2$ in H? I decided to take some example groups and saw that $g^2$ has a new order of $p$ but I don't know how to prove that.
Again I'm very sorry for the lack of symbols that could've shortened this question and simplified it greatly.
Consider the cyclic group generated by $g^2$, namely $\langle g^2 \rangle$. We can prove that the order of $g^2$ is $p$. let $\text{ord}(g^2) = k$. Then we have that $g^{2k} = e$, but this gives us that $2p \mid 2k \implies p \mid k$, so we have that $k \ge p$. On the other side we now that $(g^2)^p = g^{2p} = e$, so we must have that $k \mid p$, so $k \le p$. From the two inequalities we conclude that $k=p$. Hence $\langle g^2 \rangle$ is a group of order $p$.
You can indeed prove that the group has a unique group of order $p$, when $p$ is an odd prime number. In other words we can prove that $H = \langle g^2 \rangle$. To note this we know that $H \cap \langle g^2 \rangle$ is a subgroup of $G$ and it's order is either $p$ or $1$. If it's $p$ then $H = \langle g^2 \rangle$. If it's one then we have that
$$2p = |G| \ge |H\langle g^2 \rangle| = \frac{|H||\langle g^2 \rangle|}{|H \cap \langle g^2 \rangle|} = p^2$$
But this is obviously impossible. Hence the proof.