How to find the order of a group generated by two elements?

What is the order of a group $G $ generated by two elements $x$ and $y$ subject only to the relations $x^3 = y^2 = (xy)^2 = 1$? List the subgroups of $G$.

Since the above relation is the ‘only’ relation, I presume that the order of $x$ is $3$ and the order of $y$ is $ 2$. Also y is the inverse of itself, and xy is the inverse of itself. The inverse of $x$ is $x^2$.

I have calculated the elements of the group manually using the given relation.
$$G = \{1, x, x^2,y, xy, x^2y \}$$

I want to know if there is a formula to calculate the order of $G$? I came across another question where the above relation is $x^3 = y^2 = (xy)^3 = 1$. In this case the group $G has order 12. It is very time consuming to calculate the elements manually. Is there a better way?

Solutions Collecting From Web of "How to find the order of a group generated by two elements?"

First, we have
$$
xyxy = 1 \implies yx = x^{-1}y^{-1} = x^2y
$$
Since $xy = yx^2$, we conclude that every element of $G$ can be written in the form $x^jy^k$, which means that there are at most $|x| \cdot |y| = 6$ elements.
Listing the elements of $G$, we have:
$$1,x,x^2,y,xy,x^2y$$


Elaboration, per request:

Suppose we have a word such as
$x^2 y xy$
we can reduce this with the relation $yx = x^2y$ as
$$
x^2 y^2 xy = \\
x^2 y(yx) y =\\
x^2 y x^2 y y =\\
x^2 (yx) x y^2 =\\
x^2 x^2 (y x) y^2 =\\
x^2 x^2 x^2 y y^2 =\\
x^6 y^3
$$
Perhaps you see how such a method could be extended inductively.

We have $xy=(xy)^{-1}=y^{-1}x^{-1}$, hence $yxy=x^{-1}$. It is well-known that the group
$\langle x,y \mid x^3=y^2=1, yxy=x^{-1}\rangle $ is the dihedral group $D_3$. It has $6$ elements. Moreover $D_3\simeq C_2\ltimes C_3\simeq S_3$, with $C_2=\langle y \mid y^2=1\rangle$ and $C_3=\langle x \mid x^3=1\rangle$.