In R.W.R. Darling's "Differential Forms and Connections" an inner product is defined for a vector space $V$ as a bilinear, symmetric and nondegenerate (but not necessarily positive-definite) map from $V \times V$ to $\mathbb{R}$, denoted $\langle\ ,\ \rangle$. A basis $\{v_1,\dots,v_n\}$ of $V$ is then called an orthonormal basis if $\langle v_i,v_i \rangle = \pm 1$, $\langle v_i,v_j \rangle = 0$ for all $i,j \in \{1,\dots,n\}$ with $i \neq j$. One of the exercises is the following:
Let $\{v_1,\dots,v_n\}$ and $\{w_1,\dots,w_n\}$ be two orthonormal bases of an indefinite inner product space $V$, arranged such that $\langle v_i,v_i \rangle=1=\langle w_j,w_j \rangle$ for $1 \leq i \leq q,1 \leq j \leq r$, but for no other indices. Let $H$ denote the set $\{v \in V: \langle v,v\rangle \geq 0\}$. Show that $H$ is a subspace, and it has both $\{v_1,\dots,v_q\}$ and $\{w_1,\dots,w_r\}$ as bases. Conclude that $q=r$, and so the signature of an inner product space does not depend on the basis.
I am stuck with showing that $H$ is a subspace. It is clear that for $v \in H$, $\lambda \in \mathbb{R}$ we have $\langle \lambda v,\lambda v\rangle = \lambda^2\langle v,v\rangle \geq 0$ so that $\lambda v \in H$.
Now let $v,v' \in H$, then we need to show that $v+v' \in H$. It holds
$$\langle v+v', v+v'\rangle = \langle v,v\rangle + \langle v',v'\rangle + 2\langle v,v'\rangle.$$
At this point I do not know how to proceed. I would like to use some known inequality on inner products to show that the right expression must be non-negative, but the proof of the Cauchy-Schwarz inequality for instance uses that the inner product is positive definite, so I believe that it does not hold in our more general case.
In another attempt, I have tried expressing $v = a_1v_1 + \dots + a_nv_n$ and $v' = b_1v_1 + \dots + b_nv_n$ in terms of the given basis of $V$ and then using the bilinearity of the inner product which leads to
$$\langle v,\ v\rangle = a_1^2 + \dots + a_q^2 - (a_{q+1}^2 + \dots + a_n^2) \geq 0,$$
$$\langle v',\ v'\rangle = b_1^2 + \dots + b_q^2 - (b_{q+1}^2 + \dots + b_n^2) \geq 0,$$
$$\langle v,\ v'\rangle = a_1b_1 + \dots + a_qb_q - (a_{q+1}b_{q+1} + \dots + a_nb_n),$$
and thus we need to show that
$$\langle v,\ v\rangle + \langle v',\ v'\rangle + 2\langle v,\ v'\rangle = (a_1+b_1)^2 + \dots + (a_q+b_q)^2 - ((a_{q+1}+b_{q+1})^2 + \dots + (a_n+b_n)^2)$$
is non-negative. Again, at this point I do not get any further.
Please see the other answers for an explanation of why the statement of the problem (and the original version of this answer) is incorrect.