
I have rephrased the question as follows :
Here, $\langle v,w\rangle=v^tw$ is the usual dot product.
Let $A$ be an $n \times n$ symmetric matrix.
Let $l_1, l_2, \ldots , l_{r+s}$ be $(r + s)$ linearly independent $n\times 1$ vectors such that for all $n$ × $1$ vectors $x$,
$$\langle x,Ax\rangle = \langle l_1, x\rangle^2 + \cdots + \langle l_r, x\rangle^2 − \langle l_{r +1},x\rangle^ 2 − \cdots − \langle l_{r +s}x\rangle^2$$
Prove that $\operatorname{rank}(A) = r + s$.
My thoughts :
1.We can say that the matrix is diagonalizable.
2. $A$ has $n$ real eigenvalues. So, we can try proving that it has exactly $r+s$ non-zero eigenvalues.
3.We can alos try proving that there are exactly $n-(r+s)$ vectors in the $\ker(A)$. If $x \in \ker(A)$ , then from the equation, we get that
$$\langle l_1, x\rangle^2 + \cdots + \langle l_r, x\rangle^ 2 = \langle l_{r+1}, x\rangle^2 + \cdots + \langle l_{r +s}x\rangle ^2$$
I'm not able to proceed with this. Any hints to proceed further are welcome. Thank You.
Prove that if $A,B$ are real symmetric matrices such that $x^tAx=x^tBx$ for every $x$ then $A=B$.
Then notice that $\displaystyle B=\sum_{1\leq l_i\leq r}l_il_i^t-\sum_{r<i\leq s}l_il_i^t$ satisfies $x^tAx=x^tBx$ for every $x$.
Let $R_{n\times n}$ be an invertible matrix such that $Rl_i=e_i$, where $e_1,\ldots,e_n$ is the canonical basis. Notice that $RBR^t$ is a diagonal matrix with the same rank of $B$.