Showing $a^2=b^2$ in a group with 8 elements isomorphic to Quaternion group I am working in a group $G$ with 8 elements such that $a, b\in G$ and $ba=a^3b$. Moreover, I am given that both $b$ and $a$ have order 4 and $\langle a \rangle \neq \langle b \rangle$. I understand this group is isomorphic to Quaternion group, but this is not given and I am trying to prove this. I want to show $a^2=b^2$, but I am stuck.
Here is what I have done so far:
$$(ab)^2=abab=a(ba)b=aa^3bb=a^4b^2=b^2$$
Also from the equality $ba=a^3b$ I can derive many other equalities, but they do not seem to give me anything useful. For instance
$$aba=b \text{ or } a^3ba^3=b$$
Another observation I have made is that both $b^2$ and $a^2$ have order 2. But I am not sure if that is enough to conclude $a^2=b^2$. Please guide me in the right direction.
 A: Let $A=\langle a \rangle$ and $B=\langle b\rangle$. Note that because $ba=a^3b$, we cannot have $A=B$. Thus, we know that $A\cap B$, which is a proper subgroup of both $A$ and $B$, has either one or two elements.
Thus, we have
$$8 \geq |AB| = \frac{|A||B|}{|A\cap B|} = \frac{(4)(4)}{|A\cap B|}.$$
Therefore, we must have $|AB|=8$, and $|A\cap B|=2$. But $A\cap B$ is a subgroup of both $A$ and $B$, which being cyclic have each only one subgroup of order $2$. Thus, $\langle a^2\rangle = \langle b^2\rangle$, and we cannot have $a^2=e$ or $b^2=e$, so $a^2=b^2$ must hold.
A: The main relation can be written as $ba=a^{-1}b$, which implies $ba^2=a^{-2}b$.  Since $a$ has order 4, this means $ba^2=a^2b$, so $a^2$ is central.  The main relation also says $bab^{-1}=a^{-1}$; inverting this yields $ba^{-1}b^{-1}=a$.  This in turn implies $b^2ab^{-2}=a$, so $b^2$ is also central. If $a^2\ne b^2$, then the center has at least 4 elements, and as no center can have index $2$, the group would have to be Abelian.  Since this isn't the case, we see $b^2=a^2$ is the only non-identity element of the center.  The OP already showed $(ab)^2$ is this same central element, so we have the quaternion group.
A: We do not need to assume $\langle a\rangle\neq\langle b\rangle$.
$\;\;\;\;\;$ As a result of Cauchy's Theorem the $G$ group center $\mathcal Z(G)$ is non-trivial. However, both $a,b\notin\mathcal Z(G)$ or else $ba=a^3b$ would imply $a^2=e$ which contradicts the OP assumption $$\text{ord}(a)=\text{ord}(b)=4$$
$\;\;\;\;\;$ Therefore, $\frac{G}{\mathcal Z(G)}$ is not cyclic and thus $|\frac{G}{\mathcal Z(G)}|=4$ with $\text{ord}(g\cdot\mathcal Z(G))=2$ for all $g\in G$. Therefore, $a^2,b^2\in\mathcal Z(G)$ but $a^2,b^2\neq e$ and thus $a^2=b^2$ and $\mathcal Z(G)=\langle a^2\rangle=\langle b^2\rangle$.
A: Similar to @GerryMyerson's comment, use the fact that there are only two nonabelian groups of order $8$.
For instance, the quaternions only have one element of order $2$.  The dihedral group has $5$.
