We present an optimal tester for support size that determines whether an unknown probability distribution is supported on n elements or ε-far away (in total variation distance) with sample complexity Θ(εlog(n)n), improving the prior best O(εlog(n)nlog(min{ε1,n})) due to Ferreira Pinto Jr. and Harms (STOC 2025). As a generalization, we provide a pretty good lower bound on support size.
1 Introduction
The support size of an unknown discrete probability distribution is an important measure of species diversity in ecology [FCW43]. The estimation of support size has been subsequently investigated in statistics from a theoretical perspective [Goo49, Goo53] (cf. [BF93]). Since “I don’t believe it is usually possible to estimate the number of unseen species [i.e., support size]” (quoting I. J. Good in [BF93]), the best we can hope is to consider weaker tasks with promise rather than estimation in all cases. Among them, support size testing is a basic statistical decision problem in property testing (cf. [Gol17, Section 11.4]).
Problem 1 (Support size testing). Given an unknown probability distribution p, the task is to determine whether p is supported on at most n elements or ε-far in total variation distance from any distribution supported on at most n elements. Formally, determine whether
Yes:∣supp(p)∣≤norNo:Δn(p)≥ε,
with the promise that it is in either case. Here, supp(p)={i:pi>0} denotes the set of elements with nonzero probability, and Δn(p)=infq:∣supp(q)∣≤ndTV(p,q) denotes the total variation distance of p to distributions supported on at most n elements, where dTV(p,q)=21∑i∣pi−qi∣.
This problem has been investigated in a series of works [GR22, AF24, AFL24, KLR25, FH25]. In particular, the prior best approach is with sample complexity O(εlog(n)nlog(min{ε1,n})) due to [FH25], improving the prior approaches via learning histograms [VV11, VV17, HJW18, HO19] with sample complexity O(ε2log(n)n). However, the prior best lower bound is Ω(εlog(n)n) implied by [VV11, Theorem 2] and [WY19, Proposition 1]. There still remains a gap of log(min{ε1,n}) between the upper and lower bounds. In this paper, we present an optimal support size tester, thereby closing this gap.
Theorem 1.1 (Optimal support size testing). There is an algorithm for support size testing with optimal sample complexity Θ(εlog(n)n).
*Qisheng Wang is with the School of Computer Science, Shanghai Jiao Tong University (e-mail: QishengWang1994@gmail.com).
1.1 Generalization: Pretty good lower bound on support size
As a generalization of this result, we can further give a pretty good lower bound on the support size, without any assumptions on the distribution.
Theorem 1.2 (Pretty good lower bound on support size). There is an algorithm that uses Θ(εlog(n)n) samples drawn from an unknown distribution p and outputs a number S∈{1,2,…,n} such that with probability at least 2/3,
min{effε(p),n}≤S≤∣supp(p)∣,(1)
where effε(p) is the ε-effective support size of p, 1 the smallest number k∈N such that there is a distribution q with ∣supp(q)∣=k and dTV(p,q)≤ε.
If an estimate S satisfies Equation (1), then we call it a pretty good lower bound on support size, which is a stronger definition than the good lower bound on support size min{effε(p),n}≤S≤(1+ε)∣supp(p)∣ defined in [FH25, Corollary 1.6], where we remove the factor (1+ε). Theorem 1.2 can also be interpreted as: using m samples, one can obtain a lower bound on support size at least min{effε(p),Θ(εmlog(e+εm))}, which improves the lower bound min{effε(p),Θ(log(1/ε)εmlog(m))} in [FH25].
The algorithm in Theorem 1.2 is also optimal since a pretty good lower bound on support size can solve the support size testing problem: ∣supp(p)∣≤⌊n/2⌋ vs Δ⌊n/2⌋(p)≥2ε, and thus the lower bound Ω(εlog(n)n) for support size testing [VV11, WY19] applies.
1.2 Implications in distribution-free sample-based testing
In [FH25], they provided an algorithm for testing the class Hn of Boolean functions f:N→{0,1} with ∣f−1(1)∣≤n with sample complexity O(εlog(n)nlog(1/ε)) in the distribution-free sample-based testing model [GR16, Gol17, RR20, BFH21, RR22]. Testing Boolean function classes can aid the proper PAC (probably approximately correct) learning in model selection when testing is faster than learning. As an implication of our results, combining [FH25, Theorem 1.8], we settle the sample complexity of testing Hn.
Theorem 1.3 (Optimal distribution-free sample-based testing for Hn). There is an algorithm that uses Θ(εlog(n)n) samples of the form (x,f(x)) with x∼p for an unknown function f:N→{0,1} and an unknown probability distribution p, and determines whether f∈Hn or f is ε-far from Hn (i.e., infg∈HnPrx∼p[f(x)=g(x)]≥ε) with success probability at least 2/3.
Proof. [FH25, Theorem 1.8] gives mHn(n,ε)≤msupp(n,ε)+O(1/ε) where mHn(n,ε) is the sample complexity of testing Hn and msupp(n,ε) is the sample complexity of support size testing.
The upper bound in Theorem 1.3 matches the lower bound Ω(εlog(VC)VC) due to [BFH21] (cf. [FH25, Section 1.3]), where the VC (Vapnik–Chervonenkis) dimension of Hn is VC(Hn)=n.
1.3 Techniques
We now explain the intuition of our tester. Given the inspiration from prior approaches, we use a new strategy to solve an even harder problem: pretty good lower bound on support size. During
1The effective support size was recently involved in property testing [CDS18, BCG19], and its estimation (in a query model) was studied in [Gol19, NT23, Gol25].
2If ∣supp(p)∣≤⌊n/2⌋, then S≤⌊n/2⌋. If Δ⌊n/2⌋(p)≥2ε, then effε(p)>⌊n/2⌋, which gives S≥⌊n/2⌋+1.
directly facing this harder problem, it suggests new forms of testers and better parameter choices. Since our tester itself (as well as its correctness proof) is very simple, for the readers who are interested in the specific construction, skip to the last paragraph of this subsection and Section 3.
Like prior works [JVHW15, WY16] on property testing, we employ the Poissonized sampling model: Let M∼Poi(m), draw M independent samples X1,X2,…,XM from p, and the algorithm takes the empirical counts Ni=∑j1{Xj=i} as input. The sample complexity in the Poissonized sampling model is essentially the same as that in the standard (multinomial) sampling model up to a constant factor; namely, the algorithm takes independent samples X1,X2,…,Xm∼p as input.
The approach of [FH25]. In [FH25], they first provided a tester for support size and then used it as a subroutine to give a good lower bound on support size. Their tester is of the form
SFH:=Sa,b,k,m=i∑fa,b,k,m(Ni),
with a≍nεlog(ε1), b≍nlog(1/ε)εlog2(n), k≍log(n), and m≍εlog(n)nlog(1/ε), where
Their tester returns “Yes” if SFH<(1+2ε)n and “No” otherwise. Here, Tk(x) is the k-th Chebyshev polynomial of the first kind. It is noted that Pa,b,k(⋅) and fa,b,k,m(⋅) were also used in [WY19] for support size estimation.
New strategy for testing. Rather than directly focusing on support size testing, we aim to deal with giving a pretty good lower bound on support size as well. Namely, our goal is to directly find a pretty good lower bound S on support size such that min{effε(p),n}≤S≤∣supp(p)∣. If this can be done, it already gives a support size tester, as explained in Section 1.1. So, in the following, we skip directly to solving this harder task and we will explain why the harder task will give hints to an optimal support size tester.
Step 1: Removing the multiplicative factor (1+ε). The reason that the good lower bound on support size obtained in [FH25] has an upper bound of (1+ε)∣supp(p)∣ with a multiplicative factor (1+ε) is that if ∣supp(p)∣≤n, the best possible upper bound on E[SFH] we can have is already E[SFH]≤(1+δ)∣supp(p)∣ where δ=ε/4 (see [FH25, Lemma 3.7]). On the other hand, ∣SFH−E[SFH]∣≤δn with high probability (see [FH25, Lemma 3.17]). The two inequalities inspire us to consider the case where there is a tester S such that with high probability,
E[S]≤(1+δ)∣supp(p)∣,S−E[S]≤δn,
where δ=ε/4 reduces to the case of [FH25]. The two conditions together yield
S≤(1+δ)∣supp(p)∣+δn,
which is
1+δS−δn≤∣supp(p)∣.
This suggests we use a tester of the form
Sa,b,k,m,δ′=1+δSa,b,k,m−δn,
which guarantees Sa,b,k,m,δ′≤∣supp(p)∣ with high probability. Since our goal is the sample complexity m≍εlog(n)n, it remains to determine the rest parameters.
Step 2: The choice of parameter a leads to multiple sub-testers. We now consider how to choose a so that Sa,b,k,m,δ′≥effε(p) when effε(p)≤n. In other words, for every 1≤r≤n, if effε(p)>r, then Sa,b,k,m,δ′>r. Note that under some smooth conditions, one has EX∼Poi(mx)[fa,b,k,m(X)]≥(1−δa)min{x/a,1} (see Lemma 2.3), where δa>0 depends on a. When effε(p)>r, this further leads to
Sa,b,k,m,δa′−r≥1+δa(1−δa)ε/p(r)−2δa(n+r),
where p(r) denotes the r-th largest probability weight of p. So, in order to ensure Sa,b,k,m,δa′>r, it suffices to ensure (1−δa)ε/p(r)>2δa(n+r), which, for small δa≤1/4, is
δan≲p(r)ε.(4)
However, p(r) is not known yet. To overcome this issue, we consider a list of candidates of a, namely a0,a1,…,aJ with aj=2ja0. For large enough J, there must be a 0≤j<J such that aj≤p(r)<aj+1=2aj, in which case p(r)≍aj and one can take δaj≍ajnε to meet Equation (4). To complete this, since smaller a gives larger δa while we require in our analysis that δa≤1/4, the smallest possible a (i.e., a0) we can choose is therefore a0≍δa0nε, which is a0≍nε when δa≍1. As a result, we can take aj≍n2jε and δj≍2−j and these suggest a tester of the form
S′=0≤j≤JmaxSaj,bj,kj,m,δj′.
For the rest of the parameters, kj≍ajbjlog(δj1)≲log(n) is chosen to ensure that ρ=(Tkj(bj−ajbj+aj))−1<δj, and bj≍mlog(n)≍nεlog2(n) is chosen to ensure that every element with top-n probability is seen with high probability. As a result, J≍log(a0b)≍log(log(n)).
Step 3: Maximum likelihood estimation strikes back. However, the tester S′ may fail in some extreme cases. For example, when p1=p2=⋯=pn−1=n−11−ε and pn=ε with ε=4n1, Δn−1(p)=ε and effε(p)=∣supp(p)∣=n, which forces the pretty good lower bound on the support size of p to be exactly S=n. On the other hand, with high probability, Saj,bj,kj,m=n, which gives Saj,bj,kj,m,δj′≤n−1 as long as δjn≳1 and therefore S′≤n−1.
To overcome this issue, we employ the simple maximum likelihood estimator
SMLE=i∑1{Ni>0},
(5) and finally our tester is now completed:
Sour=max{SMLE,S′}.
It only remains to verify that the tester Sour can give a pretty good lower bound on support size and thus a support size tester.
where m≍εlog(n)n and aj≍n2jε, bj≍nεlog2(n), kj≲log(n), δj≍2−j, and J≍log(log(n)). Note that the choice of bj is independent of j. With the choice of these parameters,
Sour gives a pretty good lower bound on support size.
The support size tester is immediate: return “Yes” if Sour≤n and “No” otherwise.
1.4 Independent and Simultaneous Work
During the preparation of this paper, the author became aware of the independent work [BGY26] with an optimal support size tester over a finite alphabet. Although both approaches employ polynomial estimators, their algorithmic construction is substantially different. Specifically, they first amplify the samples by taking unions, construct an initial set of observed elements, and then reduce the problem to testing bounded residual sets, involving the Fejér polynomial. In contrast, our approach directly deals with the empirical counts using sub-testers involving affined Chebyshev polynomials. Furthermore, our approach yields a pretty good lower bound on support size, providing a numerical guarantee beyond support size testing.
2 Preliminaries
Fact 2.1 ([MU05, Exercise 4.7]). For M∼Poi(m), then Pr[M>4m]≤e−m.
Fact 2.2. Let independent Ni∼Poi(mpi). Define SMLE as in Equation (5). Then,
Var[SMLE]≤E[SMLE]=i∑(1−e−mpi)≤∣supp(p)∣.(6)
If Δr(p)≥ε, then
Pr[SMLE≤r]≤mεr+1.(7)
Lemma 2.3 (Adapted from [FH25, Proposition 2.12, 3.2, 3.4, and 3.14]). Let 0<a<b≤1, m>0 and integer k≥1. Let Pa,b,k(x) and fa,b,k,m(ℓ) be defined in Equations (2) and (3), respectively. Then,
Proof. It can be verified that the tuple (a,b,k,m):=(aj,b,kj,m) satisfies the conditions required in Lemma 2.3: mb(b−aj)≥kj and aj≤b/2. Equation (9) in Lemma 2.3 gives
Proof. If L<L0, then S=SMLE. Then, S=SMLE≤∣supp(p)∣ holds with certainty, which gives Equation (15). For 1≤r≤n, if Δr(p)≥ε, Equation (7) in Fact 2.2 gives Equation (16):
Pr[S≤r]=Pr[SMLE≤r]≤mεr+1≤mε2n≤C02L<0.01.
In the rest, we assume that L≥L0. To see Equation (15), since E[SMLE]≤∣supp(p)∣≤n≤2n, Equation (14) in Lemma 4.1 gives that it holds with probability at least 0.99 that ∣SjCheb−E[SjCheb]∣≤δjn for all 0≤j≤J, in which case Equation (13) in Lemma 4.1 gives
1+δjSjCheb−δjn≤1+δjE[SjCheb]≤∣supp(p)∣.
To show Equation (16), we consider two cases.
E[SMLE]>2n. Since S≥SMLE, Equation (6) in Fact 2.2, together with Chebyshev's inequality, gives
where we use δj≤1/4 and r≤n. This yields Equation (16).
Proof of Theorem 1.1. When ∣supp(p)∣≤n, Lemma 4.2 gives that Pr[S>n]≤Pr[S>∣supp(p)∣]<0.01. When Δn(p)≥ε, Lemma 4.2 gives Pr[S≤n]<0.01.
Proof of Theorem 1.2. When ∣supp(p)∣≥n, S≤n≤∣supp(p)∣ holds with certainty. When ∣supp(p)∣<n, Lemma 4.2 gives Pr[S>∣supp(p)∣]≤0.01. Therefore, Pr[S≤∣supp(p)∣]≥0.99.
For the left hand side of the inequality, let r=min{effε(p),n}−1. If r=0, then S≥1=r+1 with certainty. If 1≤r≤n−1, then Δr(p)>ε. Lemma 4.2 gives Pr[S≤r]<0.01, which is Pr[S≥min{effε(p),n}]≥0.99.
Combining the above with the union bound gives Pr[min{effε(p),n}≤S≤∣supp(p)∣]≥0.98.
Acknowledgment
The author used Large Language Models as AI-assisted research and writing tools throughout the preparation of this paper. The tools were used to help brainstorm ideas and explore proof strategies. All final mathematical claims, algorithms, proofs, citations, and wording were written by the author. The author assumes responsibility for all content of the paper.
The author thanks Jinge Bao, Minbo Gao, and Penghui Yao for communication regarding the related work [BGY26].
References
[AF24] Tomer Adar and Eldar Fischer. Refining the adaptivity notion in the huge object model. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2024), pages 45:1–45:16, 2024. doi:10.4230/LIPIcs.APROX/RANDOM.2024.45.1
[AFL24] Tomer Adar, Eldar Fischer, and Amit Levi. Support testing in the huge object model. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2024), pages 46:1–46:16, 2024. doi:10.4230/LIPIcs.APROX/RANDOM.2024.46.1
[BCG19] Eric Blais, Clément L. Canonne, and Tom Gur. Distribution testing lower bounds via reductions from communication complexity. ACM Transactions on Computation Theory, 11(2):6:1–6:37, 2019. doi:10.1145/3305270.2
[BF93] J. Bunge and M. Fitzpatrick. Estimating the number of species: A review. Journal of the American Statistical Association, 88(421):364–373, 1993. doi:10.1080/01621459.1993.10594330.1
[BFH21] Eric Blais, Renato Ferreira Pinto Jr., and Nathaniel Harms. VC dimension and distribution-free sample-based testing. In Proceedings of the 53rd Annual ACM SIGACT Symposium on Theory of Computing, pages 504–517, 2021. doi:10.1145/3406325.3451104. 2
[FCW43] R. A. Fisher, A. Steven Corbet, and C. B. Williams. The relation between the number of species and the number of individuals in a random sample of an animal population. Journal of Animal Ecology, 12(1):42–58, 1943. doi:10.2307/1411.1
[FH25] Renato Ferreira Pinto Jr. and Nathaniel Harms. Testing support size more efficiently than learning histograms. In Proceedings of the 57th ACM Symposium on Theory of Computing, pages 995–1006, 2025. doi:10.1145/3717823.3718134. 1, 2, 3, 5
[Gol17] Oded Goldreich. Introduction to property testing. Cambridge University Press, 2017. doi:10.1017/9781108135252. 1, 2
[Gol19] Oded Goldreich. Testing bipartitness in an augmented VDF bounded-degree graph model. ArXiv preprints, 2019. arXiv:1905.03070. 2
[Gol25] Oded Goldreich. On the complexity of estimating the effective support size. In Oded Goldreich, editor, Computational Complexity and Local Algorithms: On the Interplay Between Randomness and Computation, volume 15700 of Lecture Notes in Computer Science, pages 204–236. Springer, 2025. doi:10.1007/978-3-031-88946-2_13. 2
[Goo49] Leo A. Goodman. On the estimation of the number of classes in a population. Annals of Mathematical Statistics, 20(4):572–579, 1949. doi:10.1214/aoms/1177729949.1
[Goo53] I. J. Good. The population frequencies of species and the estimation of population parameters. Biometrika, 40(3–4):237–264, 1953. doi:10.2307/2333344.1
[GR16] Oded Goldreich and Dana Ron. On sample-based testers. ACM Transactions on Computation Theory, 8(2):7:1–7:54, 2016. doi:10.1145/2898355.2
[GR22] Oded Goldreich and Dana Ron. Testing distributions of huge objects. In Proceedings of the 13th Innovations in Theoretical Computer Science Conference, pages 78:1–78:19, 2022. doi:10.4230/LIPIcs.ITCS.2022.78.1
[HJW18] Yanjun Han, Jiantao Jiao, and Tsachy Weissman. Local moment matching: A unified methodology for symmetric functional estimation and distribution estimation under Wasserstein distance. In Proceedings of the 31st Conference On Learning Theory, pages 3189–3221, 2018. URL: https://proceedings.mlr.press/v75/han18b.html. 1
[JVHW15] Jiantao Jiao, Kartik Venkat, Yanjun Han, and Tsachy Weissman. Minimax estimation of functionals of discrete distributions. IEEE Transactions on Information Theory, 61(5):2835–2885, 2015. doi:10.1109/TIT.2015.2412945. 3
[KLR25] Esty Kelman, Ephraim Linder, and Sofya Raskhodnikova. Online versus offline adversaries in property testing. In Proceedings of the 16th Innovations in Theoretical Computer Science Conference, pages 65:1–65:18, 2025. doi:10.4230/LIPIcs.ITCS.2025.65.1
[MU05] Michael Mitzenmacher and Eli Upfal. Probability and Computing: Randomization and Probabilistic Techniques in Algorithms and Data Analysis. Cambridge University, 2005. 5
[NT23] Shyam Narayanan and Jakub Tětek. Estimating the effective support size in constant query complexity. In Proceedings of the 2023 Symposium on Simplicity in Algorithms (SOSA), pages 242–252, 2023. doi:10.1137/1.9781611977585.ch22. 2
[RR20] Dana Ron and Asaf Rosin. Almost optimal distribution-free sample-based testing of k-modality. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2020), pages 27:1–27:19, 2020. doi:10.4230/LIPIcs.APPROX/RANDOM.2020.27.2
[RR22] Dana Ron and Asaf Rosin. Optimal distribution-free sample-based testing of subsequence-freeness with one-sided error. ACM Transactions on Computation Theory, 14(1):4:1–4:31, 2022. doi:10.1145/3512750.2
[VV11] Gregory Valiant and Paul Valiant. Estimating the unseen: an n/log(n)-sample estimator for entropy and support size, shown optimal via new CLTs. In Proceedings of the 43rd Annual ACM Symposium on Theory of Computing, pages 685–694, 2011. doi:10.1145/1993636.1993727. 1, 2
[VV17] Gregory Valiant and Paul Valiant. Estimating the unseen: improved estimators for entropy and other properties. Journal of the ACM, 64(6):37:1–37:41, 2017. doi:10.1145/3125643.1
[WY16] Yihong Wu and Pengkun Yang. Minimax rates of entropy estimation on large alphabets via best polynomial approximation. IEEE Transactions on Information Theory, 62(6):3702–3720, 2016. doi:10.1109/TIT.2016.2548468. 3
[WY19] Yihong Wu and Pengkun Yang. Chebyshev polynomials, moment matching, and optimal estimation of the unseen. Annals of Statistics, 47(2):857–883, 2019. doi:10.1214/17-AOS1665. 1, 2, 3
A Proof of Lemma 2.3
Proof. By definition, direct calculation gives Equation (8):
where we use Pa,b,k(0)=−1 and Pa,b,k(a)=−ρ. Moreover, since Pa,b,k(x)≤0 and e−mx≤1 for 0≤x≤a, Equation (8) gives
a(1−ρ)x≤Q(x)≤1,0≤x≤a.(17)
a≤x≤b. Since ∣Pa,b,k(x)∣≤ρ, Equation (8) gives
1−ρ≤Q(x)≤1+ρ.(18)
x≥b. Let u=b−a2(x−b)≥0. Note that b−ab+a−2x=−1−u. Then,
Tk(1+u)=cosh(karcosh(1+u))≤ekarcosh(1+u)≤ek2u.
On the other hand, the condition mb(b−a)≥k, together with the fact that x=b+2b−au≥2b(b−a)u, implies mx≥k2u. Therefore,
∣Q(x)−1∣=ρe−mxTk(1+u)≤ρek2u−mx≤ρ.(19)
Combining Equations (17) to (19) gives Equation (9).
Finally, we prove Equation (10). Let u=x/b. Then,
P(x)=P(bu)=−ρTk(α−βu),α=b−aa+b≤3,β=b−a2b≤4.
Let Mj=∥Tj(α−βu)∥1 be the absolute sum of the coefficients of Tj(α−βu) in terms of u. Then, M0=1, M1≤7, and Mj+1≤14Mj+Mj−1, which gives Mj≤15j for any integer j≥0. Therefore,