# Quadratic form vanishing at certain points

Let $$A\in\mathbb{R}^{d\times d}$$ be a symmetric matrix, and $$X_1,\dots, X_n\in \mathbb{R}^d$$ be vectors with $$n>d$$ (if more convenient, one can assume $${\rm span}(X_1,\dots,X_n)=\mathbb{R}^d$$.

Assume that, for every $$i$$, $$X_i^T AX_i=0$$. What does this tell us about $$A$$ (of course, as a function of $$X_1,\dots,X_n$$?

For instance, if we had that $$x^T Ax = 0$$ for every $$x\in\mathbb{R}^d$$, then we would have obtained that $$A$$ is skew-symmetric, that is, $$A^T=-A$$, which, together with the fact that $$A$$ is symmetric, would have yielded $$A=0$$.

Yet another example, take $$n=d$$, and $$X_i=e_i$$, the $$i ^{th}$$ element of the standard basis of $$d-$$dimensional Euclidean space. Then, all we can say is that the diagonal entries of $$A$$ are $$0$$.

If it will make the things simple: Assume that, $$n>d^2$$, and that, $$X_1,\dots,X_n$$ are iid random vectors with $$d-$$iid standard normal entries. What then happens? Can we deduce $$A=0$$, if conditional on some event, we have more equations than the unknowns?

Here's a partial answer. If $$\ n\ge \frac{d\left(d+1\right)} {2}\$$, and the matrices $$\ X_i^\top X_i,\$$ $$i= 1,2,\dots,n\$$ span the space of symmetric $$\ d\times d\$$matrices (which will be true with probability $$1$$ whenever the entries of the $$\ X_i\$$ are independent normal variates with positive variance) then you can conclude that $$\ A=0\$$.

This follows from the fact that if the stated condition is true, then for every pair of integers $$\ j,k\$$ with $$\ 1\le j\le k \le d\$$, there will exist $$\ \alpha_1, \alpha_2, \dots, \alpha_n$$ such that $$\ \sum_\limits{i=1}^n \alpha_i X_i^\top X_i=e_j^\top e_k + e_k^\top e_j \$$. We then have $$\ 0= \sum_\limits{i=1}^n \alpha_i X_i^\top AX_i\ = e_j^\top Ae_k + e_k^\top Ae_j= 2a_{jk}\$$, where $$\ a_{jk}\$$ is the entry in the $$\ j^\mathrm{\,th}\$$ row and $$\ k^\mathrm{\,th}\$$ column of $$\ A\$$.

@lonza leggiera: many thanks. just for archival purposes, I've decided to fill in several steps of the outline you've provided.

Recall that, $$X_1,\dots,X_n \sim N(0,I_d)$$ iid, with $$X_i \in \mathbb{R}^d$$ (namely, $$X_i$$ to be regarded as a column vector).

1) If $$n>d^2$$ then with probability $$1$$, $${\rm span}(X_iX_i^T :1\leqslant i \leqslant n) = S^{d \times d}$$, where $$S^{d\times d}=\{M\in \mathbb{R}^{d\times d}:M^T=M\}$$. To see this, perhaps one way is to argue as follows. Consider an operator $$V$$ acting on $$X_iX_i^T$$, and vectorizing it, and consider a $$d^2\times n$$ matrix $$M$$ whose $$i^{th}$$ columns is $$X_iX_i^T$$. We claim that, $$\mathbb{P}[{\rm rank}(M)=d^2]=1$$. Indeed, assuming not, we have the event $$\{{\rm rank}(M). On this event, any $$d^2$$ vectors form a $$d^2\times d^2$$ matrix with zero determinant. Let $$X$$ be a matrix formed by columns $$V(X_iX_i^T)$$ for $$1\leqslant i\leqslant d^2$$. Then, $$\{{\rm rank}(M), where the final event clearly has measure $$0$$, as it is a function of iid continuous random variables.

Suppose therefore that in the remainder, we condition on $$\mathcal{E}=\{{\rm span}(X_iX_i^T:1\leqslant i \leqslant n)=S^{d\times d}\}$$, where $$\mathbb{P}[\mathcal{E}]=1$$.

2) Let $$e_k,e_\ell$$ be $$k^{th}$$ and $$\ell^{th}$$ basis vectors for $$d-$$dimensional Euclidean space. Then, conditional on $$\mathcal{E}$$, we have that there exists $$\theta_i^{(k,\ell)}$$ such that: $$\sum_{i =1}^n \theta_i^{(k,\ell)}X_iX_i^T = e_k e_\ell^T + e_\ell e_k^T.$$

3) Now, observe that, $${\rm trace}(X_i^T A X_i)= {\rm trace}(X_iX_i^T A)$$. Hence, $$0=\sum_{i =1}^n \theta_i^{(k,\ell)}X_i^T A X_i = \sum_{i =1}^n {\rm trace}(\theta_i^{(k,\ell)} X_i X_i^T A) = {\rm trace}(\sum_{i =1}^n \theta_i^{(k,\ell)} X_i X_i^T A) = {\rm trace}(e_ke_\ell^T A)+{\rm trace}(e_\ell e_k^T A)=2A_{k,\ell}.$$ Therefore, $$A_{k,\ell}=0$$, for every $$1\leqslant k\leqslant \ell \leqslant d$$, as claimed.