Let $f(x)=\sum_{i,j=1}^n a_{ij}x_ix_j+2\sum_{i=1}^n b_i x_i+c$ for $x\in \mathbb R^n$ where the coefficients $a_{ij},b_i,c$ are real, $a_{ij}=a_{ji}$ and not all $a_{ij}$ are equal zero. Let $$ Q:=\{x\in \mathbb R^n : f(x)=0\} $$ Let us assume that a $Q$ is contained in the set $$ H=\{x\in \mathbb R^n: x_n=0\}. $$
How to prove that $Q$ has to be an affine subspace (possible empty) of $\mathbb R^n$?
Thanks
EDIT 2. We show that $f(x)=\pm ((f_1(x))^2+\cdots+(f_k(x))^2+ux_n^2)$ where $u>0$ and the $f_i$ are affine. In particular, the form $f(x)=\pm ux_n$ is impossible because the matrix $A=[a_{i,j}]$ is not zero.
Proof. Let $y=(x_i)_{i\leq n-1}$. Then $f(x)=f_1(y)+ux_n^2+x_nf_2(y)$ where $f_1$ has degree $2$ and $f_2$ has degree $1$.
Case 1. $u=0$. Assume that there is $y_0$ s.t. $f_1(y_0)\not=0$. If $f_2(y_0)=0$, then $Q$ is empty. If $f_2(y_0)\not=0$, then there is a solution $x_n\not=0$, a contradiction. Thus $f_1=0$ and $f(x)=x_nf_2(y)$.
If there is $y_0$ s.t. $f_2(y_0)=0$, then there is a non-zero solution in $x_n$, a contradiction. Thus $f_2$ is a constant $a\not=0$ and $f(x)=ax_n$, that is contradictory because the matrix $A=[a_{i,j}]$ is not zero.
Case 2. $u\not=0$. For example $u>0$. If there is $y_0$ s.t. $f_1(y_0)<0$, then $f(y_0,0)<0$ and $f(y_0,x_n)>0$ for $x_n>0$ large enough, that is contradictory.
Then $f_1\geq 0$. Let $g(y,z)$ be homogeneous of degree $2$ s.t. $g(y,1)=f_1(y)$; if $z\not=0$, then $g(y,z)=z^2g(y/z,1)\geq0$; since $g(y,0)=0$, we deduce that $g\geq0$ and can be decomposed in a sum of squares of linearly independent forms $g=\sum_ig_i^2$; finally $f_1(y)=g_1(y,1)^2+\cdots+g_k(y,1)^2$ where the $g_i(y,1)=h_i(y)$ are linearly independent affine functions. Note that at most one $h_i$ may be a constant. Let $H=(h_i)$.
Now $f(x)=h_1^2(y)+\cdots+h_k^2(y)+ux_n^2+x_nf_2(y)$. If there is $y_0$ s.t. $\Delta(y_0)=f_2^2(y_0)-4u(\sum_i h_i^2(y_0))>0$, then there are two distinct solutions in $x_n$, a contradiction. Thus $\Delta\leq 0$ -in particular $f\geq 0$-. If $\Delta(y)<0$, then no solution in $x_n$. If $\Delta(y)=0$, then, necessarily, there is a double solution $x_n=0$, that is, $f_2(y)=0,h_i(y)=0$.
Since $h_1(y)=\cdots=h_k(y)=0$ implies that $f_2(y)=0$, there is a vector $\Lambda=(\lambda_i)$ s.t. $f_2=\sum_i \lambda_ih_i$. Thus $(\sum_i\lambda_ih_i)^2\leq4u\sum_ih_i^2$, that is, $(<\Lambda,H>)^2\leq4u||H||^2$ and, more precisely: for every $H\not=0$, $(<\Lambda,H>)^2< 4u||H||^2$. Since the affine functions $(h_i)$ are linearly independent, the previous condition is equivalent to $||\Lambda||^2<4u$.
Therefore $f(x)=h_1^2(y)+\cdots+h_k^2(y)+ux_n^2+x_n\sum_i\lambda_ih_i(y)=\sum_i (h_i(y)+(\lambda_i/2)x_n)^2+x_n^2(u-\sum_i\lambda_i^2/4)$
and we are done. $\square$