= Solution
Associate to $Q$ its <symmetric bilinear form> by the <polarization identity>,
$$
B(x,y)=\frac{Q(x+y)-Q(x)-Q(y)}2,\qquad Q(x)=B(x,x).
$$
We first construct a diagonal <basis> by induction on the <dimension>. A zero <quadratic form> is already diagonal. Otherwise choose $v$ with $Q(v)\ne0$. Every $x$ has the decomposition
$$
x=\frac{B(x,v)}{Q(v)}v+\left(x-\frac{B(x,v)}{Q(v)}v\right),
$$
whose second term lies in $W=\{w:B(w,v)=0\}$. Also $\mathbb Rv\cap W=\{0\}$, so $V=\mathbb Rv\oplus W$ and $\dim W=n-1$. Apply the induction hypothesis to the restricted <quadratic form> on $W$. The cross terms with $v$ vanish, giving a diagonal <basis> on $V$. Rescale each vector with diagonal coefficient $a\ne0$ by $1/\sqrt{|a|}$, and reorder positive, negative and zero coefficients. This yields
$$
\boxed{Q(x)=\sum_{i=1}^p x_i^2-\sum_{i=p+1}^{p+q}x_i^2.}
$$
No nondegeneracy assumption was used.
For uniqueness, let $V_+$ be the positive coordinate subspace and $V_{\leq0}$ the span of all negative and zero coordinate vectors. Their dimensions are $p$ and $n-p$. Any subspace $W$ on which $Q$ has <positive definiteness> intersects $V_{\leq0}$ only in zero. The <dimension formula for a sum of subspaces> therefore gives $\dim W\leq p$. Conversely $V_+$ itself has dimension $p$ and positive restriction. Thus $p$ is the largest possible dimension of a positive subspace, an intrinsic description independent of the <basis>. Applying the same argument to $-Q$ shows that $q$ is the largest dimension of a negative subspace. This proves <Sylvester's law of inertia>, including uniqueness of the zero count $n-p-q$.
The extremal subspaces themselves need not be unique. For $Q(x,y)=x^2-y^2$, the coordinate axes give one positive and one negative line. For any $t\ne0$, put
$$
u=(\cosh t,\sinh t),\qquad v=(\sinh t,\cosh t).
$$
Then $Q(u)=1$, $Q(v)=-1$, $B(u,v)=0$, and the <determinant> of the change of <basis> is one. \b[The distinct lines $\mathbb Ru$ and $\mathbb Rv$ give another positive/negative decomposition], with the same intrinsic counts $p=q=1$.
Back to article page