Let $G$ be a group and $K = \{x^2 \mid x\in G\}$ 
Let $G$ be a group such that $K = \{x^2 \mid x\in G \}$ is a subgroup of $G$.
(a) If $H$ is a subgroup of $G$ with index $2$ show that $K\subset H$.
(b) Show that the number of subgroups in $G$ with index $2$ is equal to
  the number of subgroups in $G/K$ with index $2$.

Let $k\in K$ then there exist $x\in G$ such that $k=x^2$.
(i) If $x\in H$, then $k=x^2\in H$
(ii) If $x$ is not in $H$ then $G=${$H,xH$} and because $xH\neq x^2H$ so $x^2H=H$ and $k=x^2\in H$
Can I write this like that? or is there something wrong for (a) and for (b). I didn't find anything, help me please

Your proof of point a) is correct albeit that $x^2H \neq xH$ should be explained. Indeed $x^2 = xh \implies x = h \implies x \in H$, contradiction. For the proof of b) we first have to prove that $K$ is normal, the rest is simply a consequence of the "fourth" isomorphism theorem (see  point nr. 3). We have  $g^{-1}kg = g^{-1}x^2g = g^{-1}xgg^{-1}xg =  (g^{-1}xg)^2$.
