For all $n > 0$ express $D_{2n}$ as a semidirect product $\mathbb Z_n \rtimes_\theta \mathbb Z_2$, finding $\theta$ explicitly.
I am not sure how to go about finding $\theta: \mathbb Z_2 \to \mathrm{Aut}(\mathbb Z_n)$ explicitly.
The map is determined by where $1 \in \mathbb Z_2$ maps to. Based on playing with $\mathbb Z_2 \to \mathrm{Aut}(\mathbb Z_4)$, I predict $\theta$ will map to the automorphism sending $1 \mapsto -1$ in $\mathbb Z_n$.
However, I don't want to just guess where to send $1$ to.
How would I begin to systematically find $\theta$ explicitly?