Short version: 



> 
> Over which fields is the (appropriate version of the) "Sylvester law of inertia" valid?
> 
> 
> 


Long version:


Let $V$ be a finite dimensional vector space over the field $\Bbbk$ of characteristic different from $2$ (so quadratic forms are the same as symmetric bilinear forms). Consider the "discriminant" function 


$$\mathrm{discr}: \mathrm{Sym}^2(V^\*)\to \Bbbk/\Bbbk^2,$$


where $\Bbbk/\Bbbk^2$ is the quotient of the multiplicative monoid $\Bbbk$ by the squares, which maps a (possibly degenerate) symmetric bilinear form $q$ to the determinant of it's matrix relative to any base, which is well defined up to multiplication by squares. Of course, this is not a complete invariant, as different degenerate quadratic forms all have discriminant $0$.


Given $q\in\mathrm{Sym}^2(V^\*)$, and an orthogonal basis $B$ for $V$ in which $q$ has the form $\Sigma\_i\lambda\_ix\_iy\_i$, we have a "signature" map 


$$\sigma\_q^B:\Bbbk/\Bbbk^2\to\mathbb{N}$$ 


sending a $\lambda$ in the domain to the number of vectors in $B$ for wich the corresponding $\lambda\_i$ has image $\lambda$ in $\Bbbk/\Bbbk^2$.



> 
> 1) Is $\sigma\_q^B$ independent from $B$ ? 
> 
> 
> 


-



> 
> 2) If the answer to 1) is "yes", is $q\mapsto\sigma\_q$ a complete invariant for quadratic forms over $\Bbbk$ ? That is, is it true that two quadratic spaces $(V,q)$ and $(V',q')$ are isomorphic if and only if $\sigma\_q=\sigma\_{q'}$ ?
> 
> 
> 


For $\Bbbk=\mathbb{R}$ or $\mathbb{C}$ the answer to 1) and 2) is "yes": it's is the usual Sylvester law of inertia. Maybe the above general question has a well known or even elementary answer?...



Over which fields is the Sylvester law of inertia valid?
OK, I now have a complete answer; I'll delete the other shortly. The answer to question 2 is yes and easily so; I wonder if I am missing something. If one quadratic form is $\sum a\_i x\_i^2$, and other is $\sum b\_i y\_i^2$, and $a\_i = b\_i u\_i^2$ for $u\_i \neq 0$, then clearly the two quadratic forms are equivalent by the invertible change of variable $x\_i = y\_i u\_i$. 




---


Now for the interesting part. Let $K$ be a field. The following are equivalent:


(1) The answer to Question 1 is "yes".


(2) For every $a \in K$ we have (Condition 2a) either $a$ or $-a$ is square and (Condition 2b) the sum of two squares is a square.


(3) One of the following two cases occurs: (Case 3a) Every element of $K$ is square or (Case 3b) $K$ is an ordered field in which every positive element is square.


$(1) \implies (2)$: 


For $a \neq 0$, note that
$$\begin{pmatrix} (a+1)/2 & (a-1)/2 \\ (a-1)/2 & (a+1)/2 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \begin{pmatrix} (a+1)/2 & (a-1)/2 \\ (a-1)/2 & (a+1)/2 \end{pmatrix} = \begin{pmatrix} a & 0 \\ 0 & -a \end{pmatrix}$$
So the quadratic forms $x^2-y^2$ and $ax^2-ay^2$ are equivalent. We deduce that either $a$ or $-a$ is a square.


For any $a$ and $b$, not both zero, note that
$$\begin{pmatrix} a & b \\ -b & a \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \begin{pmatrix} a & -b \\ b & a \end{pmatrix} = \begin{pmatrix} a^2+b^2 & 0 \\ 0 & a^2+b^2 \end{pmatrix}$$
So the forms $x^2+y^2$ and $(a^2+b^2) x^2 + (a^2+b^2) y^2$ are equivalent, and we deuce that $a^2+b^2$ is a square.


$(2) \implies (3)$: If $-1$ is square, then Condition 2a implies that everything is square. If not, define a total order on $K$ by $x \leq y$ if $y-x$ is square. Condition 2a implies that this is a total order; condition 2b implies that it is transitive and compatible with addition; I leave it as an exercise that it is compatible with multiplication by positive elements. So $K$ is an ordered field where the positive elements are the squares, and we are in condition (3b).


$(3) \implies (1)$. If we are in case 3a, then the statement is trivial because $K/K^2$ only contains one nonzero element. In case 3b, look up your favorite proof that signature is a well-defined invariant of real quadratic forms, and note that it only uses these facts.




---


I suspect some classical algebraist assigned a name to fields as in 3b. They are more special than formally real field (where $-1$ is not a sum of squares), but less special than real closed fields (where, in addition to the properties in 3b, we require that every odd degree polynomial have a root). 


An example of a field as in 3b is the field of real numbers which have straight-edge and compass constructions.


