Let $G$ be a finite group and $h \in G$ s.t. $|h|=2$. Suppose $|G|$ is not divisible by $4$. Show that the equation $g^2=h$ has no solution in $G$. 
Let $G$ be a finite group and $h \in G$ s.t. $|h|=2$. Suppose $|G|$ is not divisible by $4$. Show that the equation $g^2=h$ has no solution in $G$.

This was an exam question on my abstract algebra midterm last week. I think I’ve stumbled on an answer, but my basic understanding is so weak that I’m not sure if my logic holds
We know $h$ is order $2$ which implies that $h\times h=e$
We want to show $g\times g=h$ has no solution.
Observe then that $g^4=h^2=e$.
But then $g$ has order $4$ and $4$ does not divide $|G|$.
Contradiction.

Does the fact that $4$ does not divide $|G|$, the group, hold for elements of $G$?
Is this a valid solution to the problem?

Thanks
 A: It is a valid solution if the order of $g$ is $4$ then the subgroup generated by $g$ has order $4$, by Lagrange $4$ must divides the order of $G$, contradiction.
For your question in the comment, if $p=4n+3$ is a prime, consider the multiplicative group $\mathbb{Z}-\{0\}$ endowed with the multiplication, its order $4n+2$ is not divisible by $4$, therefore you can apply the previous result to show that $x^2=-1$ does not have a solution.
A: Yes, by Lagrange's Theorem. If $g$ has order $4$, then $\langle g\rangle\le G$ has order $4$, so $4\mid |G|$.
A: Warning! Note that $h=g^2$ does not imply $|g|=2|h|$ in general. For example, if $|h|=3$, then we could also have $|g|=3$.
You only wrote that $g^4=h^2=1$, but did not make explicit that $4$ is the smallest $n$ with $g^n=1$. All we know immediately from $g^4=1$ is that $|g|$ divides $4$, so $|g|$ is one of $1,2,4$. However, if $|g|=1$ or $|g|=2$ then $h=g^2=1$, contradicton. So after all the claim that $|g|=4$ does turn out to be correct. (and the final contradiction comes from Lagrange).
