# Number of solutions of quadratic equation from a perfect pairing over $\mathbb{Z}/p^n\mathbb{Z}$

Let $$p>2$$ be a prime number, $$V=\left(\mathbb{Z}/p^n\mathbb{Z}\right)^{2k+1}$$. The bilinear form $$B:V\times V \rightarrow \mathbb{Z}/p^n\mathbb{Z}$$ is a perfect pairing. That is, mapping $$x\in V$$ to $$B(x,-)\in V^*$$ is an isomorphism between $$V$$ and $$V^*$$.

Is it true that the number of solutions to $$B(x,x)=0$$ does not depend on $$B$$. Also, what is intuition that this is happening for odd rank $$V$$, but not even ones? How about over general rings?

Edit: It has been pointed out that this won't hold for general $$B(x,x)=c$$ (which was the original version of this question). Looks like it is true for $$c=0$$, though. Still want to ask the intuition behind.

I believe this invariance can lead to some interesting facts. Like this MO post, tries to count the number of solutions to the quadratic equation $$𝑥^2_1+⋯+𝑥^2_m=0.$$ If $$m=2k+1$$ is odd, This is indeed our case when $$B$$ is the identity matrix. Using the invariance, one can compute it by counting the number of solutions to $$x_1(x_2+\ldots+x_{2k+1})+x_2(x_3+\ldots+x_{2k+1})+\ldots + x_{2k}x_{2k+1}=0,$$ which comes from the case $$B=\begin{pmatrix} 0 & 0 & \cdots & 0 & 1\\ 1 & 0 & \cdots & 0 & 0\\ 1 & 1 & \cdots & 0 & 0 \\ \vdots & \vdots & \cdots & \vdots &\vdots \\ 0 & 1 &\cdots &1 &0 \end{pmatrix}$$.

This is already false for $$k=0$$ (and $$n$$ arbitrary)
Le $$B_0(x,y)=xy$$ and $$B_1(x,y)=-xy$$, and $$c=-1$$. We then have two equations $$x^2=-1$$ and $$-x^2=-1$$. The second one always has at least two solutions (maybe more), while the first have no solutions if $$p\equiv 3 \mod 4$$.
Your claim is never true for $$n=1$$, assuming nondegeneracy. This gives also many counterexamples for $$n>1$$ using Hensel's lemma.
In Lidl and Niederreiter's book "Finite Fields", 2nd edition, Chapter 6, section 2 (quadratic forms) you'll find plenty of information on the $$n=1$$ case. In particular, from their Theorem 6.27 it follows that for fixed $$k$$ and nondegenerate $$B\colon (\mathbb{Z}/p\mathbb{Z})^{2k+1}\times (\mathbb{Z}/p\mathbb{Z})^{2k+1} \to \mathbb{Z}/p\mathbb{Z}$$, the number of solutions to $$B(x,x)=c$$ is a non-constant (explicit) function of the Legendre symbol of $$c$$ mod $$p$$.
The reason for the parity difference is essentially their Lemma 6.24, showing that quadratic forms in two variables are well-behaved, namely the function $$b \mapsto \#\{(x_1,x_2): a_1 x_1^2 + a_2 x_2^2 =b\}$$ is essentially constant (depends only on whether $$b=0$$ or not), and then some linear algebra allows you to reduce the study of $$B(x,x)=c$$ when $$x \in (\mathbb{Z}/p\mathbb{Z})^{2k}$$ to $$k=1$$ (which behaves almost like a constant) and the study of $$B(x,x)=c$$ when $$x \in (\mathbb{Z}/p\mathbb{Z})^{2k-1}$$ to $$k=1$$, that is, counting $$b$$ with $$ax^2 = b$$, which clearly depends on the Legendre symbol of $$b$$.