TITLE: The number of subgroups of index two in $G$
QUESTION [8 upvotes]: Statement: Let $G$ be a finite group. Then $ I_2(G)=[G:G^2]-1$. 
where; $I_2(G)$ is the number of subgroups of index two in $G$ , $[G,G^2]$ represents the index of $G^2$ in $G$ and $G^2= \langle \{x^2: x\in G\} \rangle$.
My work: First I proved that $G^2$ is the subgroup of $G$ generated by squares of elements in $G$ and also $G^2$ is normal in $G$. I found that $\frac{G}{G^2}$ is abelian.
Then, I took for instance,  $G=D_n=\langle R,S:$ $R$ is a rotation with $o(R)=n$ and $S$ is  reflection$\rangle $ so that $G^2= \langle R^2 \rangle$. Which tells that the above statement is true for $D_n$.
My Question: I thought a lot for the proof of this statement but I am not getting any useful tool\concept to prove this.

Please provide a proof of this statement.

REPLY [2 votes]: Here's a proof with no real calcuations. Some details have been omitted for the sake of brevity (e.g. justify the "and so" in point (2)), but they are relatively straightforward exercises.

As every subgroup of index two is normal, the number of subgroups of index two in $G$ is equal to the number of non-trivial maps $G\twoheadrightarrow\mathbb{Z}_2$, and so equal to $\#(\text{homomorphisms $G\rightarrow\mathbb{Z}_2$})-1$ (the "$-1$" corresponds to the unique non-surjective map, which has kernel the whole group). So lets find $\#(\text{homomorphisms $G\rightarrow\mathbb{Z}_2$})$.
Every map $G\rightarrow \mathbb{Z}_2$ factors through the group $G/G^2$, and so $\#(\text{homomorphisms $G\rightarrow\mathbb{Z}_2$})=\#(\text{homomorphisms $G/G^2\rightarrow\mathbb{Z}_2$})$.
As every element of $G/G^2$ has order two, the group $G/G^2$ is isomorphic to $\mathbb{Z}_2^n$ (the direct product of $n$ copies of $\mathbb{Z}_2$).
The group $\mathbb{Z}_2^n$ has $n$ generators, as the images of these generators define the map $\mathbb{Z}_2^n\rightarrow \mathbb{Z}_2$. Each generator either survives or is killed (is "on" or "off"). Hence, $\#(\text{homomorphisms $\mathbb{Z}_2^n\rightarrow\mathbb{Z}_2$})=2^n=[G:G^2]$. The result follows.