Prove that $|G|=8$ with the given condition Given a group $G$, with $a\in G, b\in G$ such that $|a|=|b|=4, a^2=b^2, ba=a^3b, a\neq b$ and $G=\langle a,b\rangle$.
Prove that $|G|=8$.
I'm not sure how to begin this exercise. I suppose that the condition of both $a$ and $b$ being in $G$ gives that the order of $G$ is at least $4$, but how am I supposed to use the other condition to conclude that it has order 8?

You want to find out the words in $a,b$ you can produce without repetition. The rule $ba=a^3b$ says any word may be written in the form $a^ib^j$ for integers $b,a$. Since $a,b$ have order four you may assume that $i,j=0,1,2,3$, and since $a^2=b^2$ you may assume that $i=0,1$. This gives eight possible pairs $(i,j)$ and you need to check none of the words obtained are the same. We have proven, in fact, that $G$ has order at most $8$. Can you find a group surjection $G\to Q$ for some group $Q$ of eight elements? 
