How to deduce the number of elements in a finite group given the group generators? I am studying for my finals, and I came across a question I don't really understand.
We have a finite group $G$ with two generators: $a$ ($a^3=E$) and $b$ ($b^2=E$), where $E$ is the identity. We are also given the relation $(ab)^2=E$. Now the question asks to show that $G$ has $6$ elements that can be represented as
$$E, a, a^2, ab, a^2b, b$$
I am not sure how I can deduce the number of elements in my group from my generators?
Thanks!

Here is a two-step approach. At first we derive some identities from the reduction rules which enable us to simplify representation of elements. Then we build a $6\times 6$ multiplication table from
\begin{align*}
A:=\{E,a,b,a^2,ab,a^2b\}\subset G\tag{1}
\end{align*}
and check if each row and each column contains all elements from $A$, from which we can conclude that
\begin{align*}\
\color{blue}{A=G}
\end{align*}
Reduction rules:
We know that $\{E,a,b,a^{-1},b^{-1}\}\subseteq G$, since $G$ is a group containing the neutral element $E$ and with each element $g\in G$ the inverse $g^{-1}\in G$, whereby we have to keep in mind, that not always two elements are necessarily pairwise distinct.
At least we take for granted according to the problem statement that $E,a$ and $b$ are pairwise different.
From $a^3=E$ we obtain by multiplication with $a^{-1}$ and similarly from $b^2=E$ we obtain by multiplication with $b^{-1}$
\begin{align*}
a^2&=a^2E=a^2\left(a a^{-1}\right)=a^3 a^{-1}=Ea^{-1}=a^{-1}\tag{2.1}\\
b&=bE=b\left(bb^{-1}\right)=b^2b^{-1}=Eb^{-1}=b^{-1}\tag{2.2}
\end{align*}
From $(ab)^2=E$ we obtain by multiplication with $a^{-1}$ from the left and by multiplication with $b^{-1}$ from the right
\begin{align*}
a^{-1}=a^{-1}E=a^{-1}(ab)^2=\left(a^{-1}a\right)bab=bab\tag{2.3}\\
b^{-1}=Eb^{-1}=(ab)^2b^{-1}=\left(aba\right)\left(bb^{-1}\right)=aba\tag{2.4}
\end{align*}
Combining (2.1) to (2.4) we obtain

\begin{align*}
a^2&=a^{-1}=bab\tag{3.1}\\
b&=b^{-1}=aba\tag{3.2}
\end{align*}

A Pause and a recheck:
Looking again at (1) we observe the set $A$ shows some asymmetries.

*

*We find $a^2$ in $A$ but not $b^2$. No problem. We know from (3.1) and (3.2) that $a^2=a^{-1}$ and we also know that $b^2=E\in A$ and $b=b^{-1}\in A$.


*We find $a^2b$ but not $ab^2$. No problem, since $ab^2=aE=a\in G$.


*We find $ab$, but not $ba$. This should be clarified. We obtain from (3.1) and (3.2)
\begin{align*}
ba&=baE=bab^2=(bab)b=a^2b\in G\\
\end{align*}
and we are now ready to build up the multiplication table.
Multiplication table:
We obtain
\begin{align*}
\begin{array}{c|cccccc}
\cdot &E&a&b&a^2&ab&a^2b\\
\hline
E&E&a&b&a^2&ab&a^2b\\
a&a&a^2&ab&E&a^2b&b\\
b&b&a^2b&E&ab&a^2&a\\
a^2&a^2&E&a^2b&a&b&ab\\
ab&ab&b&a&a^2b&E&a^2\\
a^2b&a^2b&ab&a^2&b&a&E
\end{array}
\end{align*}
Since each row and each column contains the elements from $A$ we conclude
\begin{align*}
\color{blue}{A=G}
\end{align*}
