I am trying to find a better solution to the following problem.
Show that the group $Q_8 = \langle a, b : a^4 = 1, a^2 = b^2, bab^{-1} = a^{-1}\rangle$ has order $8$.
My attempt: the last relation gives $ba = a^3 b$, so every element can be written on the form $a^i b^j$. The other relations restrict it further: $a^i b^j$ with $i \in \{ 0,1 ,2 ,3 \}$ and $j \in \{0, 1\}$. This gives at most eight elements, so it suffices to show they are different. The powers of $a$ are distinct since $a$ has order $4$, and the elements $a^kb$ are distinct for the same reason.
My question is: how can I efficiently show that $a^kb \neq a^{\ell}$? The case $k = \ell$ is easy: we get $b = 1$, which contradicts the second relation. If $k > \ell$, we get $ab = 1$ or $a^2 b = 1$ etc. I think I went through all the possible cases, but it felt really ad-hoc. Is there a better way to prove this?