If a finite group has a generating set containing two elements of order 2, then it is a dihedral group

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|$.

Since $G$ is finite, $n = |xy| < \infty$. By a previous exercise, $x$ and $xy$ satisfy the relations of the usual presentation for $D_{2n}$; namely, $D_{2n} = \langle r,s \ |\ r^n = s^2 = 1, rs = sr^{-1} \rangle$. Moreover, $G$ is generated by $x$ and $xy$; we know $G$ is generated by $x$ and $y$ and we have $y = (x^{-1}) \cdot (xy)$. From our discussion about $D_{2n}$, then, every element of $G$ can be written uniquely as $x^a(xy)^b$ for some $0 \leq a < 2$ and $0 \leq b < n$. We can thus define a mapping $\varphi : D_{2n} \rightarrow G$ by $\varphi(s^ar^b) = x^a(xy)^b$. This mapping is well defined since every element of $D_{2n}$ has a unique representation as $s^ar^b$ for some $0 \leq a < 2$ and $0 \leq b < n$. Moreover, $\varphi$ is a homomorphism since $\varphi(s^a r^b \cdot s^c r^d) = \varphi(s^{a+c} r^{d-b}) = x^{a+c} (xy)^{d-b}$ $x^a (xy)^b \cdot x^c (xy)^d$ $= \varphi(s^ar^b) \cdot \varphi(s^c r^d)$. $\varphi$ is also injective, due to the uniqueness of representations of elements in $D_{2n}$ and $G$ in terms of $r$ and $s$ adn $x$ and $xy$, respectively, and is surjective similarly. Thus $G \cong D_{2n}$.