Let $G$ be a finite group and let $x$ and $y$ be distinct elements of order $2$ in $G$ that generate $G$. Prove that $G \cong D_{2n}$, where $n = |xy|.$
My attempt : Since every element of $G$ can be written as $x^a (xy)^b$ for $ 0 \le a\le 2$ and $0 \le b \le n$
let define a function $f : D_{2n} \to G $ by $$f(s^ar^b)=x^a(xy)^b$$
Now we can easily showed that $f$ is homomorphism
My question : How to show that the $f$ is one-one and onto ?
My attempt : to show $f$ is one-one ,we must have
$$f(s^ar^b)=f(s^cr^d)$$
$$x^a(xy)^b=x^c(xy)^d$$
to show $f$ is onto ,we have $$f(s^ar^b)=x^a(xy)^b$$