Let
$$D_{n}=\langle a,b\mid abab,b^2,a^n \rangle$$be the $n$th dihedral group. If $n$ is odd prove that $D_{2n} \cong \langle a^n \rangle \times \langle a^2,b\rangle.$
My solution:
First of all $|D_{2n}|=4n.$
$$\tilde{f} : F_{\{a^2,b\}} \to D_{2n}$$
\begin{array}{ccc} a^2 & \mapsto & r\\ b & \mapsto & s\\ \{a^2,b\} & \rightarrow & D_{2n}\\ \downarrow & \underset{\tilde{f}}{\nearrow}\\ F_{\{a^2,b\}} \end{array}
$\tilde{f} $ homomorphism is surjective because $r$ and $s$ generate $D_{2n}$.
Each element of $G$ is represented by one of the following elements: $(1,1),(1,a^2),(1,a^4) \cdots (1,a^{2n-2}),(1,b),(1,a^2b) \cdots (1,a^{2n-2}b)$ $(a^n,1),(a^n,a^2),(a^n,a^4) \cdots (a^n,a^{2n-2}),(a^n,b),(a^n,a^2b) \cdots (a^n,a^{2n-2}b)$
Exactly $4n$ elements so $\tilde{f} $ is injective.
I am really not sure in my $\tilde{f} $ and in my basis, I'd be grateful for some feedback.