Dihedral Group D4/Subgroups

Subgroups of the Dihedral Group $D_4$
Let the dihedral group $D_4$ be represented by its group presentation:

The subsets of $D_4$ which form subgroups of $D_4$ are:

Proof
Consider the Cayley table for $D_4$:

We have that:
 * $a^4 = e$

and so $\gen a = \set {e, a, a^2, a^3}$ forms a subgroup of $D_4$ which is cyclic.

We have that:
 * $\paren {a^2}^2 = e$

and so $\gen {a^2} = \set {e, a^2}$ forms a subgroup of $D_4$ which is cyclic, and also a subgroup of $\gen a$.

We have that:
 * $b^2 = e$

and so $\gen b = \set {e, b}$ forms a subgroup of $D_4$ which is cyclic.

We have that:
 * $\paren {b a}^2 = e$

and so $\gen {b a} = \set {e, b a}$ forms a subgroup of $D_4$ which is cyclic.

We have that:
 * $\paren {b a^2}^2 = e$

and so $\gen {b a^2} = \set {e, b a^2}$ forms a subgroup of $D_4$ which is cyclic.

We have that:
 * $\paren {b a^3}^2 = e$

and so $\gen {b a^3} = \set {e, b a^3}$ forms a subgroup of $D_4$ which is cyclic.

Then we have that:
 * $b a^2 = a^2 b$

and so $\gen {a^2, b} = \set {e, a^2, b, b a^2}$ forms a subgroup of $D_4$ which is not cyclic, but which has subgroups $\set {e, a^2}$, $\set {e, b}$, $\set {e, b a^2}$.

Then we have that:
 * $b a^3 = a^2 b a$

and so $\gen {a^2, b a} = \set {e, a^2, b a, b a^3}$ forms a subgroup of $D_4$ which is not cyclic, but which has subgroups $\set {e, a^2}$, $\set {e, b}$, $\set {e, b a^2}$.

That exhausts all elements of $D_4$.

Any subgroup generated by any $2$ elements of $Q$ which are not both in the same subgroup as described above generate the whole of $D^4$.