Solution (source code)

= Solution

For a real <symmetric bilinear form>, a basis puts its quadratic expression in diagonal form with $p$ positive, $q$ negative and $r$ zero squares. Its rank is $p+q$, the rank of the coefficient matrix, or equivalently the codimension of its radical. Its <signature> is $p-q$; the <signature pair> is $(p,q)$, another common convention.

These quantities do not depend on the basis. A basis change replaces the matrix $M$ by $P^TMP$ with $P$ invertible, preserving matrix rank. The number $p$ is intrinsically the largest dimension of a subspace on which the form is positive definite. In a diagonal representation the positive coordinate space attains this dimension; any subspace of dimension greater than $p$ intersects the negative-plus-null coordinate space nontrivially and therefore cannot be positive definite. The same argument with signs reversed characterizes $q$. This proves the needed invariance, rather than assuming it from a chosen representation.

Decompose the full matrix space as
$$
M_n(\mathbb R)=\operatorname{Sym}_0(n)\oplus\operatorname{Skew}(n)\oplus\mathbb RI,
$$
using the symmetric traceless, skew-symmetric and scalar parts. The summands are orthogonal for the given form. Indeed $\operatorname{tr}(SK)=0$ for symmetric $S$ and skew-symmetric $K$, by transposition and cyclic invariance of <trace>, while both non-scalar summands are traceless and hence orthogonal to $I$. On them,
$$
\phi(S,S)=\operatorname{tr}(S^2)=\|S\|_F^2>0,\quad\phi(K,K)=\operatorname{tr}(K^2)=-\|K\|_F^2<0,\quad\phi(tI,tI)=-n(n-1)t^2<0
$$
for nonzero vectors in their respective summands. The dimensions are $n(n+1)/2-1$, $n(n-1)/2$ and one. Therefore the <modified trace form on real matrices> has
$$
\boxed{\operatorname{rank}\phi=n^2,\qquad\operatorname{signature}\phi=n-2},\qquad\boxed{(p,q)=\left(\frac{n(n+1)}2-1,\frac{n(n-1)}2+1\right)}.
$$
There is no radical for $n\geq2$.