Question about the number of elements of order 2 in $D_n$ 
$$\text{Given}\;\; D_n = \{ a^ib^j \mid \text{ order}(a)=n, \text{ order}(b)=2, a^ib = ba^{-i}  \}$$ $$\text{ how many elements does $D_n$ contain that have order $2$ ?}$$

My answer would be:
We can write any element as $a^ib^j$. If $j$ is odd, then we can write it as $a^ij$, whereas if $j$ is even, then $b$ just cancels out.
So to count:


*

*$b$ is one element of order $2$.

*If $j$ is odd we have $a^ib$.  $(a^ib)^2= a^i(ba^i)b = a^i a^{-i} bb = e$. So all elements of the form $a^ib$ have order $2$. These are $n$ elements.

*If $j$ is even we can write the remaining elements as follows: $a^i$ . This element has order $2$ only if $i=n/2$. This can only be true if $n$ is even.


So my final answer would be  $n+1$ if $n$ is odd, $n+2$ if $n$ is even... Do you think this is correct? Can I improve this somewhere?
Thanks !
 A: $D_3, D_4$, the dihedral groups of order $6, 8$ respectively, each serve as a counterexample to the odd, and even cases, respectively. In odd case, the number of elements of order $2$ is $\bf n$. In the even case, we have $\bf n+1$ elements of order $2$.
As pointed out in a comment, in your second case, if $i = n$, you have that $a^nb = b.$ That scenario was accounted for in the first case. 
Otherwise, you did a nice job, just over-counted each case by one. A "sanity check" was all that was needed: comparing your results with simpler $D_n$ that you know, as in $D_3, D_4$, was all that was needed to see a slight over-count.
A: As pointed out in vadim123's comment, you have included $b$ twice, since $a^ib=b$ when $i=n$ (or equivalently when $i=0$).  Otherwise, your analysis is correct.  Thinking geometrically, $D_n$ has $n$ reflections, each of order $2.$  If the $180^\circ$ rotation is an element of the group, which it is when $n$ is even, that makes an additional element of order $2.$
Added: The $n$ reflection axes of the regular $n$-gon join the vertices to the centers of the opposite edges when $n$ is odd, and join either opposite vertices or centers of opposite edges when $n$ is even.  The $180^\circ$ rotation is an element of the group only when there is a vertex diametrically opposite each vertex, which only happens for $n$ even.
