Galois group of infinite extension generated by all square roots of rationals Let $L$ be the field obtained by adjoining all the square roots of all rationals.  We know that $L/\mathbf Q$ is an infinite Galois extension.

Prove that the map
  \begin{align*}
    f:G=\operatorname{Gal}(L/\mathbf Q) & \longrightarrow \text{Hom}_{\text{Grp}}(\mathbf Q^\times,\{\pm 1\}) \\
    \sigma &\longmapsto \left[a\longmapsto \dfrac{\sigma(\sqrt{a})}{\sqrt{a}}\right]
\end{align*}
  is an isomorphism of topological groups, if $\text{Hom}_{\text{Grp}}(\mathbf Q^\times,\{\pm 1\})$ has the subspace topology inherited by $\{\pm 1\}^{\mathbf Q^\times}$.
Prove also that this Galois group is isomorphic to the product of a countably infinite collection of copies of $\{\pm 1\}$.

It is easy to prove that $f$ is an injective group homomorphism. Since $G$ is compact and $\{\pm 1\}^{\mathbf{Q}^\times}$ is Hausdorff, all left to prove is that $f$ is surjective.
I am confused by what to do with this $\text{Hom}_{\text{Grp}}(\mathbf Q^\times,\{\pm 1\})$.. The way I wanted to proceed is to define $\mathcal{P}=\{\sqrt{-1}\} \cup \{\sqrt{p}\mid p\text{ prime}\}$. Now $L=\mathbf{Q}(\{x\mid x\in \mathcal{P} \})$ (here I reduce all $a\in \mathbf{Q}$ to just the $a\in \mathcal{P}$, but this is not what the problem seems to want). I have proven that $\operatorname{Gal}(\mathbf{Q}(\sqrt{p_1},\ldots,\sqrt{p_n}))\simeq (\mathbf{Z}/2\mathbf{Z})^n$ if $p_1,\ldots,p_n$ are distinct elements of $\mathcal{P}$. I somehow want to take the inverse limit on both sides, but this does not give me an isomorphism with the $\text{Hom}$-thing.. (However, I think this is the way to go for the second part of the question.)
Could someone provide any help?

Edit: I think proving surjectivity is the easiest way to proceed. As Nguyen Quang Do suggested, we have an isomorphism
$$\mathbf Q^\times \stackrel{\sim}{\longrightarrow} \bigoplus_{n\in \mathcal{P}} \mathbf Z$$
induced by the unique factorisation of a rational number.
Now, we then find that $$\text{Hom}\left(\mathbf Q^\times,\{\pm 1\} \right)\cong \text{Hom}\left(\bigoplus_{p\in\mathcal{P}} \mathbf Z \right)\cong \prod_{p\in \mathcal{P}}\text{Hom}(\mathbf Z,\{\pm 1\})\cong \prod_{p\in \mathcal{P}} \{\pm 1\}..$$
This is nasty I think. If it were a direct sum, we could just pick the extension generated by the squares of elements of $\mathcal{P}$ occuring at the non-zero places, but unfortunately we have a product. Any help is much appreciated.
 A: (Preliminary remark : It's our colleague Lubin who pointed out the isomorphism $\mathbf Q^* \cong \prod_p \mathbf Z$ ) 
It would be more natural (by definition) to interpret your infinite $G=Gal(L/\mathbf Q)$ as the projective limit of a system of quotient groups. Here you could take the projective system of all the quotient groups $G_n=Gal(\mathbf Q(\sqrt p_1,...,\sqrt p_n)/\mathbf Q)$ because every rational is a product of primes up to squares . The $Hom$ thing comes in with (finite) Kummer theory: for a fixed $n$, because $\mathbf Q$ contains a primitive square root of $1$, the analogue $f_n$ of your map denoted $f$, yields an isomorphism $G_n≅Hom(R_n,(\pm 1))$, where $R_n$ is the subgroup of ${\mathbf Q^∗}/{\mathbf Q^*}^2$  generated by $p_1,...,p_n$. It will perhaps be convenient to (mentally) write additively the $R_n$'s and their direct limit  ${\mathbf Q^∗}/{\mathbf Q^*}^2$, viewed  as vector spaces over $\mathbf F_2$; the $Hom$ groups will be the dual vector spaces. Then $G=\varprojlim G_n \cong  Hom({\mathbf Q^∗}/{\mathbf Q^*}^2,(\pm 1))=Hom({\mathbf Q^∗}, (\pm 1))$. Topologically, $G$ is compact (as a profinite group), whereas $Hom({\mathbf Q^∗}, (\pm 1))$ is a subset of the set $Map({\mathbf Q^∗}, (\pm 1))$. I don't think it would be very instructive to check that the topologies on $Hom({\mathbf Q^∗}, (\pm 1))$ inherited from  $Map({\mathbf Q^∗}, (\pm 1))$ and from $G$ are the same. Note the essential role played by Kummer duality.
