Optimal Quantum Junta Testing
We determine the quantum query complexity of testing $k$-juntas for Boolean functions, unitaries, and quantum channels. Let $n$ denote the number of input bits or qubits and $\varepsilon$ the distance parameter. For all sufficiently large $k$, $n \ge 2k$, and $2^{-k/16} \le \varepsilon \le 1/16$, we establish the following tight bounds. $\bullet$ Junta functions: The query complexity is $Θ(\sqrt{k/\varepsilon})$, closing the gap left by Ambainis, Belovs, Regev, and de Wolf (SODA 2016) and Bun, Kothari, and Thaler (STOC 2018, ToC 2020). $\bullet$ Junta unitaries: The query complexity is $Θ(\sqrt{k}/\varepsilon)$, closing the gap left by Chen, Nadimpalli, and Yuen (SODA 2023). With forward-only access, the query complexity is $Θ(k/(\varepsilon^2 \log k))$. At constant $\varepsilon$, these bounds establish a separation between $Θ(\sqrt{k})$ queries with forward and inverse access and $Θ(k/\log k)$ queries with forward-only access. $\bullet$ Junta channels: The query complexity is $Θ(k/(\varepsilon^2 \log k))$, closing the gap left by Bao and Yao (COLT 2023, TPAMI 2025). The upper bounds for channels and forward-only unitaries are achieved by nonadaptive, ancilla-free testers using product inputs and single-qubit measurements. Our upper bounds follow from a reduction to \emph{union size testing}, a generalization of support size testing to distributions over subsets of a ground set. We develop optimal testers for this problem both from independent samples and from a reversible sampler. Our matching lower bounds use moment-matching constructions and a phase-masked unitary ensemble. For this ensemble, the average acceptance probability of every forward-only quantum algorithm admits an exact representation in terms of independent classical samples.