A statement on the quadratic form Let $A$ be a $n\times n$ real symmetric matrix with its positive index of inertia and negative index of inertia beign $p$ and $q repectively; that is, under a linear invertible transformation,
$$f(x)=x^tAx=y_1^2+\cdots+y_p^2-y_{p+q}^2-\cdots-y_{p+q}^2$$
Set $N_f(x)=\{x;f(x)=0,x\in\Bbb R^n\}$. Show that the dimension of vector space contained in $N_f(x)$ is at most $n-\max(p,q)$.
It is easy to find a vector space $V\subset N_f(x)$ with a basis (without loss of generality, assume $p\leq q$) $e_1+e_{p+1}$, $e_2+e_{p+2}$, $e_p+e_{2p}$, $e_{p+q+1}$, $\cdots$, $e_n$.
However, how can we prove the above statement? Using argue by contradiction? How then?
 A: Let $\mathcal{B}=\{v_1,v_2,\ldots,v_p,v_{p+1},\ldots,v_{p+q},v_{p+q},\ldots,v_n\}$ be a basis of $\Bbb{R}^n$ such that
$$f(\sum_{i=1}^ny_iv_i)=y_1^2+\cdots+y_p^2-y_{p+1}^2-\cdots-y_{p+q}^2.$$
Let $V_+$ (resp. $V_-$) be the span of $\{y_1,\ldots,y_p\}$ 
(resp. $\{y_{p+1},\ldots,y_{p+q}\}$). Let $V_0$ be the span of $\{y_{p+q+1},\ldots,y_n\}$. We have the two projections $p_+:\Bbb{R}^n\to V_+\oplus V_0$ and $p_-:\Bbb{R}^n\to V_-\oplus V_0$ given by
$$
p_+(\sum_{i=1}^ny_iv_i)=\sum_{i=1}^py_iv_i+\sum_{i=p+q+1}^ny_iv_i
$$
and
$$
p_-(\sum_{i=1}^ny_iv_i)=\sum_{i=p+1}^{p+q}y_iv_i+\sum_{i=p+q+1}^ny_iv_i.
$$
Claim: The sets $N_f\cap \operatorname{ker}(p_+)$ and $N_f\cap \operatorname{ker}(p_-)$ are both trivial.
Proof. Assume that $x\in N_f\cap \operatorname{ker}(p_+)$. Writing $x$ in
terms of $\mathcal{B}$ we have $x=\sum_{i=1}^nx_iv_i.$ Because $p_+(x)=0$
this means that $x_1=x_2=\cdots=x_p=0=x_{p+q+1}=\cdots=x_n$. Therefore 
$$f(x)=-(x_{p+1}^2+\cdots+x_{p+q}^2).$$
For this to vanish it is necessary that $x_{p+1}=x_{p+2}=\cdots=x_{p+q}=0$ as well, so $x=0$. The other claim is shown analogously.
Your main claim then follows easily. Assume that $W\subseteq N_f$ is a vector space. The claim implies that $W$ must project injectively into both $V_+\oplus V_0$ and $V_-\oplus V_0$. Therefore (rank-nullity) 
$$\dim W\le \dim V_0+\dim V_+=n-q$$ and 
$$\dim W\le \dim V_0+\dim V_-=n-p.$$
