Sums of squares are closed under division Surprisingly, we got only one question for our 2-hour exam and I think nobody solved it. Here is the problem:

Assuming that $K$ is a field, show that $S$ is stable under addition,  multiplication and division, where $S$ is defined as follow:
  $$S=\left\{\sum_{i=1}^{n}{x_i}^2 \mid n\in \Bbb N ,\ x_i\in K\right\}.$$


$\begin{align}{\bf Hint} \ \ a\neq 0\
\Rightarrow&\ \ \color{#c00}{a^{\large -2}} =\, (a^{\large -1})^{\large 2} \in S\ \ \text{by $\,S\,$ contains all squares}\\
{\rm so}\ \ \ a\in S\ \Rightarrow&\ \ a^{\large -1} =\, a\cdot \color{#c00}{a^{\large-2}}\in S\ \ \text{by $\,S\,$ is closed under multipication}
\end{align}$
Remark $ $ You asked how it generalizes. The above idea works not only for squares, but for any positive power, i.e. we can obtain $\,a^{-1}\,$ from any of its positive powers via $\,a^{\large -1} = a^{\large n-1}(a^{\large -1})^{\large n}.$ Also the only property of squares (or powers) employed in proving multiplicative closure is that they are closed under multiplication. These observations lead to the following generalization.
Theorem $ $ Suppose $K$ is a field, $M$ is a subset of $K$ and $S$ is the set of all sums of elements of $M.$
$(1)\ \ S$ is closed under multiplication if $M$ is closed under multiplication.
$(2)\  \ S$ is closed under division (by all nonzero elements) if $S$ is both closed under multiplication, and every $\,a\in K$ has some positive power $\,a^{\large n}\in S.$ 
Proof $\ (1)\,$ is an immediate consequence of the distributive law. $\ (2)\ $ follows as above, namely if $\,0\neq s\in S\,$ then by hypothesis $\,(s^{\large -1})^{\large n}\in S\,$ for some $\,n\geq 1\,$ thus $\,s^{\large n-1}(s^{\large -1})^{\large n} = s^{\large -1}\in S\,$ because $S$ is closed under multiplication. Hence $\,a\in S\,\Rightarrow\,as^{-1} = a/s\in S,\,$ so $S$ is closed under division.  
