1 Introduction

Let \(Q({\mathbf{x}}) = Q(x_{1} ,x_{2} ,\ldots,x_{n} ) = \sum_{1 \leqslant i \leqslant j \leqslant n} a_{ij} x_{i} x_{j} \) be a quadratic form with integer coefficients in n-variables, p be an odd prime, \(\mathbb{Z}_{p^{2}}=\mathbb{Z}/(p^{2})\), and \(V_{p^{2}} = V_{p^{2} }(Q)\) be the algebraic subset of \(\mathbb{Z}_{p^{2} }^{n} \) defined by the equation

$$ Q({\mathbf{x}}) = Q({x_{1}},{x_{2}}, \ldots,{x_{n}}) = 0. $$
(1.1)

When n is even, we let \(\Delta_{p} (Q) = ( {( - 1)^{n/2} \det A_{Q} /p} )\) if \(p\nmid\det A_{Q} \) and \(\Delta_{p} (Q) = 0\) if \(p|\det A_{Q} \), where \((\cdot/p)\) denotes the Legendre-Jacobi symbol and \(A_{Q} \) is the \(n \times n\) defining matrix for \(Q({\mathbf{x}})\). We call Q a nonsingular form \((\operatorname{mod} p)\) if \(p \nmid\det A_{Q}\). As usual, we let \(|S|\) denote the cardinality of a set S.

Our first interest in this paper is obtaining an estimate for the number of solutions of (1.1) in a box of the type

$$ \mathcal{B} = \bigl\{ \mathbf{x} \in\mathbb{Z}^{n} | {a_{i} \leqslant x_{i} < a_{i} + m_{i} , 1 \leqslant i \leqslant n} \bigr\} , $$
(1.2)

viewed as a subset of \(\mathbb{Z}_{p^{2}}^{n}\), where \(a_{i} ,m_{i} \in\mathbb {Z}\), \(0< m_{i} \le p^{2}\), \(1 \le i \le n\).

Theorem 1

Suppose that n is even, Q is a nonsingular form \((\operatorname{mod} p)\) and that \(V_{p^{2}}(Q)\) is the set of solutions of (1.1). Then, for any boxof type (1.2) (viewed as a subset of \(\mathbb{Z}_{p^{2}}^{n}\)) with \(0 < m_{i} \le p^{2}\), \(1 \le i \le n\), we have

$$ \bigl\vert \mathcal{B} \cap V_{p^{2}}(Q) \bigr\vert \leq \gamma_{n} \biggl( \frac{\vert \mathcal{B} \vert }{p^{2} } + p^{n} \biggr), $$
(1.3)

where

$$ \gamma_{n} = 2^{n} \bigl(1 + 6^{n} \bigr). $$
(1.4)

We conjecture that the following upper bound holds:

$$\bigl\vert \mathcal{B} \cap V_{p^{2}}(Q) \bigr\vert \le \frac{|\mathcal{B}|}{p^{2}} + O_{\epsilon}\bigl( p^{n-2+\epsilon} \bigr), $$

which would be the best possible estimate. Indeed, for the form \(Q(\mathbf{x})=x_{1}x_{2}-x_{3}x_{4}\), the ϵ factor cannot be removed altogether. For this form it is known [1], Theorem 3, that the number of solutions of the equation \(Q(\mathbf{x})=0\) in integers x with \(1 \le x_{i} \le B\) is asymptotic to \(\frac{12}{\pi^{2}}B^{2} \log B\). Thus, for any B, the number of solutions of the congruence \(Q(\mathbf{x}) \equiv0 \ (\operatorname{mod}p^{2})\) with \(1 \le x_{i} \le B\) is at least \(\frac{12}{\pi ^{2}}B^{2} \log B\). Letting \(B \approx p\) demonstrates the optimality of the conjectured upper bound. In Section 3 we establish the asymptotic estimate

$$\bigl\vert \mathcal{B} \cap V_{p^{2}}(Q) \bigr\vert = \frac{|\mathcal{B}|}{p^{2}} + O \bigl( p^{\frac{3}{2} n-1} \log^{n} p \bigr). $$

The error term \(p^{n}\) in the upper bound (1.3) greatly improves on the error term \(p^{\frac{3}{2}n -1}\log^{n} p\) in the asymptotic estimate at the expense of having to place a constant larger than 1 on the main term. We would expect that the error term in the asymptotic estimate can be improved at least to the value \(p^{n}\) appearing in our upper bound.

In the next theorem the same type of bound as Theorem 1 is given for boxes with sides of unrestricted lengths. In this case, we let \({V_{{p^{2}},\mathbb{Z}}}\) denote the set of integer solutions of the congruence

$$ Q(\mathbf{x}) \equiv0\quad \bigl(\operatorname{mod}p^{2} \bigr), $$
(1.5)

and regard ℬ as a set of points in \(\mathbb{Z}^{n}\).

Theorem 2

Suppose that n is even, Q is nonsingular \((\operatorname{mod} p)\) and \(V_{p^{2} ,\mathbb{Z}} = V_{p^{2} ,\mathbb{Z}} (Q)\) is the set of integer solutions of the congruence (1.5). Then, for any boxof type (1.2) (allowing \(m_{i}>p^{2}\)), we have

$$\vert {\mathcal{B} \cap V_{p^{2} ,\mathbb{Z}} } \vert \leqslant \gamma_{n} \biggl( {\frac{{\vert \mathcal{B} \vert }}{ {p^{2} }} + N_{\mathcal{B}} p^{n} } \biggr), $$

where \(\gamma_{n}\) is as in (1.4), and

$$ N_{\mathcal{B}} = \prod_{i = 1}^{n} \biggl\lceil \frac{m_{i}}{p^{2}} \biggr\rceil . $$

We devote Section 4 and Section 5 respectively to the proofs of Theorem 1 and Theorem 2.

2 Preliminary lemmas

For any x, y in \(\mathbb{Z}_{p^{2} }^{n} \), we let \({\mathbf{x}} \cdot{\mathbf{y}}\) denote the ordinary dot product \({\mathbf{x}} \cdot{\mathbf{y}} = \sum_{i = 1}^{n} x_{i} y_{i} \). For any \(x \in\mathbb{Z}_{p^{2} } \), let \(e_{p^{2} } (x) = e^{2\pi ix/p^{2} } \). We use the abbreviation \(\sum_{\mathbf{x}} = \sum_{{\mathbf{x}} \in\mathbb{Z}_{p^{2} }^{n} } \) for complete sums. For \(\mathbf{y}\in\mathbb{Z}_{p^{2}}^{n}\), we write \(p|\mathbf{y}\) if \(p|y_{i}\), \(1 \le i \le n\) (where the \(y_{i}\) are regarded as integer representatives for the residue classes). In this case \(\frac{1}{p} \mathbf{y}\) is a well-defined element of \(\mathbb{Z}_{p^{2}}^{n}\). Let Q be a nonsingular quadratic form \((\operatorname{mod} p)\), and \(V_{p^{2}}=V_{p^{2}}(Q)\) be the set of solutions of (1.1). For \(\mathbf{y} \in\mathbf{Z}_{p^{2}}^{n}\) we define

$$\begin{aligned} \phi(V_{p^{2}},{\mathbf{y}}) := \begin{cases} \sum_{{\mathbf{x}} \in V} e_{p^{2} } ({\mathbf{x}} \cdot{\mathbf{y}}) & \mbox{for } {\mathbf{y}} \ne{\mathbf {0}}, \\ {\vert V_{p^{2}} \vert - p^{2(n - 1)} } & \mbox{for } {\mathbf{y}} = {\mathbf{0}}. \end{cases} \end{aligned}$$

The following lemma was established in [2].

Lemma 1

([2], Lemma 2.3)

Suppose that n is even, Q is nonsingular modulo p and \(\Delta = \Delta_{p} (Q)\). Then, for any \({\mathbf{y}}\in\mathbb{Z}_{p^{2}}^{n}\),

$$ \phi(V_{p^{2}},{\mathbf{y}}) = \begin{cases} p^{n} - p^{n - 1} & \textit{if } {p\nmid y_{i} } \textit{ for some }i \textit{ and } p^{2} | Q^{*} ({\mathbf{y}}) , \\ - p^{n - 1} & \textit{if } {p\nmid y_{i} } \textit{ for some } i \textit{ and } p| Q^{*} ({\mathbf{y}}) , \\ 0& if {p\nmid y_{i} } \textit{ for some }i\textit{ and } p\nmid Q^{*} ({\mathbf{y}}) , \\ - \Delta p^{(3n/2) - 2} + p^{n - 1} (p - 1) & \textit{if } {p| {y_{i} }} \textit{ for all }i\textit{ and } p\nmid Q^{*} ({\mathbf {y'}}) , \\ {\Delta(p - 1)p^{(3n/2) - 2} + p^{n - 1} (p - 1)} & \textit{if } {p| {y_{i} } } \textit{ for all }i\textit{ and } p| Q^{*} ({\mathbf{y'}}) , \end{cases} $$

where \(Q^{*} \) is the quadratic form associated with the inverse of the matrix for Q modp.

In [3] we established the basic identity

$$\begin{aligned} \sum_{{\mathbf{x}} \in V_{p^{2}}} {\alpha({\mathbf{x}})} = p^{2n - 2} a({\mathbf{0}}) + \sum_{\mathbf{y}} {a({ \mathbf{y}})} \phi(V_{p^{2}},{\mathbf{y}}) \end{aligned}$$
(2.1)

for any complex valued function \(\alpha(\mathbf{x})\) defined on \(\mathbb{Z}_{p^{2}}\) with Fourier expansion

$$\alpha({\mathbf{x}}) = \sum_{\mathbf{y}} {a({\mathbf{y}}) e_{p^{2} } ({\mathbf{y}} \cdot{\mathbf{x}})}. $$

Inserting the value of \(\phi(V_{p^{2}},{\mathbf{y}})\) from Lemma 1 into the basic identity (2.1) yields the following (see [4]).

Lemma 2

(The fundamental identity)

For any complex valued \(\alpha ({\mathbf{x}})\) on \(\mathbb{Z}_{p^{2} }^{n} \),

$$\begin{aligned} \sum_{{\mathbf{x}} \in V} {\alpha({\mathbf{x}})} ={}& p^{ - 2} \sum_{\mathbf{x}} {\alpha({ \mathbf{x}})} + p^{n} \sum_{p^{2} | {Q^{*} ({\mathbf{y}})} } {a({\mathbf {y}})} - p^{n - 1} \sum_{p| {Q^{*} ({\mathbf{y}})} } {a({ \mathbf{y}})}\\ &{} - \Delta p^{(3n/2) - 2} \sum_{{\mathbf{y'}}(\operatorname{mod} p)} {a\bigl(p{ \mathbf{y'}}\bigr)} + \Delta p^{(3n/2) - 1} \mathop{\sum _{{p| {Q^{*} ({\mathbf{y'}})} }}}_{{{\mathbf{y'}} (\operatorname{mod} p)}} {a\bigl(p{\mathbf{y'}} \bigr)}. \end{aligned}$$

3 Asymptotic estimate of \(|\mathcal{B} \cap V_{p^{2}}|\)

To obtain an asymptotic estimate for the number of solutions of (1.5) in a box ℬ with sides of length \(m_{i} \le p^{2}\), we let \(\alpha= \chi_{\mathcal{B}}\), the characteristic function for the box. For such α, it is well known that the Fourier coefficients \(a_{\mathcal{B}}( \mathbf{y})\) have magnitude

$$\bigl|a_{\mathcal{B}}({\mathbf{y}})\bigr| = p^{ - 2n} \prod _{i = 1}^{n} \biggl\vert {\frac{{\sin\pi m_{i} y_{i} /p^{2} }}{ {\sin \pi y_{i} /p^{2} }}}\biggr\vert , $$

where the term in the product is taken to be \(m_{i} \) if \(y_{i} = 0\). Henceforth, we choose representatives y for \(\mathbb{Z}_{p^{2}}^{n}\) with \(-\frac{p^{2}-1}{2} \le y_{i} \le\frac{p^{2}-1}{2}\), \(1 \le i \le n\). With this convention we can say

$$\bigl|a_{\mathcal{B}}({\mathbf{y}})\bigr| \leqslant p^{ - 2n} \prod _{i = 1}^{n} {\min \biggl\{ {m_{i} ,{ \frac{{p^{2} }}{ {2y_{i} }}} } \biggr\} }, $$

from which one readily obtains the well-known inequality

$$\sum_{\mathbf{y}} \bigl|a_{\mathcal{B}}(\mathbf{y})\bigr| \ll \log^{n} p. $$

Also, by Lemma 1 one has uniformly \(|\phi(V_{p^{2}},\mathbf{y})| \le p^{\frac{3}{2} n-1}+p^{n}\). The asymptotic formula in (1.3) is now an immediate consequence of the basic identity (2.1), and the fact that \(a_{\mathcal{B}}(\mathbf{0}) = |\mathcal{B}|/p^{2n}\).

4 Proof of Theorem 1

We turn now to the proof of Theorem 1. Let ℬ be a box of point of the type (1.2), with \(0 < m_{i} \le p^{2}\), \(1 \le i \le n\), and let \(\chi_{\mathcal{B}} \) be its characteristic function with Fourier expansion

$$\chi_{\mathcal{B}} ({\mathbf{x}}) = \sum_{\mathbf{y}} a_{\mathcal{B}} ({\mathbf{y}})e_{p^{2} } ({\mathbf{x}} \cdot{ \mathbf{y}}). $$

As usual, we define the convolution of two functions α, β defined on \(\mathbb{Z}_{p^{2}}\) by

$$\alpha * \beta({\mathbf{x}}) = \sum_{\mathbf{u}} {\alpha ({ \mathbf{u}})} \beta({\mathbf{x}} - {\mathbf{u}}) = \sum _{{\mathbf{u + v = x}}} {\alpha({\mathbf{u}}) } \beta({\mathbf{v}}). $$

Lemma 3

Let \(\alpha = \chi_{\mathcal{B}} * \chi_{\mathcal{B}'}\), whereis a box as in (1.2), \(\mathcal{B}' = \mathcal{B} - {\mathbf{c}}\), with c chosen so that \(\mathcal{B}'\) is ‘nearly’ centered at the origin,

$$c_{i} = a_{i} + \biggl[ {\frac{{m_{i} - 1}}{ 2}} \biggr]. $$

Then, for any subset S of \(\mathbb{Z}_{p^{2}}^{n}\), we have

$$\sum_{{\mathbf{x}} \in S } {\alpha({\mathbf{x}})} \geqslant \frac{1}{ {2^{n} }}\vert \mathcal{B} \vert \vert {S } \cap\mathcal{B} \vert . $$

Proof

Let

$$I = \{ a_{i} ,a_{i} + 1, \ldots,a_{i} + m_{i} - 1\} . $$

Then if \(m_{i}\) is odd, \(c_{i} = a_{i} + \frac{{m_{i} - 1}}{2}\), and hence

$$I' = I - c_{i} = \biggl\{ { - \frac{{m_{i} - 1}}{ 2}, \ldots,\frac{{m_{i} - 1}}{ 2}} \biggr\} . $$

Thus, for any \(x \in I\),

$$\mathop{\sum_{u \in I} {\sum _{v \in I'} 1 } } _{u + v = x} \geqslant\frac{{m_{i} + 1}}{ 2} \geqslant\frac{{m_{i} }}{ 2}. $$

If \(m_{i}\) is even, so that \(c_{i} = a_{i} + \frac{{m_{i} }}{2} - 1\), then

$$I' = I - c_{i} = \biggl\{ { - \frac{{m_{i} }}{ 2} + 1, \ldots,\frac{{m_{i} }}{ 2}} \biggr\} , $$

and so for any \(x \in I\),

$$\mathop{\sum_{u \in I} {\sum _{v \in I'} 1 } } _{u + v = x } \geqslant\frac{{m_{i} }}{ 2}. $$

Thus, for any \(\mathbf{x} \in\mathcal{B}\), we have

$$\alpha(\mathbf{x}) \ge\prod_{i=1}^{n} \frac{m_{i}}{2} = 2^{-n} |\mathcal{B}|, $$

and so for any subset S of \(\mathbb{Z}_{p^{2}}^{n}\),

$$\sum_{\mathbf{x} \in S} \alpha(\mathbf{x}) \ge\sum _{\mathbf{x} \in S \cap \mathcal{B}} \alpha(\mathbf{x}) \ge|S \cap\mathcal{B}|2^{-n}| \mathcal{B}|. $$

 □

With α as given in Lemma 3, we have by the fundamental identity, Lemma 2, that

$$\begin{aligned} \sum_{{\mathbf{x}} \in V_{p^{2} } } {\alpha({\mathbf{x}})} ={}& p^{ - 2} \sum_{\mathbf{x}} {\alpha({\mathbf{x}}) + } \underbrace{p^{n} \mathop{\sum^{p^{2} }_{{y_{i} = 1}}}_{{p^{2} | {Q^{*} ({\mathbf{y}})}}} {a({\mathbf{y}})} }_{E_{0} } - \underbrace{p^{n - 1} \mathop{\sum ^{p^{2} }_{{y_{i} = 1}}}_{p | {Q^{*} ({\mathbf{y}})}} {a({ \mathbf{y}})}}_{E_{1} } \\ &{}- \underbrace{\Delta p^{(3n/2) - 2} \sum_{y_{i} ^{\prime}= 1}^{p} {a\bigl(p{\mathbf{y'}}\bigr)} }_{E_{2} } + \underbrace{\Delta p^{(3n/2) - 1} \mathop{\sum^{p^{2} }_{{{y'_{i} = 1}}}}_{{p | {Q^{*} ({\mathbf{y'}})} }} {a\bigl(p{\mathbf{y'}}\bigr)}}_{E_{3}}. \end{aligned}$$

Also,

$$\begin{aligned}& \sum_{\mathbf{x}} {\alpha({\mathbf{x}})} = \vert \mathcal{B} \vert \bigl\vert {\mathcal{B'}} \bigr\vert = \vert \mathcal{B} \vert ^{2} , \\& \alpha({\mathbf{0}}) = \mathop{\sum_{u \in\mathcal{B}} {\sum _{v \in\mathcal{B'}} 1 } } _{{\mathbf{u}} + {\mathbf{v}} = {\mathbf{0}}} \leqslant \vert \mathcal{B} \vert , \end{aligned}$$

and

$$a({\mathbf{y}}) = p^{2n} a_{\mathcal{B}} ({\mathbf{y}}) a_{\mathcal{B'}} ({\mathbf{y}}). $$

It follows that

$$ \sum_{\mathbf{x} \in V_{p^{2}}} \alpha(\mathbf{x}) \le \frac{|\mathcal{B}|^{2}}{p^{2}}+|E_{0}-E_{1}|+|E_{2}-E_{3}|. $$
(4.1)

By the Cauchy-Schwarz inequality and Parseval’s identity (see, for example, [5, 6]), we get

$$\begin{aligned} \sum_{\mathbf{y}} {\bigl\vert {a({ \mathbf{y}})} \bigr\vert } &= p^{2n} \sum _{\mathbf{y}} {\bigl\vert {a_{\mathcal{B}} ({\mathbf{y}}) a_{\mathcal{B'}} ({\mathbf{y}})} \bigr\vert } \\ &\leqslant p^{2n} \biggl( {\sum_{\mathbf{y}} { \bigl\vert {a_{\mathcal{B}} ({\mathbf{y}})} \bigr\vert ^{2} } } \biggr)^{1/2} \biggl( {\sum_{{\mathbf{y'}}} {\bigl\vert {a_{\mathcal{B'}} \bigl({\mathbf{y'}}\bigr)} \bigr\vert ^{2} } } \biggr)^{1/2} \\ &\leqslant p^{2n} \biggl( {\frac{1}{ {p^{2n} }}\sum _{\mathbf{y}} {\chi_{\mathcal{B}}^{2} } ({\mathbf{x}})} \biggr)^{1/2} \biggl( {\frac{1}{ {p^{2n} }}\sum _{\mathbf{y}} {\chi_{\mathcal{B'}}^{2} } ({\mathbf {x}})} \biggr)^{1/2} \\ & = \vert \mathcal{B} \vert ^{1/2} \bigl\vert { \mathcal{B'}} \bigr\vert ^{1/2} = \vert \mathcal{B} \vert . \end{aligned}$$
(4.2)

Next

$$ \vert {E_{0} - E_{1} } \vert = \Biggl\vert {p^{n} \mathop{\sum^{p^{2} } _{{y_{i} = 1}}}_{{p^{2} | {Q^{*} ({\mathbf{y}})} }} {a({\mathbf{y}})} - p^{n - 1} \mathop{ \sum^{p^{2} } _{{{y_{i} = 1}}}}_{{p| {Q^{*} ({\mathbf{y}})}}} {a({ \mathbf{y}})} } \Biggr\vert = \Biggl\vert {\sum_{y_{i} = 1}^{p^{2} } {\psi({\mathbf{y}})a({\mathbf{y}})} } \Biggr\vert , $$
(4.3)

where

$$\psi({\mathbf{y}}) = \begin{cases} p^{n} - p^{n - 1} , & p^{2} | Q^{*} ({\mathbf{y}}), \\ - p^{n - 1} , & p\| Q^{*} ({\mathbf{y}}). \end{cases} $$

Continuing from (4.3) and using (4.2), we obtain

$$ \vert {E_{0} - E_{1} } \vert \leqslant \bigl(p^{n} - p^{n - 1} \bigr)\sum_{\mathbf{y}} {\bigl\vert {a({\mathbf{y}})} \bigr\vert } \leqslant\bigl(p^{n} - p^{n - 1} \bigr)\vert \mathcal{B} \vert . $$
(4.4)

Also,

$$\begin{aligned} \vert {E_{2} - E_{3} } \vert &= \Biggl\vert { - \Delta p^{(3n/2) - 2} \sum_{y_{i} ^{\prime}= 1}^{p} {a\bigl(p{\mathbf{y'}}\bigr)} + \Delta p^{(3n/2) - 1} \mathop{\sum ^{p}_{\substack{{y'_{i} = 1}}}}_{{p| {Q^{*} ({\mathbf{y'}})}}} {a\bigl(p{ \mathbf{y'}}\bigr)} } \Biggr\vert \\ &\leqslant\Biggl\vert {\sum _{y'_{i} = 1}^{p} {\theta\bigl({ \mathbf{y'}}\bigr)} a\bigl(p{\mathbf{y'}}\bigr)} \Biggr\vert , \end{aligned}$$
(4.5)

where

$$\theta({\mathbf{y}}) = \begin{cases} p^{(3n/2) - 1} - p^{(3n/2) - 2} , & p\vert Q^{*} ({\mathbf{y}}), \\ p^{(3n/2) - 2} , & p\nmid Q^{*} ({\mathbf{y}}). \end{cases} $$

Continuing from (4.5),

$$ \vert {E_{2} - E_{3} } \vert \leqslant \bigl(p^{3n/2 - 1} - p^{3n/2 - 2} \bigr)\sum_{y'_{i} = 1}^{p } {\bigl\vert {a\bigl(p{\mathbf{y'}}\bigr)} \bigr\vert } . $$
(4.6)

We are left with estimating \(\sum_{\vert {y_{i} } \vert < p/2} \vert {a_{i} (py_{i} )} \vert \). Say \(a({\mathbf{y}}) = \prod_{i = 1}^{n} a_{i} (y_{i} )\). Since the Fourier coefficients are given by \(a({\mathbf{y}}) = p^{2n} a_{B} ({\mathbf{y}}) a_{B'} ({\mathbf{y}})\), we have

$$\bigl\vert {a_{i} (y_{i} )} \bigr\vert = p^{2} \bigl\vert {a_{B,i} (y_{i} )a_{B',i} (y_{i} )} \bigr\vert = \frac{1}{ {p^{2} }} \frac{{\sin^{2} (\pi m_{i} y_{i} /p^{2} )}}{ {\sin^{2} (\pi y_{i} /p^{2} )}}, $$

and so

$$ \bigl\vert {a_{i} (py_{i} )} \bigr\vert \leqslant\min \biggl\{ {\frac{{m_{i}^{2} }}{ {p^{2} }},\frac{1}{ {4y_{i}^{2} }}} \biggr\} \quad\mbox{for } \vert {y_{i} } \vert < p/2. $$
(4.7)

Lemma 4

$$\sum_{\vert {y_{i} } \vert < p/2} {\bigl\vert {a_{i} (py_{i} )} \bigr\vert } \leqslant \begin{cases} {6\frac{{m_{i} }}{p} } & \textit{if } m_{i} \leqslant p, \\ {3\frac{{m_{i}^{2} }}{{p^{2} }}} & \textit{if } m_{i} > p. \end{cases} $$

Proof

We begin by establishing the inequality

$$ \sum_{\vert {y_{i} } \vert > p/2m_{i} } {\frac{1}{ {4y_{i}^{2} }} \leqslant \begin{cases} {4\frac{{m_{i} }}{p} } & \mbox{if } m_{i} \leqslant p/2, \\ {1 } & \mbox{if } m_{i} > p/2. \end{cases} } $$
(4.8)

We split the proof of the inequality into two cases.

Case (I): If \(\frac{p}{{2m_{i} }} \geqslant1\), then

$$L = \biggl[ {\frac{p}{ {2m_{i} }}} \biggr] \geqslant\frac{1}{ 2} \frac{p}{ {2m_{i} }} = \frac{p}{ {4m_{i} }}. $$

Thus,

$$\begin{aligned} \sum_{y = L}^{\infty}{\frac{1}{ {4y^{2} }}} = & \frac{1}{ 4}\sum_{y = L}^{\infty}{ \frac{1}{ {y^{2} }}} \leqslant\frac{1}{ {4L^{2} }} + \frac{1}{ 4} \int _{L}^{\infty}{\frac{{dx}}{ {x^{2} }}} \\ & = \frac{1}{ {4L^{2} }} + \frac{1}{ {4L}} = \frac{1}{ {4L}} \biggl( {1 + \frac{1}{ L}} \biggr) \\ & \leqslant\frac{2}{ {4L}} = \frac{1}{ {2L}} \leqslant\frac{{4m_{i} }}{ {2p}} = 2\frac{{m_{i} }}{ p}, \end{aligned}$$

and so

$$\sum_{\vert {y_{i} } \vert > p/2m_{i} } {\frac{1}{ {4y_{i}^{2} }} \leqslant4 \frac{{m_{i} }}{p}}. $$

Case (II): If \(\frac{p}{{2m_{i} }} < 1\), then

$$\sum_{\vert {y_{i} } \vert > p/2m_{i} } {\frac{1}{ {4y_{i}^{2} }} \leqslant \frac{2}{4}\sum_{y = 1}^{\infty}{ \frac{1}{{y^{2} }}} \leqslant \frac{{\pi^{2} }}{{12}}} \leqslant1. $$

Returning to the proof of the lemma, we consider four cases as follows.

Case (i): If \(m_{i} \leqslant\frac{p}{ 2}\), then by (4.7) and (4.8) we have

$$\begin{aligned} \sum_{\vert {y_{i} } \vert < p/2} {\bigl\vert {a_{i} (py_{i} )} \bigr\vert } &\leqslant\sum_{\vert {y_{i} } \vert \leqslant p/2m_{i} } {\frac{{m_{i}^{2} }}{ {p^{2} }} + \sum_{\vert {y_{i} } \vert > p/2m_{i} } { \frac{1}{ {4y_{i}^{2} }}} } \\ &\leqslant\frac{{m_{i}^{2} }}{ {p^{2} }} \biggl( {\frac{p}{ {m_{i} }} + 1} \biggr) + \frac{{4m_{i} }}{ p} = \frac{{5m_{i} }}{ p} + \frac{{m_{i}^{2} }}{ {p^{2} }} \leqslant6 \frac{{m_{i} }}{ p}. \end{aligned}$$

Case (ii): If \(m_{i} > \frac{p}{2}\), then by (4.7) and (4.8)

$$\begin{aligned} \sum_{\vert {y_{i} } \vert < p/2}{\bigl\vert {a_{i} (py_{i} )} \bigr\vert } &\leqslant\sum_{\vert {y_{i} } \vert \leqslant p/2m_{i} } {\frac{{m_{i}^{2} }}{{p^{2} }} + \sum_{\vert {y_{i} } \vert > p/2m_{i} } { \frac{1}{ {4y_{i}^{2} }}} } \leqslant\frac{{m_{i}^{2} }}{ {p^{2} }} \biggl( {\frac{p}{{m_{i} }} + 1} \biggr)+1 = \frac{{m_{i} }}{p} + \frac{{m_{i}^{2} }}{{p^{2} }} + 1. \end{aligned}$$

Case (iii): If \(\frac{p}{2} < m_{i} < p\), then continuing from Case (ii) we have

$$\sum_{\vert {y_{i} } \vert < p/2} {\bigl\vert {a_{i} (py_{i} )} \bigr\vert } \leqslant \frac{{m_{i} }}{ p} + \frac{{m_{i}^{2} }}{{p^{2} }} + 1 \leqslant2\frac{{m_{i} }}{p} + 1 \leqslant4\frac{{m_{i} }}{p}. $$

Case (iv): If \(m_{i} > p\), then continuing from Case (ii) we get

$$\sum_{\vert {y_{i} } \vert < p/2} {\bigl\vert {a_{i} (py_{i} )} \bigr\vert } \leqslant2 \biggl( { \frac{{m_{i} }}{ p}} \biggr)^{2} + 1 \leqslant3\frac{{m_{i}^{2} }}{{p^{2} }}, $$

completing the proof of Lemma 4. □

We return to the proof of Theorem 1. Suppose that

$$m_{1} \leqslant m_{2} \leqslant m_{l} \leqslant p < m_{l + 1} \leqslant \cdots \leqslant m_{n} . $$

By Lemma 4, we obtain

$$\begin{aligned} \sum_{\vert {\mathbf{y}} \vert < p/2} {\bigl\vert {a_{i} (p{\mathbf {y}})} \bigr\vert } &= \prod _{i = 1}^{n} {\sum_{\vert {y_{i} } \vert < p/2} { \bigl\vert {a_{i} (py_{i} )} \bigr\vert } = \prod _{m_{i} \leqslant p} {6\frac{{m_{i} }}{ p}\prod _{m_{i} > p} {3\frac{{m_{i}^{2} }}{ {p^{2} }}} } } \\ & \leqslant3^{n} 2^{l} \frac{{\vert \mathcal{B} \vert }}{ {p^{n} }}\prod _{m_{i} > p} {\frac{{m_{i} }}{ p}} = 3^{n} 2^{l} \frac{{\vert \mathcal{B} \vert }}{ {p^{n} }}\frac{{\prod_{m_{i} > p} m_{i} }}{ {p^{n - l} }}. \end{aligned}$$
(4.9)

Using (4.9), then continuing from (4.6), we have

$$\vert {E_{2} - E_{3} } \vert \leqslant p^{(3n/2) - 2} (p - 1) \cdot3^{n} 2^{l} p^{l - 2n} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} }< 3^{n}2^{l} p^{l-\frac{n}{2}-1}|\mathcal{B}|\prod _{i=1}^{n} m_{i} . $$

By (4.1) and (4.4), we then obtain

$$\begin{aligned} \sum_{{\mathbf{x}} \in V_{p^{2} }} {\alpha({\mathbf{x}})} &\leqslant\frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + \vert {E_{0} - E_{1} } \vert + \vert {E_{2} - E_{3} } \vert \\ &\leqslant\frac{{\vert \mathcal{B} \vert ^{2}}}{ {p^{2} }} + \bigl(p^{n} - p^{n - 1} \bigr)\vert \mathcal{B}\vert + 3^{n}2^{l} p^{l-\frac{n}{2}-1}|\mathcal{B}|\prod_{i=1}^{n} m_{i} \\ & \leqslant\frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + p^{n} \vert \mathcal{B} \vert + 3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} }. \end{aligned}$$
(4.10)

The task now is to determine which of the terms \(\vert \mathcal{B} \vert ^{2} /p^{2} \), \(p^{n} \vert \mathcal{B} \vert \) and \(3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} } \) in (4.10) is the dominant term. We consider two cases as follows.

Case (i): Suppose \(l \leqslant\frac{n}{2} - 1\). Then, comparing the first and third terms, we get

$$\begin{aligned} \frac{{3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} m_{i} }}{ {\vert \mathcal{B} \vert ^{2} /p^{2} }} &= \frac{1}{ {\vert \mathcal{B} \vert }}p^{l - (n/2) + 1} 3^{n} 2^{l} \prod_{i = l + 1}^{n} {m_{i} } \\ &\leqslant\frac{{p^{l - (n/2) + 1} 3^{n} 2^{l} }}{ {\prod_{i = 1}^{l} m_{i} }} \leqslant3^{n} 2^{l} p^{l - (n/2) + 1} \leqslant 3^{n} 2^{l} . \end{aligned}$$

This leads to

$$3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} } \leqslant3^{n} 2^{l} \frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }}. $$

Case (ii): Suppose \(l \geqslant\frac{n}{2}\). Then, comparing the second and third terms, we have

$$\begin{aligned} \frac{{3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} m_{i} }}{ {p^{n} \vert \mathcal{B} \vert }}& = 3^{n} 2^{l} p^{l - (3n/2) - 1} \prod _{i = l + 1}^{n} {m_{i} } \\ &\leqslant3^{n} 2^{l} p^{l - (3n/2) - 1} p^{2(n - l)} = 3^{n} 2^{l} p^{(n/2) - 1 - l} \leqslant\frac{{3^{n} 2^{l} }}{ {p }}. \end{aligned}$$

This gives that

$$3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} } \leqslant\frac{{3^{n} 2^{l} }}{ p}p^{n} \vert \mathcal{B} \vert . $$

So for any l, we always have

$$3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} } \leqslant {3^{n} 2^{l} \frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + \frac{{3^{n} 2^{l} }}{p} p^{n} \vert \mathcal{B} \vert } . $$

Returning to (4.10), we now can write

$$\begin{aligned} \sum_{{\mathbf{x}} \in V_{p^{2} } } {\alpha({\mathbf{x}})} & \leqslant \frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + p^{n} \vert \mathcal{B} \vert + 3^{n} 2^{l} p^{l - (n/2) - 1} \vert \mathcal{B} \vert \prod_{i = l + 1}^{n} {m_{i} } \\ &\leqslant \frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + p^{n} \vert \mathcal{B} \vert + 3^{n} 2^{l} \frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + \frac{{3^{n} 2^{l} }}{ p} p^{n} \vert \mathcal{B} \vert \\ & = \bigl(1 + 3^{n} 2^{l} \bigr) \frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + \biggl( {1 + \frac{{3^{n} 2^{l} }}{ p}} \biggr) p^{n} \vert \mathcal{B} \vert \\ & \leqslant\gamma'_{n} \biggl( {\frac{{\vert \mathcal{B} \vert ^{2} }}{ {p^{2} }} + p^{n} \vert \mathcal{B} \vert } \biggr), \end{aligned}$$
(4.11)

where \(\gamma'_{n} = 1 + 3^{n} 2^{l} \). On the other hand, using Lemma 3, we have

$$ \sum_{{\mathbf{x}} \in V_{p^{2} } } {\alpha({\mathbf{x}})} \geqslant\frac{1}{ {2^{n} }}\vert \mathcal{B} \vert \vert {V_{p^{2} } \cap\mathcal{B}} \vert . $$
(4.12)

Combining the last two inequalities ((4.11) and (4.12)) yields

$$\vert {\mathcal{B} \cap V_{p^{2} } } \vert \leqslant2^{n} \gamma'_{n} \biggl( {\frac{{\vert \mathcal{B} \vert }}{ {p^{2} }} + p^{n} } \biggr) \leqslant\gamma_{n} \biggl( {\frac{{\vert \mathcal{B} \vert }}{ {p^{2} }} + p^{n} } \biggr), $$

where \(\gamma_{n}=1+6^{n}\). Theorem 1 is proved.

5 Proof of Theorem 2

Let ℬ be a box of points in \(\mathbb{Z}^{n}\) as given in (1.2). Partition ℬ into \(N = N_{\mathcal{B}} \) smaller boxes \(\mathrm{B}_{i} \),

$$\mathcal{B} = \mathrm{B}_{1} \cup\mathrm{B}_{2} \cup \cdots \cup\mathrm{B}_{N} , $$

where each \(\mathrm{B}_{i} \) has all of its edge lengths \(\leqslant p^{2} \). Plainly,

$$ N_{\mathcal{B}} = \prod_{i = 1}^{n} \biggl\lceil \frac{m_{i}}{p^{2}} \biggr\rceil . $$

Applying Theorem 1 to each \(\mathrm{B}_{i} \), we get

$$\begin{aligned} \vert {\mathcal{B} \cap V_{p^{2} ,\mathbb{Z}} } \vert &= \sum _{i = 1}^{N} {\vert { \mathrm{B}_{i} \cap V_{p^{2},\mathbb{Z} } } \vert } \\ &\leqslant\sum_{i = 1}^{N} { \gamma_{n} \biggl( {\frac{{\vert {\mathrm{B}_{i} } \vert }}{ {p^{2} }} + p^{n} } \biggr)} \\ & = \frac{{\gamma_{n} }}{ {p^{2} }}\sum_{i = 1}^{N} { \vert {\mathrm{B}_{i} } \vert } + N\gamma _{n} p^{n} \\ & = \gamma_{n} \biggl( {\frac{{\vert \mathcal{B} \vert }}{ {p^{2} }} + N_{\mathcal{B}} p^{n} } \biggr). \end{aligned}$$

The proof of Theorem 2 is complete.