\documentclass[12pt]{article} \usepackage[T1]{fontenc} \usepackage{amsmath,amssymb,amsthm} \usepackage[margin=1.12in]{geometry} \usepackage[hidelinks]{hyperref} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newcommand{\F}{\mathbb F} \newcommand{\E}{\mathbb E} \newcommand{\Prb}{\mathbb P} \newcommand{\VC}{\operatorname{VCdim}} \newcommand{\ind}{\mathbf 1} \title{On the VC Dimension of Quadratic Residues in Finite Fields} \author{Chea Luke Berg\\Independent Researcher} \date{November 30, 2026} \begin{document} \maketitle \begin{abstract} Let $q$ tend to infinity through odd prime powers and let $S_q$ be the set of nonzero squares in $\F_q$. The VC dimension of the translates of $S_q$ is $(1+o(1))\log_2 q$, as conjectured by McDonald, Sahay, and Wyman. The argument uses exact averaging of quadratic-character agreement counts and fixed-order factorial moments to bound the expected number of missing sign patterns. In particular, for each fixed $0<\varepsilon<1$, a uniformly sampled ordered tuple of length $\lfloor(1-\varepsilon)\log_2 q\rfloor$ is shattered with probability tending to one, with witnesses outside the tuple. \end{abstract} \noindent\textbf{Keywords:} VC dimension; quadratic residues; finite fields; character sums; factorial moments.\par \smallskip \noindent\textbf{MSC 2020:} 11T24, 05D40. \section{Introduction} For an odd prime power $q$, let \[ S_q=\{z^2:z\in\F_q^\times\}. \] The VC dimension of the additive translates of $S_q$ measures the largest size of a set on which these translates realize every subset. More precisely, following the convention of McDonald, Sahay, and Wyman \cite[Section 1]{MSW}, a finite set $Y\subseteq\F_q$ is shattered if for every $A\subseteq Y$ there exists $x\in\F_q\setminus Y$ such that \[ (S_q+x)\cap Y=A. \] The VC dimension $\VC_{\F_q}(S_q)$ is the largest cardinality of such a set. For $|Y|=m$ the $q-m$ eligible translations give at most $q-m$ distinct traces, so $2^m\le q-m\le q$. In particular, $\VC_{\F_q}(S_q)\le\log_2q$. In their work first circulated in 2022, McDonald, Sahay, and Wyman \cite[Theorem 1.4]{MSW} showed that, for every fixed $\varepsilon>0$ and sufficiently large $q$, every set of size at most $(1/2-\varepsilon)\log_2q$ is shattered. Their Conjecture 1.3 asserts that the largest shattered set has asymptotic size $(1+o(1))\log_2q$. The conjectured quantity concerns existence of a shattered set, rather than the testing dimension, which requires shattering every set of a given size: the argument below establishes the former by showing that a random tuple of the prescribed size is shattered with high probability. For the corresponding graph-theoretic formulation, let $\mathcal P_q=\operatorname{Cay}(\F_q,S_q)$, with an edge from $x$ to $y$ when $y-x\in S_q$. The translates $S_q+x$ are precisely its out-neighborhoods. Thus the same question concerns the VC dimension of the Paley digraph (the usual undirected Paley graph when $q\equiv1\pmod4$), with the witness convention above. The calculations underlying this article were developed in October 2026. The argument uses the following order of summation: first average an agreement count over ordered distinct translations, then estimate fixed-order factorial moments of a randomly selected sign pattern. The central point is that the Weil bound gives an individual relative error of order $q^{-1/2}$, but an exact double count shows that its average is of order $q^{-1}$. Expanding the $n$th power after taking this average leaves a relative error of order $n^2/q$ for each fixed moment order. A comparison with Poisson moments then bounds the probability of an absent pattern. The final multiplication by $2^n$ controls the expected total number of absent patterns, rather than merely the probability of absence of a randomly chosen one. All limits below are taken through odd prime powers, and $\log$ denotes the natural logarithm unless a base is specified. \begin{theorem}\label{thm:main} As $q\to\infty$ through odd prime powers, \[ \VC_{\F_q}(S_q)=(1+o(1))\log_2 q. \] More precisely, for every fixed $0<\varepsilon<1$ and $n=\lfloor(1-\varepsilon)\log_2 q\rfloor$, an ordered tuple of $n$ independent uniform elements of $\F_q$ has distinct coordinates and is shattered, with witnesses outside the tuple, with probability $1-o(1)$. \end{theorem} \section{Quadratic-residue patterns} We retain the witness convention throughout the proof. Write $\chi$ for the quadratic character of $\F_q$, with $\chi(0)=0$, $\chi(t)=1$ for $t\in S_q$, and $\chi(t)=-1$ for $t\in\F_q^\times\setminus S_q$. For $y=(y_1,\ldots,y_n)\in\F_q^n$ and $\sigma\in\{-1,1\}^n$, put \begin{equation}\label{eq:witness} M_\sigma(y)=\sum_{x\in\F_q}\prod_{i=1}^n\ind_{\{\chi(y_i-x)=\sigma_i\}},\qquad B(y)=\sum_{\sigma\in\{-1,1\}^n}\ind_{\{M_\sigma(y)=0\}}. \end{equation} Only nonzero differences are counted. We first record the exact implication from the pattern counts to shattering. \begin{lemma}\label{lem:shatter} For $n\ge1$, $B(y)=0$ if and only if the coordinates of $y$ are distinct and their set is shattered under the witness convention above. \end{lemma} \begin{proof} If $y_i=y_j$ for $i\ne j$, choose $\sigma_i=1$ and $\sigma_j=-1$. No translation can realize both equations, so $M_\sigma(y)=0$. Thus $B(y)=0$ implies distinct coordinates. Let $A\subseteq Y=\{y_1,\ldots,y_n\}$ and choose $\sigma_i=1$ precisely when $y_i\in A$, with $\sigma_i=-1$ otherwise. If $M_\sigma(y)>0$, a witness $x$ satisfies all the character equations. None of the differences $y_i-x$ vanishes, so $x\notin Y$. By the definition of $\chi$, the positive signs are exactly the indices for which $y_i\in S_q+x$. Therefore $(S_q+x)\cap Y=A$. Conversely, when the coordinates are distinct and $Y$ is shattered with witnesses outside $Y$, each sign vector defines a subset $A$ and its witness realizes that sign vector. Thus all $M_\sigma(y)>0$ and $B(y)=0$. \end{proof} \section{Agreement of distinct translations} Write $(a)_r=a(a-1)\cdots(a-r+1)$ for $r\ge1$, with $(a)_0=1$. Fix an integer $r\ge1$ and pairwise distinct $x_1,\ldots,x_r\in\F_q$. Define \begin{equation}\label{eq:agreement} A_r(x)=\#\{y\in\F_q:\chi(y-x_1)=\cdots=\chi(y-x_r)\in\{-1,1\}\}. \end{equation} We restrict to $q\ge r$ so that such tuples exist; since $r$ will be fixed, this poses no restriction on the asymptotic result. Write $[r]=\{1,\ldots,r\}$. Let $X=\{x_1,\ldots,x_r\}$ and $P_I(T)=\prod_{j\in I}(T-x_j)$ for $I\subseteq[r]$, with $P_\varnothing=1$. For $y\notin X$ put $t_j=\chi(y-x_j)\in\{-1,1\}$. Expanding the products gives \[ \begin{aligned} \ind_{\{t_1=\cdots=t_r\}}&=\prod_{j=1}^r\frac{1+t_j}{2}+\prod_{j=1}^r\frac{1-t_j}{2}\\ &=2^{1-r}\sum_{\substack{I\subseteq[r]\\ |I|\text{ even}}}\prod_{j\in I}t_j. \end{aligned} \] The two products are the indicators that all signs are positive and that all signs are negative, respectively. Their sum cancels every odd-degree monomial; all even-degree monomials have coefficient $2^{1-r}$. By multiplicativity, $\prod_{j\in I}t_j=\chi(P_I(y))$. Summing over $y\notin X$ (the excluded points cannot contribute to $A_r$) gives \begin{equation}\label{eq:character} A_r(x)=2^{1-r}\sum_{\substack{I\subseteq[r]\\ |I|\text{ even}}}\sum_{y\in\F_q\setminus X}\chi(P_I(y)). \end{equation} The empty set contributes $q-r$. For nonempty even $I$, the polynomial $P_I$ is monic and squarefree of degree $|I|\ge2$, so the quadratic-character Weil bound \cite[Theorem 5.41]{LN} yields \[ \left|\sum_{y\in\F_q}\chi(P_I(y))\right|\le(|I|-1)\sqrt q. \] Removing at most $r$ terms changes the sum by at most $r$. It follows that \begin{align*} |2^{r-1}A_r(x)-q|&\le r+\sum_{\substack{I\subseteq[r]\\ |I|\ge2\text{ even}}}((|I|-1)\sqrt q+r)\\ &\le K_r\sqrt q,\qquad K_r=\sum_{\substack{2\le j\le r\\j\text{ even}}}\binom rj(j-1)+r2^{r-1}. \end{align*} There are $2^{r-1}$ even subsets of $[r]$, including the empty subset, which accounts for the term $r2^{r-1}$ in $K_r$. The factor $\sqrt q$ also bounds $1$. This constant depends only on $r$, and the estimate is uniform in the choice of distinct translations. In particular, writing \[ \eta_x=\frac{2^{r-1}A_r(x)}q-1, \] we have \begin{equation}\label{eq:uniform} \sup_{x\text{ distinct}}|\eta_x|\le K_r/\sqrt q. \end{equation} \section{Exact averaging of agreement counts} In this section $x$ is uniform over the $(q)_r$ ordered distinct $r$-tuples. Let $h=(q-1)/2$. For each fixed $y\in\F_q$, exactly $h$ choices of $x_j$ have $\chi(y-x_j)=1$ and exactly $h$ have $\chi(y-x_j)=-1$. For a common positive sign, the ordered distinct $r$-tuples number $(h)_r$; for a common negative sign, they number another $(h)_r$. These cases are disjoint. Counting first by $y$ gives, for $r\le h$, \[ \sum_{x\text{ distinct}}A_r(x)=2q(h)_r,\qquad \E_x[A_r(x)/q]=\frac{2(h)_r}{(q)_r}. \] Consequently, using $2h=q-1$, \begin{equation}\label{eq:average} 1+\E_x\eta_x=\frac{2^r(h)_r}{(q)_r}=\prod_{j=0}^{r-1}\frac{q-1-2j}{q-j} =\prod_{j=0}^{r-1}\left(1-\frac{j+1}{q-j}\right). \end{equation} For fixed $r$ and sufficiently large $q$, all factors belong to $[0,1]$. The inequality $0\le1-\prod_j(1-a_j)\le\sum_j a_j$ for $a_j\in[0,1]$ gives \[ |\E_x\eta_x|\le\sum_{j=0}^{r-1}\frac{j+1}{q-j}\le\frac{r(r+1)}{2(q-r+1)}=O_r(q^{-1}). \] By \eqref{eq:uniform}, \begin{equation}\label{eq:second} \E_x\eta_x^2\le \frac{K_r^2}{q}. \end{equation} These two estimates are used separately: the signed first-order average is of order $q^{-1}$, and the second moment is also of order $q^{-1}$. A bound on the average absolute value alone would not give the first of these estimates. For integers $n\ge2$ and real $t$, the binomial expansion gives \[ |(1+t)^n-1-nt|\le\binom n2 t^2(1+|t|)^{n-2}\le\tfrac12n(n-1)t^2e^{n|t|}. \] Indeed, for $2\le j\le n$, \[ \binom nj=\frac{n(n-1)}{j(j-1)}\binom{n-2}{j-2} \le\binom n2\binom{n-2}{j-2}. \] After taking absolute values of the binomial terms of degree at least two, summing this bound gives the first inequality. The second follows from $(1+|t|)^{n-2}\le e^{n|t|}$. The case $n=1$ has zero remainder. Substituting $t=\eta_x$ and averaging gives \begin{align*} |\E_x(1+\eta_x)^n-1|&\le n|\E_x\eta_x|+\tfrac12n(n-1)e^{nK_r/\sqrt q}\E_x\eta_x^2\\ &=O_r(n/q)+O_r(n^2/q)e^{nK_r/\sqrt q}. \end{align*} For fixed $r$ and $C>0$, $nK_r/\sqrt q\le CK_r\log q/\sqrt q\to0$. The exponential factor is therefore bounded uniformly in the stated range. Since $n\ge1$, the term $n/q$ is bounded by $n^2/q$. This proves, uniformly for integers $1\le n\le C\log q$, \begin{equation}\label{eq:power} \E_x\left(\frac{2^{r-1}A_r(x)}q\right)^n=1+O_{r,C}(n^2/q). \end{equation} \section{Exact factorial moments} Let $Y_1,\ldots,Y_n$ be independent uniform elements of $\F_q$, and let $\Sigma_1,\ldots,\Sigma_n$ be independent uniform signs, independent of $Y$. Put $M=M_\Sigma(Y)$ and $\mu=q2^{-n}$. The parameter $\mu$ is a comparison parameter, not the exact expectation. For a fixed translation and a fixed coordinate, there are $q-1$ admissible values of $Y_i$ and exactly one matching sign for each. Direct counting gives \[ \E M=q\left(\frac{q-1}{2q}\right)^n=\mu(1-q^{-1})^n. \] For each $x\in\F_q$ let $I_x=\prod_{i=1}^n\ind_{\{\chi(Y_i-x)=\Sigma_i\}}$. Since $M=\sum_x I_x$, the falling factorial counts ordered distinct witnesses: \[ (M)_r=\sum_{x\text{ distinct}}I_{x_1}\cdots I_{x_r}. \] For a fixed distinct tuple $x$, each coordinate must contribute to $A_r(x)$ and its independent sign must agree with the common character value. Hence independence of the coordinates gives \[ \E[I_{x_1}\cdots I_{x_r}]=\left(\frac{A_r(x)}{2q}\right)^n. \] The product is an indicator of simultaneous realization at all $r$ translations. More explicitly, for one coordinate the favourable pairs $(Y_i,\Sigma_i)$ number $A_r(x)$ out of $2q$ equally likely pairs. Thus the $n$-coordinate probability is the product of $n$ identical factors. Summing over all ordered distinct tuples and using \eqref{eq:power}, \begin{align*} \E(M)_r &=\sum_{x\text{ distinct}}\left(\frac{A_r(x)}{2q}\right)^n\\ &=(q)_r2^{-rn}\E_x\left(\frac{2^{r-1}A_r(x)}q\right)^n\\ &=\mu^r\bigl(1+O_{r,C}(n^2/q)\bigr), \end{align*} since \[ \frac{(q)_r}{q^r}=\prod_{j=0}^{r-1}\left(1-\frac jq\right)=1+O_r(q^{-1}). \] For clarity, the normalization in the second line is \[ \left(\frac{A_r(x)}{2q}\right)^n =\left(2^{-r}\frac{2^{r-1}A_r(x)}q\right)^n =2^{-rn}(1+\eta_x)^n. \] The two relative errors in the third line combine as \[ (1+O_r(q^{-1}))(1+O_{r,C}(n^2/q)) =1+O_{r,C}(n^2/q), \] using $n\ge1$ and $n\le C\log q$. Thus \begin{equation}\label{eq:factorial} \E(M)_r=\mu^r\bigl(1+O_{r,C}(n^2/q)\bigr),\qquad 1\le n\le C\log q, \end{equation} for each fixed $r\ge1$. For $r=0$ both sides equal $1$ exactly. Throughout this estimate the integer $r$ is held fixed as $q$ increases. \section{From factorial moments to missing patterns} Fix $k\ge1$ and $C>0$ and assume $\mu\ge1$, $1\le n\le C\log q$. Let $P$ be Poisson with parameter $\mu$. For every integer $r\ge1$, \begin{align*} \E(P)_r&=\sum_{a=r}^\infty (a)_r e^{-\mu}\frac{\mu^a}{a!}\\ &=e^{-\mu}\mu^r\sum_{b=0}^\infty\frac{\mu^b}{b!}=\mu^r. \end{align*} The case $r=0$ is immediate. Using the identity $z^j=\sum_{r=0}^j\left\{\begin{smallmatrix}j\\r\end{smallmatrix}\right\}(z)_r$, where the braces denote Stirling numbers of the second kind, \eqref{eq:factorial} implies, for $0\le j\le2k$, \begin{align*} |\E M^j-\E P^j|&\le\sum_{r=0}^j\left\{\begin{smallmatrix}j\\r\end{smallmatrix}\right\}|\E(M)_r-\mu^r|\\ &\le C_{k,C}\frac{n^2}{q}\mu^j. \end{align*} Here we used $\mu^r\le\mu^j$ when $r\le j$, since $\mu\ge1$. The Stirling sums are finite and all orders $r\le2k$ are fixed. The constants may change from line to line. In particular, the case $j=0$ has zero error. Expanding the centered moments and applying the triangle inequality term by term gives \begin{align} &\big|\E(M-\mu)^{2k}-\E(P-\mu)^{2k}\big|\notag\\ &\quad\le\sum_{j=0}^{2k}\binom{2k}{j}\mu^{2k-j}|\E M^j-\E P^j|\notag\\ &\quad\le C_{k,C}\frac{n^2}{q}\mu^{2k}\sum_{j=0}^{2k}\binom{2k}{j}\notag\\ &\quad\le C_{k,C}'\frac{n^2}{q}\mu^{2k}.\label{eq:centered} \end{align} The comparison is a finite algebraic estimate for each fixed $k$, with $\mu=q2^{-n}$ allowed to vary with $q$. The generating function of the centered Poisson variable follows directly from its probability mass function: \begin{align*} \E e^{t(P-\mu)} &= e^{-t\mu}\sum_{a=0}^{\infty}e^{ta}e^{-\mu}\frac{\mu^a}{a!}\\ &=e^{-(1+t)\mu}\exp(\mu e^t)\\ &=\exp(\mu(e^t-1-t)). \end{align*} Since \[ e^t-1-t=\sum_{d=2}^{\infty}\frac{t^d}{d!}, \] the $\ell$th power has no term of degree below $2\ell$. Expanding the outer exponential therefore shows that the coefficient of $t^{2k}$ is contributed only by powers of order at most $k$. With $[t^j]$ denoting coefficient extraction, we obtain \[ \begin{aligned} \E(P-\mu)^{2k}&=(2k)!\sum_{\ell=0}^k\frac{\mu^\ell}{\ell!}[t^{2k}](e^t-1-t)^\ell\\ &\le C_k\mu^k. \end{aligned} \] Each coefficient in this finite sum is nonnegative and depends only on $k,\ell$. The last inequality uses $\mu^\ell\le\mu^k$ for $0\le\ell\le k$. Combining with \eqref{eq:centered}, \[ \E(M-\mu)^{2k}\le C_{k,C}(\mu^k+(n^2/q)\mu^{2k}). \] On $M=0$ the centered even power equals $\mu^{2k}$, while for every other value of $M$ it is nonnegative. Thus \[ \mu^{2k}\ind_{\{M=0\}}\le(M-\mu)^{2k}. \] Taking expectations and dividing by the positive number $\mu^{2k}$ gives \[ \Prb(M=0)\le\frac{\E(M-\mu)^{2k}}{\mu^{2k}} \le C_{k,C}(\mu^{-k}+n^2/q). \] For each $Y=y$, the conditional probability of $M=0$ over the uniform signs is exactly \[ \Prb_{\Sigma}(M=0\mid Y=y) =2^{-n}\sum_{\sigma\in\{-1,1\}^n}\ind_{\{M_\sigma(y)=0\}} =2^{-n}B(y). \] Averaging over $Y$ yields the exact relation \[ \E_Y B(Y)=2^n\Prb_{Y,\Sigma}(M=0). \] Substituting $\mu=q2^{-n}$ into the probability bound yields \begin{equation}\label{eq:missing} \E_Y B(Y)\le C_{k,C}\left(\frac{2^{(k+1)n}}{q^k}+\frac{2^n n^2}{q}\right). \end{equation} The factor $2^n$ is essential, as this estimate controls all missing patterns simultaneously. \section{Completion of the proof} Fix $0<\varepsilon<1$ and set $n=\lfloor(1-\varepsilon)\log_2 q\rfloor$. For sufficiently large $q$, $n\ge1$. The definition of the floor gives \begin{align*} n&\le(1-\varepsilon)\log_2q,\\ 2^n&\le 2^{(1-\varepsilon)\log_2q}=q^{1-\varepsilon},\\ \mu&=q2^{-n}\ge q/q^{1-\varepsilon}=q^\varepsilon,\\ n&\le (\log q)/\log 2. \end{align*} Choose a fixed integer $k\ge1$ such that $(k+1)\varepsilon>1$. This choice depends on $\varepsilon$, not on $q$. Hence all factorial moment orders used above are bounded by $2k$ independently of $q$. For example, $k=\lceil1/\varepsilon\rceil$ suffices. The two terms in \eqref{eq:missing} satisfy \begin{align*} \frac{2^{(k+1)n}}{q^k}&\le\frac{q^{(k+1)(1-\varepsilon)}}{q^k}=q^{1-(k+1)\varepsilon},\\ \frac{2^nn^2}{q}&\le q^{-\varepsilon}\frac{(\log q)^2}{(\log 2)^2}. \end{align*} Consequently \[ \E_Y B(Y)\le C_{k,\varepsilon}\bigl(q^{1-(k+1)\varepsilon}+q^{-\varepsilon}(\log q)^2\bigr)\longrightarrow0. \] The first exponent is negative by the choice of $k$, and the second term tends to zero because $\varepsilon>0$ is fixed. Since $B(Y)$ is a nonnegative integer, $\ind_{\{B(Y)>0\}}\le B(Y)$. Consequently \begin{align*} \Prb_Y(B(Y)>0)&\le\E_Y B(Y)\longrightarrow0,\\ \Prb_Y(B(Y)=0)&=1-\Prb_Y(B(Y)>0)\longrightarrow1. \end{align*} Lemma~\ref{lem:shatter} now implies that with probability tending to one the tuple has distinct coordinates and is shattered with all witnesses outside the tuple. In particular, for sufficiently large $q$ there exists a tuple with $B(y)=0$, and hence \[ \lfloor(1-\varepsilon)\log_2 q\rfloor\le\VC_{\F_q}(S_q)\le\log_2 q. \] Dividing by $\log_2 q$ gives \[ 1-\varepsilon\le\liminf_{q\to\infty}\frac{\VC_{\F_q}(S_q)}{\log_2q} \le\limsup_{q\to\infty}\frac{\VC_{\F_q}(S_q)}{\log_2q}\le1. \] Letting $\varepsilon\downarrow0$ yields \[ \lim_{q\to\infty}\frac{\VC_{\F_q}(S_q)}{\log_2q}=1, \qquad \VC_{\F_q}(S_q)=(1+o(1))\log_2q.\qquad\square \] \begin{thebibliography}{9} \bibitem{MSW} B. McDonald, A. Sahay, and E. L. Wyman, The VC dimension of quadratic residues in finite fields, \emph{Discrete Mathematics} \textbf{348} (2025), no. 1, 114192. \href{https://arxiv.org/abs/2210.03789}{arXiv:2210.03789}. \bibitem{LN} R. Lidl and H. Niederreiter, \emph{Finite Fields}, 2nd ed., Encyclopedia of Mathematics and its Applications, vol. 20, Cambridge University Press, 1997. \end{thebibliography} \end{document}