# Style-Content Disentanglement in Language-Image Pretraining Representations
for Zero-Shot Sketch-to-Image Synthesis

Jan Zuiderveld

###### Abstract

In this work, we propose and validate a framework to leverage language-image
pretraining representations for training-free zero-shot sketch-to-image
synthesis. We show that disentangled content and style representations can be
utilized to guide image generators to employ them as sketch-to-image
generators without (re-)training any parameters. Our approach for
disentangling style and content entails a simple method consisting of
elementary arithmetic assuming compositionality of information in
representations of input sketches. Our results demonstrate that this approach
is competitive with state-of-the-art instance-level open-domain sketch-to-
image models, while only depending on pretrained off-the-shelf models and a
fraction of the data.

Style-Content Disentanglement, Sketch-to-Image Synthesis, Language-Image
Pretraining

Figure 1: Several selected zero-shot outputs of our proposed framework, with
given input sketches and style representations.

##  1 Introduction

The power and promise of deep generative models such as GANs (Goodfellow et
al., 2014) lie in their ability to synthesize endless realistic, diverse, and
novel content with minimal user effort. The potential utility of these models
continues to grow thanks to the increased quality and resolution of large-
scale generative models in recent years. Conditional image synthesis allows
users to use inputs to control the output of image synthesis methods. A
variety of input modalities have been studied, mostly based on conditional
GANs (Mirza & Osindero, 2014). Several methods exist that allow generative
models to be guided by conditioning variables, e.g. text, sketches or
segmentation maps. Sketch conditioning finds a practical middle ground within
the characteristics of these methods. It allows significantly more control
over output structure than text conditioning, while not requiring labels as
segmentation conditioning does.

However, current sketch conditioned models are trained on a relatively narrow
set of visual concepts. This restricts the space of possible inputs that
result in desired output images, impeding the general usability of these
models. An important cause of this is the fact that paired image datasets are
labor intensive and costly to create. Approaches that circumvent this
requirement exist, including CycleGAN based architectures (Liu et al., 2020;
Xiang et al., 2021) and the usage of image-to-sketch models for synthesizing
paired data . But as of yet, no work has been published applying sketch-to-
image synthesis on large, highly diverse datasets.

Recently, the idea of learning visual concepts from supervision contained in
natural language has gained a lot of attention. Language-Image Pre-training
models learn unified visual- and natural language representations from the
supervision contained in the vast amount of text and associated images on the
internet, resulting in very rich visual representations and strong zero-shot
classification performance.

In this work, we adopt a framework to leverage classifier representations for
sketch-to-image generation. A simple method consisting of elementary
arithmetic assuming compositionality of information in the representations is
used to disentangle spatial and conceptual information from stylistic
information in representations of input sketches. We show that these
disentangled representations can then be utilized to guide image generators to
employ them as sketch-to-image generators without (re-)training any
parameters.111Our code and additional samples will be made publicly available
at [retracted for anonymity]

Our results demonstrate that this approach, when used with sufficiently
flexible image generators and informative representations, is competitive with
state-of-the-art instance-level open-domain sketch-to-image models evaluated
on in-domain inputs. Current state-of-the-art models feature complex
architectures and require large datasets, while our proposed framework depends
on pretrained off-the-shelf models, requires no training, and is evaluated in
a zero-shot fashion. Figure 1 shows several selected sketch-to-image
translations by our approach.

Our approach is simple to implement while also requiring minimal tuning. To
emphasize the potential of the core methodology itself, we report results with
default hyperparameters and no additional optimizations. The effectiveness of
our method indicates that representations learned by language-image
pretraining exhibit strong compositionality, something that has not been
harnessed for disentanglement in earlier research.

##  2 Related Work

###  2.1 Sketch to Image Synthesis

The goal of sketch-based image synthesis is to output a target image from a
given sketch. Early works (Chen et al., 2009, 2012; Eitz et al., 2011) regard
freehand sketches as queries or constraints to retrieve each composition and
stitch them into a picture, requiring availability of close image matches in
the queried database for reasonable results. In recent years, an increasing
number of works adopt GAN-based models to learn sketch-to-image synthesis
directly.

Several works (Zhu et al., 2017a; Li et al., 2019; Chen et al., 2020) train
Conditional GANs with photos and corresponding edge maps to make up for the
lack of real sketch data, but only report results trained on single class
datasets. However, sketches differ from edge maps in several ways, resulting
in inferior results when applying these models to sketches. The authors of
SketchyGAN (Chen & Hays, 2018) extended the largest currently available paired
dataset of sketches and pictures (75k sketches across 125 categories),
extended it and trained a conditional GAN on these. ContextualGAN (Lu et al.,
2018) turns the image generation problem into an image completion problem: the
network learns the joint distribution of sketch and image pairs and acquires
the result by iteratively traversing the manifold. PoE-GAN (Huang et al.,
2021) is a multimodal conditional GAN that is trained on images with paired
text, sketch and segmentation maps, achieving state-of-the-art scene-level
sketch-to-image synthesis. Xiang et al. (Xiang et al., 2021) propose a
framework that jointly learns sketch-to-photo and photo-to-sketch generation
to help in generalizing to open-domain classes, and achieve state-of-the-art
instance-level sketch-to-image synthesis.

All of these previously proposed architectures are trained on datasets with a
limited amount of classes. To the best of our knowledge, there is no published
research reporting training any kind of image-to-image translation
architectures on large-scale, diverse datasets for zero-shot image-to-image,
or sketch-to-image synthesis.

###  2.2 Language-Image Pre-training

Multiple recent works learn cross-modal vision and language representations
(Lu et al., 2019; Xu et al., 2018) for a variety of tasks. Following the
success of Transformers (Vaswani et al., 2017) in various language tasks,
recent vision and joint vision language methods typically use transformers as
their backbone. A recent model, based on Contrastive Language-Image Pre-
training (CLIP) (Radford et al., 2021), consisting of a transformer- language
encoder and image encoder is trained to learn a multi-modal representation
space. which can be used to estimate the semantic similarity between a given
text and an image by evaluating embeddings’ cosine similarity.

CLIP was trained on 400 million text-image pairs, collected from a variety of
publicly available sources on the Internet. The representations learned by
CLIP have been shown to be extremely powerful, enabling state-of-the-art zero-
shot image classification on a variety of datasets.

Figure 2: Overview of our proposed framework.

###  2.3 Classifier Guidance Based Image Synthesis

GANs for conditional image synthesis make heavy use of class labels. This
often takes the form of class-conditional normalization statistics (De Vries
et al., 2017) as well as discriminator heads that are explicitly designed to
behave like classifiers (Miyato & Koyama, 2018), indicating that class
information is crucial to the success of these models. The general idea of
optimizing latent representations or parameters of an image generator using a
separately trained classifier has been widely used as a powerful framework for
generating, editing and recovering images (Dhariwal & Nichol, 2021; Abdal et
al., 2019; Härkönen et al., 2020). Santurkar et al. (Santurkar et al., 2019)
show that adversarial robustness of the classifier is a crucial aspect for
optimal execution of such tasks.

Several projects use CLIP as a classifier to guide text-to-image generation
through optimization. Examples include optimizing the weights of implicit
neural representation networks (Stanley, 2007), the latent space of StyleGAN2
(Karras et al., 2020) and VQGAN (Esser et al., 2021), and guiding diffusion
architectures (Nichol et al., 2021).

##  3 Methodology

Much current research in unsupervised image-to-image translation relies on
learning content and style representations. In these approaches, the content
$\mathbf{c}_{i}$ of input images $\mathbf{X}_{i}$ and the style of target
images $\mathbf{s}_{K}$ together condition a generator G that synthesizes
translated images $\mathbf{X}_{t}=G(\mathbf{c}_{i},\mathbf{s}_{t})$.

Instead of learning content and style representations from scratch, we propose
a simple method for disentangling style and content in representations of a
pretrained image encoder $E$ under the assumptions of in-distribution input
and compositionality of representations. We use obtained representations to
guide $G$. We apply this framework to zero-shot sketch-to-image synthesis. To
emphasize the potential of the core methodology itself, we report results with
default hyperparameters and no additional optimizations. See Figure 2 for a
general overview.

###  3.1 Problem Formulation

Let us model the formation of an image $\mathbf{X}$ as a function of style
$\mathbf{s}\in\mathcal{S}$ and content $\mathbf{c}\in\mathcal{C}$,
$\mathbf{X}=G\left(\mathbf{s},\mathbf{c}\right)$. Let $\mathcal{P}$ denote the
set of possible ”parts” of an image, these parts be any feature of the input,
e.g. the presence and location of an object, features of this object such as
its size and color, or global style of an image. Let $\mathcal{X}$ denote the
input space. For each $\mathbf{X}\in\mathcal{X}$ , we assume the existence of
a function $D$ mapping $\mathbf{X}\text{ to
}\mathcal{P}^{\prime}\subseteq\mathcal{P}$, the set of its parts. Style
$\mathbf{s}$ describes all parts $\mathbf{p}^{s}\in D(\mathbf{X})$ that are
invariant within the stylistic domain of $\mathbf{X}$, while content
$\mathbf{c}$ describes all residual parts $\mathbf{p}^{c}\in D(\mathbf{X})$
that are not described by style $\mathbf{s}$.

Given an input dataset $D_{j}$ of $N$ images $\mathbf{X}_{i}$, all sampled
from stylistic domain $\mathbf{s}_{j}$ with normally distributed content
$\mathbf{c}_{i}$,

$D_{j}=\left\\{X_{i}\right\\}_{i=1}^{N},\quad\mathbf{X}_{i}=G\left(\mathbf{s}_{j},\mathbf{c}_{i}\right),\quad\mathbf{c}_{i}\sim\mathcal{N}\left(0,\sigma^{2}\mathbf{I}\right),$

we use image encoder $E$: $\mathcal{X}\rightarrow\mathcal{R}$ to obtain
representations $\mathbf{r}_{i}=E(\mathbf{X}_{i})$, where $\mathcal{R}$
denotes the representation space. We assume $\mathbf{r}_{i}$ to be
compositional, meaning it can be expressed as a weighted sum of simpler parts.
Let $h:\mathcal{P}\rightarrow\mathcal{R}$ denote a function that maps parts to
representations. Formally, we define a function $f(\mathbf{X})\in\mathcal{R}$
as compositional if it can be expressed as a weighted sum of the elements of
$\\{h(p)\mid p\in D(\mathbf{X})\\}$

Then, we can decompose $\mathbf{r}_{i}$ as a sum of content representation
$\mathbf{r}_{i}^{c}$ and style representation $\mathbf{r}_{j}^{s}$,
$\mathbf{r}_{i}=\mathbf{r}_{i}^{c}+\mathbf{r}_{j}^{s}$. We assume
$\mathbf{X}_{i}$ to be in-distribution for $E(\mathbf{X})$, and note that
$\mathbf{r}_{i}^{c}$ follows the distribution of $\mathbf{c}_{i}$. We can then
obtain $\mathbf{r}_{j}^{s}$ by taking the arithmetic mean over all
$\mathbf{r}_{i}$,

$\mathbf{r}_{j}^{s}=\frac{1}{N}\sum_{i=1}^{N}\mathbf{r}_{i}=\frac{1}{N}\sum_{i=1}^{N}r^{\mathbf{c}}_{i}+\frac{1}{N}\sum_{i=1}^{N}\mathbf{r}_{j}^{s}=0+\frac{N}{N}\mathbf{r}_{j}^{s}.$

Finally, to obtain $\mathbf{r}_{i}^{c}$ we subtract $\mathbf{r}_{j}^{s}$ from
$\mathbf{r}_{i}$,

$\mathbf{r}_{i}^{c}=\mathbf{r}_{i}-\mathbf{r}_{j}^{s}=\mathbf{r}_{i}^{c}+\mathbf{r}_{j}^{s}-\mathbf{r}_{j}^{s}.$

Using these operations we obtain $\mathbf{r}_{i}^{c}$ describing the content
of input images $\mathbf{X}_{i}$ from stylistic domain $\mathbf{s}_{j}$, and
$\mathbf{r}_{t}^{s}$ describing target stylistic domain $\mathbf{s}_{t}$ of
dataset $D_{t}$ of $M$ images. We sum these to create target representations
for guiding image synthesis:
$\mathbf{r}_{t}=\mathbf{r}_{i}^{c}+\mathbf{r}_{t}^{s}$.

Specifically, given image generator $G(\mathbf{z})$, and image encoder $E$, we
solve the following optimization problem to iteratively update
$\mathbf{X}_{t}$, a translation of $\mathbf{X}_{i}$ in style $\mathbf{s}_{t}$:

$\underset{\mathbf{z}\in\mathcal{Z}}{\arg\min}\frac{\left\langle
E(G(\mathbf{z})),\mathbf{r}_{t}\right\rangle}{\left\|E(G(\mathbf{z}))\right\|\cdot\left\|\mathbf{r}_{t}\right\|},$

where $\langle\cdot,\cdot\rangle$ computes the cosine similarity between its
arguments.

Figure 3: Zero-shot sketch-to-image results $\mathbf{X}_{t}$ for several
random source images $\mathbf{X}_{i}$ and target styles $\mathbf{s}_{t}$

.

###  3.2 Improving Adversarial Robustness

Most off-the-shelf classifiers are not trained for exhibiting adversarial
robustness. Since we are directly optimizing images using such classifiers,
this process is prone to induce non-semantic perturbations in $\mathbf{X}_{t}$
that increase classification scores (Liu et al., 2021). Inspired by self-
supervised learning methods, we use augmentation pipeline $a$ when feeding
input $\mathbf{X}_{t}$ to image encoder $E$:

$a(\mathbf{X}_{t})=\mathbb{E}_{\mathbf{X}_{t}^{\prime}\sim\pi(\cdot\mid\mathbf{X}_{t})}$

where $\mathbf{X}_{t}^{\prime}$ is a random perturbation of the input image
$\mathbf{X}_{t}$ drawn from distribution $\pi(\cdot\mid\mathbf{X}_{t})$ of
candidate data augmentations, including random colorization, translation, and
cutout. This generates new samples $\mathbf{X}_{t}^{\prime}$ that should
average out adversarial gradients while preserving content and style
information in $\mathbf{X}_{t}$.

##  4 Experimental setup

###  4.1 Image Encoder $\mathbf{E}$

To evaluate the adopted framework we report experiments with CLIP (Radford et
al., 2021) as the image encoder $E$. CLIP is well-suited for our framework as
the large-scale dataset it has been trained on ensures that a wide range of
styles $\mathbf{s}$ are in-distribution. And, more importantly, the excellent
zero-shot performance of CLIP indicates its representations exhibit a
significant amount of compositionality, making it well-suited for our style-
content disentanglement method.

The notion that zero-shot classification performance strongly correlates with
compositionality in learned representations is demonstrated by Sylvain et al.
(Sylvain et al., 2019). This is very intuitive: we expect compositionality to
be an advantage in zero-shot learning: if a model has a good understanding of
how parts map to representations, it can learn to combine known concepts to
describe new classes.

Since CLIP also includes a natural language encoder which maps text to the
same embedding space as its image encoder, we also experiment with target
styles $\mathbf{s}_{t}$ obtained through directly encoding text.

###  4.2 Image Generator $\mathbf{G}$

The space of images our approach is able to synthesize is limited by the
representational power of the image generator we use. Our method is prone to
inherit biases of the used generator, either induced by its training data e.g.
center, spatial or color bias, or by inductive biases present in its
architecture.

Since we aim to achieve zero-shot sketch-to-image synthesis, the image
generator needs to be relatively flexible. However, very flexible image
generators such as differentiable image parameterizations, e.g. implicit
neural representations (Stanley, 2007) or direct pixel optimization,
facilitate adversarial attacks.

Based on preliminary experiments we use VQGAN (Esser et al., 2021) as $G$ for
our main experiments. VQGAN exhibits flexible image synthesis, arguably due to
its latent embedding structure. We initialize $\mathbf{z}$ by using VQGAN’s
image encoder to encode input sketch $\mathbf{X}_{i}$.

In 5.1.2 we report results of using GLIDE (Dhariwal & Nichol, 2021) as $G$, a
recently proposed diffusion model trained on a similar dataset as CLIP. We use
a small version of this model, trained with filtered data, since the weights
of the full model have not been released. In these experiments the model is
guided by representations obtained by a smaller CLIP model trained on this
same filtered dataset, with noise augmentations.

###  4.3 Datasets

For obtaining sketch style representations $\mathbf{s}_{j}$, we use sketches
of the sketchy dataset (Sangkloy et al., 2016), a collection of 75,471 sketch-
photo pairs sampled from 125 categories. When evaluating our framework we
sample 10k images from the sketchy dataset to determine $\mathbf{s}_{j}$,
excluding the class of the input sketch. Thus, all reported image translations
can be considered zero-shot outputs. In section 5.1.1 we report results of
using 2, 10, 100, 1k or 70k samples from the sketchy dataset for determining
$\mathbf{s}_{j}$. For obtaining target style $\mathbf{s}_{t}$ we use 10k
randomly sampled items of ImageNet (Deng et al., 2009), unless specified
otherwise.

##  5 Results

Figure 3 shows sketch-to-image results $\mathbf{X}_{t}$ for several random
source images $\mathbf{X}_{i}$ and target styles $\mathbf{s}_{t}$ obtained
from ImageNet and several text prompts.

To better illustrate the effectiveness of our proposed solution, we show some
quick and dirty comparisons to state-of-the-art open domain sketch-to-image
synthesis by Xiang et al. (Xiang et al., 2021). In their work, Xiang et al.
report qualitative comparisons of their results with CycleGAN (Zhu et al.,
2017b), conditional CycleGAN, and EdgeGAN (Gao et al., 2020). We fed all
compared input sketches in their work to our proposed framework and added the
outputs to their comparison, see Figure 4. Entries not marked with a star are
conditioned on their respective class. Our framework shows competitive results
without making use of class information, and while being the only method
evaluated in a zero-shot fashion.

Figure 4: Sketch-to-image results of several methods, (a) CycleGAN (Zhu et
al., 2017b), (b) conditional CycleGAN, (c) EdgeGAN (Gao et al., 2020), (d)
Xiang et al. (Xiang et al., 2021) and ours. Class conditioned inputs are
marked without a star. Note that our framework does not make use of class
information, and is the only one that is evaluated in a zero-shot fashion.

###  5.1 Ablations

####  5.1.1 Varying Dataset Size for Obtaining $\mathbf{s}_{j}$

To shed light on the required dataset size we report results of varying the
amount of used samples (2, 10, 100, 1k, 70k) for calculating $\mathbf{s}_{j}$,
see Figure 5. Remarkably, 10 samples are enough to get decent results, and
after using more than 100 samples gains are minimal.

Figure 5: Zero-shot sketch-to-image results $\mathbf{X}_{t}$ for several
source images $\mathbf{X}_{i}$ with a varying amount of samples from the
sketchy dataset for determining $\mathbf{s_{j}}$ and 10k samples from ImageNet
for obtaining target style $\mathbf{s}_{t}$. From left to right: input sketch,
2, 10, 100, 1k and 70k.

####  5.1.2 Using GLIDE as ${G}$

In Figure 6 we show a handful of random results of employing GLIDE (Dhariwal &
Nichol, 2021) as $G$ instead of VQGAN (Esser et al., 2021). We tried guiding
GLIDE with different target styles $\mathbf{s}_{t}$, but this was not
effective. A possible reason for this could be the fact that representations
learned by the smaller, noised CLIP model used in GLIDE show less
compositionality and/or contain less information than the regular CLIP model
released by OpenAI.

Figure 6: Sketch-to-image results $\mathbf{X}_{t}$ using GLIDE as $G$ for
several source images $\mathbf{X}_{i}$

##  6 Conclusion

We show that simple arithmetic can be an effective tool for intuitively
editing language-image pretraining architectures’ learned representations, and
prove this to be a computationally cheap method for disentangling style and
content.

Our method applies this idea to achieve zero-shot instance-level sketch-to-
image synthesis competitive with state-of-the-art instance-level open-domain
sketch-to-image models, while only depending on pretrained off-the-shelf
architectures and a sketch dataset as small as 100 items.

Additionally, these results suggest that large language-image pretraining
architectures’ learned representations show a significant amount of
compositionality, similar to what is generally observed in word-embeddings
(Gittens et al., 2017; Allen & Hospedales, 2019).

## References

  * Abdal et al. (2019) Abdal, R., Qin, Y., and Wonka, P.  Image2stylegan: How to embed images into the stylegan latent space?  In _Proceedings of the IEEE/CVF International Conference on Computer Vision_ , pp. 4432–4441, 2019.
  * Allen & Hospedales (2019) Allen, C. and Hospedales, T.  Analogies Explained: Towards Understanding Word Embeddings.  _arXiv:1901.09813 [cs, stat]_ , May 2019.  URL http://arxiv.org/abs/1901.09813.  arXiv: 1901.09813.
  * Chen et al. (2020) Chen, S.-Y., Su, W., Gao, L., Xia, S., and Fu, H.  Deepfacedrawing: Deep generation of face images from sketches.  _ACM Transactions on Graphics (TOG)_ , 39(4):72–1, 2020.
  * Chen et al. (2009) Chen, T., Cheng, M.-M., Tan, P., Shamir, A., and Hu, S.-M.  Sketch2photo: Internet image montage.  _ACM transactions on graphics (TOG)_ , 28(5):1–10, 2009.
  * Chen et al. (2012) Chen, T., Tan, P., Ma, L.-Q., Cheng, M.-M., Shamir, A., and Hu, S.-M.  Poseshop: Human image database construction and personalized content synthesis.  _IEEE Transactions on Visualization and Computer Graphics_ , 19(5):824–837, 2012.
  * Chen & Hays (2018) Chen, W. and Hays, J.  SketchyGAN: Towards Diverse and Realistic Sketch to Image Synthesis.  In _2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition_ , pp. 9416–9425, Salt Lake City, UT, June 2018. IEEE.  ISBN 978-1-5386-6420-9.  doi: 10.1109/CVPR.2018.00981.  URL https://ieeexplore.ieee.org/document/8579079/.
  * De Vries et al. (2017) De Vries, H., Strub, F., Mary, J., Larochelle, H., Pietquin, O., and Courville, A.  Modulating early visual processing by language.  _arXiv preprint arXiv:1707.00683_ , 2017.
  * Deng et al. (2009) Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L.  Imagenet: A large-scale hierarchical image database.  In _2009 IEEE conference on computer vision and pattern recognition_ , pp. 248–255. Ieee, 2009.
  * Dhariwal & Nichol (2021) Dhariwal, P. and Nichol, A.  Diffusion models beat gans on image synthesis.  _arXiv preprint arXiv:2105.05233_ , 2021.
  * Eitz et al. (2011) Eitz, M., Richter, R., Hildebrand, K., Boubekeur, T., and Alexa, M.  Photosketcher: interactive sketch-based image synthesis.  _IEEE Computer Graphics and Applications_ , 31(6):56–66, 2011.
  * Esser et al. (2021) Esser, P., Rombach, R., and Ommer, B.  Taming transformers for high-resolution image synthesis.  In _Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition_ , pp. 12873–12883, 2021.
  * Gao et al. (2020) Gao, C., Liu, Q., Xu, Q., Wang, L., Liu, J., and Zou, C.  SketchyCOCO: Image Generation from Freehand Scene Sketches.  _arXiv:2003.02683 [cs]_ , April 2020.  URL http://arxiv.org/abs/2003.02683.  arXiv: 2003.02683.
  * Gittens et al. (2017) Gittens, A., Achlioptas, D., and Mahoney, M. W.  Skip Gram: Zipf plus Uniform equals Vector Additivity.  In _Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pp. 69–76, Vancouver, Canada, July 2017. Association for Computational Linguistics.  doi: 10.18653/v1/P17-1007.  URL https://aclanthology.org/P17-1007.
  * Goodfellow et al. (2014) Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y.  Generative adversarial nets.  _Advances in neural information processing systems_ , 27, 2014.
  * Härkönen et al. (2020) Härkönen, E., Hertzmann, A., Lehtinen, J., and Paris, S.  Ganspace: Discovering interpretable gan controls.  _arXiv preprint arXiv:2004.02546_ , 2020.
  * Huang et al. (2021) Huang, X., Mallya, A., Wang, T.-C., and Liu, M.-Y.  Multimodal Conditional Image Synthesis with Product-of-Experts GANs.  _arXiv:2112.05130 [cs]_ , December 2021.  URL http://arxiv.org/abs/2112.05130.  arXiv: 2112.05130.
  * Karras et al. (2020) Karras, T., Laine, S., Aittala, M., Hellsten, J., Lehtinen, J., and Aila, T.  Analyzing and improving the image quality of stylegan.  In _Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition_ , pp. 8110–8119, 2020.
  * Li et al. (2019) Li, Y., Chen, X., Wu, F., and Zha, Z.-J.  Linestofacephoto: Face photo generation from lines with conditional self-attention generative adversarial networks.  In _Proceedings of the 27th ACM International Conference on Multimedia_ , pp. 2323–2331, 2019.
  * Liu et al. (2020) Liu, R., Yu, Q., and Yu, S.  Unsupervised Sketch-to-Photo Synthesis.  _arXiv:1909.08313 [cs]_ , March 2020.  URL http://arxiv.org/abs/1909.08313.  arXiv: 1909.08313.
  * Liu et al. (2021) Liu, X., Gong, C., Wu, L., Zhang, S., Su, H., and Liu, Q.  FuseDream: Training-Free Text-to-Image Generation with Improved CLIP+GAN Space Optimization.  _arXiv:2112.01573 [cs]_ , December 2021.  URL http://arxiv.org/abs/2112.01573.  arXiv: 2112.01573.
  * Lu et al. (2019) Lu, J., Batra, D., Parikh, D., and Lee, S.  Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks.  _arXiv preprint arXiv:1908.02265_ , 2019.
  * Lu et al. (2018) Lu, Y., Wu, S., Tai, Y.-W., and Tang, C.-K.  Image Generation from Sketch Constraint Using Contextual GAN.  In Ferrari, V., Hebert, M., Sminchisescu, C., and Weiss, Y. (eds.), _Computer Vision – ECCV 2018_ , volume 11220, pp. 213–228. Springer International Publishing, Cham, 2018.  ISBN 978-3-030-01269-4 978-3-030-01270-0.  doi: 10.1007/978-3-030-01270-0˙13.  URL http://link.springer.com/10.1007/978-3-030-01270-0_13.  Series Title: Lecture Notes in Computer Science.
  * Mirza & Osindero (2014) Mirza, M. and Osindero, S.  Conditional generative adversarial nets.  _arXiv preprint arXiv:1411.1784_ , 2014.
  * Miyato & Koyama (2018) Miyato, T. and Koyama, M.  cgans with projection discriminator.  _arXiv preprint arXiv:1802.05637_ , 2018.
  * Nichol et al. (2021) Nichol, A., Dhariwal, P., Ramesh, A., Shyam, P., Mishkin, P., McGrew, B., Sutskever, I., and Chen, M.  Glide: Towards photorealistic image generation and editing with text-guided diffusion models.  _arXiv preprint arXiv:2112.10741_ , 2021.
  * Radford et al. (2021) Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., Krueger, G., and Sutskever, I.  Learning Transferable Visual Models From Natural Language Supervision.  _arXiv:2103.00020 [cs]_ , February 2021.  URL http://arxiv.org/abs/2103.00020.  arXiv: 2103.00020.
  * Sangkloy et al. (2016) Sangkloy, P., Burnell, N., Ham, C., and Hays, J.  The sketchy database: learning to retrieve badly drawn bunnies.  _ACM Transactions on Graphics (TOG)_ , 35(4):1–12, 2016.
  * Santurkar et al. (2019) Santurkar, S., Tsipras, D., Tran, B., Ilyas, A., Engstrom, L., and Madry, A.  Image synthesis with a single (robust) classifier.  _arXiv preprint arXiv:1906.09453_ , 2019.
  * Stanley (2007) Stanley, K. O.  Compositional pattern producing networks: A novel abstraction of development.  _Genetic Programming and Evolvable Machines_ , 8(2):131–162, June 2007.  ISSN 1389-2576, 1573-7632.  doi: 10.1007/s10710-007-9028-8.  URL http://link.springer.com/10.1007/s10710-007-9028-8.
  * Sylvain et al. (2019) Sylvain, T., Petrini, L., and Hjelm, D.  Locality and compositionality in zero-shot learning.  _arXiv preprint arXiv:1912.12179_ , 2019.
  * Vaswani et al. (2017) Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I.  Attention Is All You Need.  _arXiv:1706.03762 [cs]_ , December 2017.  URL http://arxiv.org/abs/1706.03762.  arXiv: 1706.03762.
  * Xiang et al. (2021) Xiang, X., Liu, D., Yang, X., Zhu, Y., Shen, X., and Allebach, J. P.  Adversarial Open Domain Adaptation for Sketch-to-Photo Synthesis.  _arXiv:2104.05703 [cs]_ , December 2021.  URL http://arxiv.org/abs/2104.05703.  arXiv: 2104.05703.
  * Xu et al. (2018) Xu, T., Zhang, P., Huang, Q., Zhang, H., Gan, Z., Huang, X., and He, X.  Attngan: Fine-grained text to image generation with attentional generative adversarial networks.  In _Proceedings of the IEEE conference on computer vision and pattern recognition_ , pp. 1316–1324, 2018.
  * Zhu et al. (2017a) Zhu, J.-Y., Park, T., Isola, P., and Efros, A. A.  Unpaired image-to-image translation using cycle-consistent adversarial networks.  In _Proceedings of the IEEE international conference on computer vision_ , pp. 2223–2232, 2017a.
  * Zhu et al. (2017b) Zhu, J.-Y., Park, T., Isola, P., and Efros, A. A.  Unpaired Image-to-Image Translation Using Cycle-Consistent Adversarial Networks.  In _2017 IEEE International Conference on Computer Vision (ICCV)_ , pp. 2242–2251, Venice, October 2017b. IEEE.  ISBN 978-1-5386-1032-9.  doi: 10.1109/ICCV.2017.244.  URL http://ieeexplore.ieee.org/document/8237506/.


# The density of rational points on ${\mathbb{P}}^{1}$ with three stacky
points

Brett Nasserden  Department of Pure Mathematics
University of Waterloo<EMAIL_ADDRESS>and  Stanley Yao Xiao  Department
of Mathematics
University of Toronto
Bahen Centre
40 St. George Street, Room 6290
Toronto, Ontario, Canada
M5S 2E4<EMAIL_ADDRESS>
###### Abstract.

In this paper we consider the density of rational points on the “stacky" curve
$\mathfrak{X}({\mathbb{P}}^{1};0,2;1,2;\infty,2)$ which is ${\mathbb{P}}^{1}$
with three half points, with respect to the so-called Ellenberg-Satriano-
Zuerick-Brown height. In particular, we prove a conjecture of Ellenberg.

##  1\. Introduction

Two of the outstanding conjectures in number theory are the so-called Manin-
Batyrev conjecture [7] for the density of rational points on Fano varieties,
and Malle’s conjecture [11] on the number of number fields of bounded
discriminant having fixed degree and Galois group. Both conjectures assert,
roughly, that the objects to be counted satisfy an asymptotic formula of the
form

$C\cdot X^{\alpha}(\log X)^{\beta},$

where $C,\alpha,\beta$ are non-negative numbers with $C,\alpha>0$ which can be
computed explicitly within their respective conjectural frameworks.

In a forthcoming article J. Ellenberg, M. Satriano, and D. Zuerick-Brown
formulate a bold conjecture that has both the Manin and Malle conjetures as
special cases [5, Main Conjecture]. Their conjecture concerns counting
rational points with respect to a new theory of heights applying broadly to
_algebraic stacks_. While the Manin and Malle conjectures are well studied,
very little is known about the general conjecture.

In the framework of [5] the Malle and Manin conjectures represent two extremes
of their theory of heights. The Manin conjecture involves counting points on a
projective variety with respect to a Weil height and no theory of algebraic
stacks is required. On the other hand from the point of view of [5] the Malle
conjecture involves counting rational points on the classifying stack $BG$
where $G$ is a finite group. The theory of algebraic stacks is essential for
this interpretation of the Malle conjecture, and the standard theory of
heights on projective algebraic varieties is insufficient in this case.

In this article we consider instances of the main conjecture in [5] that lie
between the two extremes described above. In other words, we consider cases
that involve mixing the stacky and non-stacky phenomena. We formulate a new
theory of heights on a stacky analogue of smooth projective algebraic curves
and show that this stacky height is enough to determine the integral points on
these "stacky curves". We then consider a particular stacky curve suggested by
J. Ellenberg111”What?s up in arithmetic statistics?” Number Theory Web
Seminar, July 23, 2020 and show that our theory of heights matches [5] in this
instance. Finally, we verify a specific instance of the main conjecutre in [5]
given by Ellenberg11footnotemark: 1 using analytical methods.

Our point of view with algebraic stacks is to adopt a bottom up perspective.
In other words, to define our algebraic stacks in terms of a base variety
along with some extra data which is enough to construct a unique algebraic
stack. As we are interested in a well behaved family of stacky curves this
description will be particularly simple. The reason for this choice is that
although the heights we are concerned with are motivated by stacky phenomena,
the analysis of the heights we are interested in lie firmly within the purview
of analytic number theory and so a relatively simple exposition is preferable.
The bottom up point of view allows us to discuss the objects we are interested
in a concrete way that avoids technicalities and emphasizes the data most
important for our purposes. The interested reader may consult [8] for general
results involving the bottom up perspective on algebraic stacks and [16, Lemma
5.3.10] for the case of stacky curves.

We now describe the stacky curve we are most interested in. Those unfamiliar
with the theory of algebraic stacks may note the explicit form of our height
given in (1.1) and move on to the definition of an $M$-curve given by
Definition 1.1. Let
$\mathfrak{X}(\mathbb{P}^{1}_{\mathbb{Q}};0,2;1,2;\infty,2)$ be the algebraic
stack obtained by replacing $\\{0,1,\infty\\}\subseteq{{\mathbb{P}}^{1}}$ with
$B({\mathbb{Z}}/2{\mathbb{Z}})$. For a precise definition of this object, see
[8]. The points $0,1,\infty$ are "stacky points" which have an attached
stabilizer group $\mathbb{Z}/2\mathbb{Z}$ and account for
$\mathfrak{X}(\mathbb{P}^{1}_{\mathbb{Q}};0,2;1,2;\infty,2)$ not being a
projective variety. The other points behave like the points on the quasi-
projective variety ${\mathbb{P}}^{1}-\\{0,1,\infty\\}$. This construction is
an example of a "bottom-up" description of an algebraic stack; the algebraic
stack $\mathfrak{X}(\mathbb{P}^{1}_{\mathbb{Q}};0,2;1,2;\infty,2)$ is
constructed from the data of $\mathbb{P}^{1}_{\mathbb{Q}}$ and the points with
their associated multiplicities. In fact a large class of algebraic stacks can
be constructed in this way, see [8] for the details and for further references
and recent appearances of these objects see [16], [1], and [17].

One of the novelties of [5] is that _vector bundles_ have an associated
height, while in the classical setting a height is only associated to a line
bundle. Therefore to apply the theory of [5] one must choose a vector bundle
on $\mathfrak{X}$. We choose the tangent line bundle
$\mathbb{T}_{\mathfrak{X}}$. There is a birational mapping
$\pi\colon\mathfrak{X}\rightarrow{\mathbb{P}}^{1}$ called the _coarse space_
map. The height associated to the tangent bundle $\mathbb{T}_{\mathfrak{X}}$
described by [5] can be described in terms of the coarse space map as follows.
Given a point $P\in\mathfrak{X}(\mathbb{Q})$ we have the associated point
$\pi(P)=(a_{P}:b_{P})\in{\mathbb{P}}^{1}$. Now consider the height $H(a,b)$ on
primitive integer pairs $(a,b)$ by

(1.1)
$H(a,b)=\operatorname{sqf}(a)\operatorname{sqf}(b)\operatorname{sqf}(a+b)\max\\{|a|,|b|\\},$

with $\operatorname{sqf}(n)=n/k^{2}$, where $k^{2}$ is the largest square
dividing $n$. Then given $P\in\mathfrak{X}(\mathbb{Q})$ we define
$H_{\mathbb{T}_{\mathfrak{X}}}(P)=H(\pi(P))$ by choosing an integral
representation for $\pi(P)$.

Notice that the height (1.1) can be defined in terms of the coarse moduli
space ${\mathbb{P}}^{1}$ of
$\mathfrak{X}(\mathbb{P}^{1}_{\mathbb{Q}};0,2;1,2;\infty,2)$ and a formula
that takes into account the multiplicities in a simple way. Motivated by this
we now eschew the theory of algebraic stacks in favor of Darmon’s $M$-curves,
which is an essentially equivalent theory that emphasizes the bottom up
perspective to algebraic stacks. In other words, we keep track of the minimum
amount of data that can be used to construct the algebraic stack. One may
think of this as being analogous to only keeping track of a particular
Weierstrass equation of an elliptic curve.

######  Definition 1.1 ([4]).

Let $K$ be a number field. An $M$-curve over $K$ consists of the following
data:

  * •

A smooth projective curve $X$ defined over a number field $K$, and

  * •

For each $P\in X(K)$ a multiplicity $m_{P}\in\mathbb{Z}_{\geq
1}\cup\\{\infty\\}$ with $m_{P}=1$ for all but finitely many $P$.

We use the notation.

${\mathcal{X}}=(X;P_{1},m_{1};P_{2},m_{2};...;P_{r},m_{r})$

to denote the $M$-curve with multiplicities $m_{P_{i}}=m_{i}$ and if
$Q\notin\\{P_{1},...,P_{r}\\}$ then $m_{Q}=1$.

The $M$-curve we are most interested is given by
${\mathbb{P}}^{1}_{2,2,2}={\mathcal{X}}({\mathbb{P}}^{1}_{\mathbb{Q}};0,2;1,2;\infty,2)$
with the height on ${\mathbb{P}}^{1}$ given by (1.1). Our main goal is to
count rational points on ${\mathbb{P}}^{1}$ with respect to the height (1.1).
On writing

$a=x_{1}y_{1}^{2},b=x_{2}y_{2}^{2},x_{1},x_{2}\text{ square-free}$

We then have

$H(a,b)=x_{1}x_{2}\operatorname{sqf}(x_{1}y_{1}^{2}+x_{2}y_{2}^{2})\max\\{|x_{1}y_{1}^{2}|,|x_{2}y_{2}^{2}|\\}.$

and the max on the right hand side is dependent only on the relative size of
$|a|,|b|$. If we write

(1.2) $x_{1}y_{1}^{2}+x_{2}y_{2}^{2}=x_{3}y_{3}^{2},$

then we further obtain the expression

$H(a,b)=\max\\{|x_{2}x_{3}(x_{1}y_{1})^{2}|,|x_{1}x_{3}(x_{2}y_{2})^{2}|\\}.$

We may assume without loss of generality that
$|x_{1}y_{1}^{2}|\geq|x_{2}y_{2}|^{2}$ and $x_{1}>0$, so that

$H(a,b)=|x_{2}x_{3}(x_{1}y_{1})^{2}|.$

We put

(1.3) $N(T)=\\#\\{{\mathbf{x}},{\mathbf{y}}\in{\mathbb{Z}}_{\neq
0}^{3}:\gcd(x_{i},x_{j}),\gcd(y_{i},y_{j})=1\text{ for }i\neq j,x_{i}\text{
square-free for }i=1,2,3,$
$x_{1}y_{1}^{2}+x_{2}y_{2}^{2}=x_{3}y_{3}^{2},x_{1}>0,x_{1}y_{1}^{2}\geq|x_{2}y_{2}^{2}|,|(x_{1}y_{1})^{2}x_{2}x_{3}|\leq
T\\}$

Our first main result will be the following:

######  Theorem 1.2.

There exist positive numbers $c_{1},c_{2},c_{3}$ such that

$c_{1}T^{1/2}(\log T)^{3}<N(T)<c_{2}T^{1/2}(\log T)^{3}$

for all $T>c_{3}$.

In particular, we confirm Ellenberg’s conjecture11footnotemark: 1 that
$N(T)=O_{\varepsilon}\left(T^{1/2+\varepsilon}\right)$. Indeed, our theorem
gives an exact order of magnitude for $N(T)$.

We also propose a general height applicable to $M$-curves with finite
multiplicities (in particular to stacky curves in the sense of [16, Definition
5.2.1]) which matches (1.1) for our specific curve. Moreover, our height has
the remarkable feature that it naturally detects the difference between
_integral_ and _rational_ points on $M$-curves (here we are using Darmon’s
notion of integrality; see Definition 2.2)

######  Theorem 1.3.

For each $M$-curve ${\mathcal{X}}/{\mathbb{Q}}$ with finite multiplicities
there exists a height $H=H_{\mathcal{L}}H_{\mathcal{X}}$ with the property
that an element of $x\in{\mathcal{X}}(K)$ is integral if and only if
$H_{\mathcal{X}}(x)=1$. Moreover, for
${\mathcal{X}}={\mathcal{X}}({\mathbb{P}}^{1};0,2;-1,2;\infty,2)$ the height
$H_{\mathcal{L}}H_{{\mathcal{X}}}$ is equivalent to the height given by (1.1).

Theorem 1.3 is a consequence of the more technical Theorem 2.3.

We illustrate how Theorem 1.3 allows one to detect integral points on
$M$-curves. In this case the standard height is given by
$H_{s}(a,b)=\max\\{|a|,|b|\\}$ and the stacky height given by (1.1). They are
equal precisely when

$|\operatorname{sqf}(a)\operatorname{sqf}(b)\operatorname{sqf}(a+b)|=1,$

or in the notation of (1.2), that $|x_{1}|=|x_{2}|=|x_{3}|=1$. (1.2) then
turns into

$\pm y_{1}^{2}\pm y_{2}^{2}=\pm y_{3}^{2},$

and up to rearranging we are essentially counting points on the conic

(1.4) $y_{1}^{2}+y_{2}^{2}=y_{3}^{2}.$

Therefore if we denote by ${\mathcal{N}}(T)$ the number of integral points (in
the sense of Definition 2.2) on ${\mathbb{P}}_{2,2,2}^{1}$ then:

######  Corollary 1.4.

There exist positive numbers $c_{1},c_{2},c_{3}$ such that for all $T>c_{3}$
we have

$c_{1}T^{1/2}<{\mathcal{N}}(T)<c_{2}T^{1/2}.$

The proof is elementary, since the curve can be explicitly parametrized by

$y_{1}=u^{2}-v^{2},y_{2}=2uv,y_{3}=u^{2}+v^{2}.$

The condition $\max\\{|y_{1}|,|y_{2}\\}\leq T^{1/2}$ is subsumed by
$u^{2}+v^{2}\leq 4T^{1/2}$ say, so number of possible $u,v$’s is $\asymp
T^{1/2}$ as desired.

Theorem 1.2 and Corollary 1.4 imply that asymptotically $0$-percent of the
rational points on ${\mathbb{P}}_{2,2,2}^{1}({\mathbb{Q}})$ are integral, in
the sense of Darmon (Definition 2.2).

###  1.1. Organization of the paper

The proofs of Theorems 1.2 and 1.3 (Theorem 2.3) are essentially disjoint, and
are contained in Sections 2 and 3 respectively. The reader interested in one
but not the other can essentially read these sections independently of each
other.

We note that in the proof of Theorem 1.2 we shall require a counting result on
the number of diagonal ternary quadratic forms having bounded, square-free
discriminant given as Proposition 3.3. This may be of independent interest. We
further note that it is possible to refine the arguments given in Section 3 to
give an asymptotic formula in Proposition 3.3, but we do not pursue this in
the present paper.

### Notation

We denote by $d_{k}(n)$ for the number of ways of writing $n$ as a product of
$k$ (not necessarily distinct) positive integers, and write $d(n)=d_{2}(n)$
for the usual divisor function. We will also use the big-$O$ notation as well
as Landau’s notation. In particular, we will denote in the subscripts any
dependencies; if there are no subscripts, then the implied constants are
absolute.

##  2\. Heights on $M$-curves

We now define our height function on a $M$-curve ${\mathcal{X}}$. Before
continuing let us fix some notation. We assume that
${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r},m_{r})$ is an $M$-curve as in
Definition 1.1. We furthermore assume that $1<m_{P_{i}}<\infty$.

###  2.1. Translation between $M$-curves and stacky curves

Before moving on we explain the connection between stacky curves and
$M$-curves. Those uninterested may skip this section and safely work with
$M$-curves. Given a nice stacky curve $\mathfrak{X}$ over a number field $K$
there is a morphism $\pi\colon\mathfrak{X}\rightarrow X$ to a curve $X$ called
the coarse space morphism, which is the universal morphism from $\mathfrak{X}$
to a scheme. In practice one often constructs $\mathfrak{X}$ from $X$ by
specifying a collection of points $P_{1},...,P_{r}$ in the coarse space $X$
and attaching stabilizer groups $\mu_{P_{i}}$ to each $P_{i}$. This is the
bottom up approach of constructing an algebraic stack. One can think of this
as specifying the ramification data of the coarse space morphism
$\pi\colon\mathfrak{X}\rightarrow X$. We often think of these points as
"fractional points" because in divisor class group of the associated curve we
have added the point $\frac{1}{\\#\mu_{P_{i}}}P_{i}$. In other words, we think
of a stacky curve as a smooth curve $X$ with a choice of points
$P_{1},...,P_{r}$ with stabilizer groups $\mu_{P_{i}}$ attached to each
$P_{i}$. This data defines an $M$-curve
${\mathcal{X}}=(X;P_{1},\\#\mu_{P_{1}};...;P_{r},\\#\mu_{P_{r}})$. Conversely,
given an $M$-curve ${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r},m_{r})$ with each
$1<m_{P_{i}}<\infty$ we consider the stacky curve given with points $P_{i}$
having the stabilizer group $\mu_{m_{P_{i}}}$. In this way one may establish a
bijection between smooth proper geometrically connected Delign-Mumford stacks
of dimension 1 over $K$ with stacky points defined over $K$ that contain an
open dense subscheme and possess a projective coarse moduli space and
$M$-curves over $K$ with finite multiplicities.

###  2.2. Construction of heights

Notice that the height (1.1) is defined in terms of a function on
${\mathbb{P}}^{1}$. Since a stacky curve and its coarse space agree up to a
finite set of points and we are interested in counting points asymptotically
it suffices to count points on the coarse space with the height (1.1). With
this inspiration our goal is to take a stacky curve $\mathfrak{X}$ with coarse
space $X$ and construct the associated $M$-curve
${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r},m_{r})$. We then define a height on
the rational points of $X$ using the $M$-curve data with the purpose of
counting points with respect to this height.

Choose a finite set of primes $S$ of ${\mathcal{O}}_{K}$ containing all the
primes of bad reduction along with a smooth and proper model $\underline{X}$
of $X$ over ${\mathcal{O}}_{K,S}$. _Everything we do is relative to this
choice of model_ , similar to how everything we do is relative choosing the
finite set of primes $S$. We will use the following notion of _intersection
multiplicity_ from [4] to define integral points on $M$-curves and to define
our heights.

######  Definition 2.1 ([4]).

Let $P,Q$ be distinct points in $X(K)$ and place $\nu$ a place in $K$ with
$\nu\notin S$. Take $\mathfrak{p}_{\nu}\subset{\mathcal{O}}_{K}$ to be the
prime ideal associated to $\nu$. We define the intersection multiplicity of
$P$ and $Q$ at $\nu$ as follows.

$(P\cdot Q)_{\nu}:=\max\\{m:\textnormal{ the images of }P,Q\textnormal{ in
}\underline{X}({\mathcal{O}}_{K,S}/\mathfrak{p}_{\nu}^{m})\textnormal{ are
equal.}\\}$

where the maximum over the empty set is defined to be 0 above.

We wish to define a height function on the $M$-curve which takes into account
the local multiplicities. Motivated by the work of [5] our strategy will be to
define a height function that takes into account a global classical height on
the base curve $X$ and a local part that depends on the intersection
multiplicities. In the case relevant to us we recover (1.1).

Let us fix an $M$-curve ${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r};m_{r})$. To
avoid complications with the infinite places we shall assume that $S$ contains
all infinite places of $K$. Our height function will have a classical part
which only depends on the underlying curve $X$ and a stacky part that depends
on the points and multiplicities. To define the classical part of our height
we choose an ample line bundle ${\mathcal{L}}$ on $X$ and a multiplicative
ample height $H_{\mathcal{L}}$. Our strategy for the stacky contributions is
to take into account all of the primes that are not in $S$. Since our
intersection multiplicities depend on the choice of $S$ and model
$\underline{X}$, so will our heights. Let $P$ be a point of $X$. We define

(2.1)
$\lambda_{S,\underline{X},\nu}(P,t)=\lambda_{\nu}(P,t)=\textnormal{N}(\mathfrak{p}_{\nu})^{(t\cdot
P)_{\nu}}$

for $\nu\notin S$ and set

(2.2) $\lambda(P,t)=\prod_{\nu\notin S}\lambda_{\nu}(P,t).$

To take into account the multiplicities of points we only consider
$\lambda(P,t)$ up to $m_{P}$-powers. That is we look at the image
$\overline{\lambda(P,t)}\in{\mathbb{Q}}/{\mathbb{Q}}^{m_{P}}$ and consider
this to be the local contribution to the height. Precisely we define

(2.3) $H_{S,\underline{X}}(P,t)=H(P,t)=m_{P}\textnormal{-free
part}(\lambda(P,t))$

and $H(P,t)=1$ if $m_{P}=1$.

We now multiply the classical and stacky contributions to obtain our height
function. To sum up, given an $M$-curve
${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r},m_{r})$ and a choice of an ample
height $H_{\mathcal{L}}$ on $X$, a choice of primes $S$ and a model
$\underline{X}$ we define

(2.4)
$H_{{\mathcal{X}},S,\underline{X},{\mathcal{L}}}(t)=H_{\mathcal{L}}(t)\prod_{i=1}^{r}H_{S,\underline{X},}(P_{i},t)=H_{\mathcal{L}}(t)\prod_{i=1}^{r}m_{P_{i}}\textnormal{-free
part}(\lambda(P_{i},t))$

We call $H_{\mathcal{L}}(t)$ the _classical_ part and
$\prod_{i=1}^{r}H_{S,\underline{X},}(P_{i},t)$ the _stacky part_ of the height
$H_{{\mathcal{X}},S,\underline{X},{\mathcal{L}}}(t)$.

What is interesting is that our height, given by (2.3) below, allows us to
differentiate between _rational_ and _integral_ points on $M$-curves; this is
one of the main features of our height and thus provide additional support
that Ellenberg, Satriano, and Zuerick-Brown’s theory of heights on algebraic
stacks is an appropriate one. This is expanded in the subsection below.

###  2.3. Integral Points on $M$-Curves

Here we show that the the height (2.4) can be used to obtain information about
integral points on $\mathcal{X}$. In particular, the set of integral points is
contained in the set of points where (2.4) is equal to 1. When we take
$K={\mathbb{Q}}$ we see that this condition is sufficient. In other words the
$S$-integral points are those where the stacky part of the height is trivial.
Following Darmon [4] we have the following notion of integral points on an
$M$-curve:

######  Definition 2.2 (Darmon).

Let ${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r},m_{r})$ be a $M$-curve over a
number field $K$, $S$ a finite set of places of $K$ containing all primes of
bad reduction. Let $\underline{X}$ be a smooth proper model for $X$ over
${\mathcal{O}}_{K,S}$. The $(\underline{X},S)$-integral points of
${\mathcal{X}}$ (usually abbreviated to $S$-integral points of
${\mathcal{X}}$) are the points $t\in X(K)$ such that

(2.5) $(t\cdot P)_{\nu}\equiv 0\mod m_{P}$

for all $P\in X(K)$ and $\nu\notin S$.

We shall prove the following theorem:

######  Theorem 2.3.

Let ${\mathcal{X}}=(X;P_{1},m_{1};....;P_{r},m_{r})$ be an $M$-curve over $K$
satisfying our assumptions and choose $S$ and a model $\underline{X}$ as we
have specified. Then we have the following conclusions.

  1. (1)

${\mathcal{X}}({\mathcal{O}}_{K,S,\underline{X}})\subseteq\bigcap_{m_{P}>1}X(P;K)$

where ${\mathcal{X}}(P;K)=\\{t\in X(K)\colon H(P,t)=1\\}$.

  2. (2)

If $K={\mathbb{Q}}$ then

${\mathcal{X}}({\mathcal{O}}_{K,S,\underline{X}})=\bigcap_{m_{P}>1}X(P;K).$

In particular, the set of $S$-integral points of ${\mathcal{X}}$ is precisely
the set of points where $H(P,t)=1$ for all $P$ with $m_{P}>1$.

Fix a prime $\nu\notin S$ and write $(t\cdot
P)_{\nu}=m_{P}^{e_{\nu,P}(t)}\cdot q_{\nu,P}(t)$ where $e_{\nu,P}(t)\geq 0$
and $q_{\nu,P}(t)\geq 0$ is not divisible by $m_{P}$. In other words
$q_{\nu,P}(t)$ is the $m_{P}$-free part of $(t\cdot P)_{\nu}$. Set
$\textnormal{N}(\mathfrak{p}_{\nu})=p_{\nu}^{f(\nu)}$. Then

(2.6) $\lambda_{\nu}(P,t)=p_{\nu}^{f(\nu)(t\cdot
P)_{\nu}}=p_{\nu}^{m_{P}^{e_{\nu,P}(t)}\cdot q_{\nu,P}(t)\cdot f(\nu)}$

and

(2.7) $\lambda(P_{i},t)=\prod_{\nu\notin
S}p_{\nu}^{m_{P_{i}}^{e_{\nu,P_{i}}(t)}\cdot q_{\nu,P_{i}}(t)\cdot f(\nu)}$

Using the functions $\lambda(P,t)$ we can find subsets of the rational points
that contain all integral points.

######  Proposition 2.4.

Suppose that $m_{P}>1$. Define ${\mathcal{X}}(P;K)=\\{t\in X(K)\colon
H(P,t)=1\\}$. Then

${\mathcal{X}}({\mathcal{O}}_{K,S,\underline{X}})\subseteq{\mathcal{X}}(P;K).$

###### Proof.

Suppose that $t$ is an $S$-integral point. Then $(t\cdot P)_{\nu}\equiv 0\mod
m_{P}\Rightarrow e_{\nu,P}(t)>0$ for all $\nu\notin S$. Thus

$\lambda(P,t)=\prod_{\nu\notin S}p_{\nu}^{m_{P_{i}}^{e_{\nu,P_{i}}(t)}\cdot
q_{\nu,P_{i}}(t)\cdot f(\nu)}=\left(\prod_{v\notin
S}p_{\nu}^{m_{P_{i}}^{e_{\nu,P_{i}}(t)-1}\cdot q_{\nu,P_{i}}(t)\cdot
f(\nu)}\right)^{m_{P}},$

whence $H(P,t)=1$ as $\lambda(P,t)$ is an $m_{P}$-power. ∎

We see that each point $P$ with multiplicity $m_{P}>1$ imposes a height
dropping condition on the set of integral points. Thus to study integral
points it suffices to study

${\mathcal{X}}({\mathcal{O}}_{K,S,\underline{X}})\subseteq\bigcap_{m_{P}>1}X(P;K).$

There is the following easy consequence that may be useful if one has access
to the height $H_{{\mathcal{X}},S,\underline{X},{\mathcal{L}}}$ but perhaps
not the local factors.

######  Corollary 2.5.

Let $H_{\mathcal{L}}$ be an ample height with $H_{\mathcal{L}}(t)>0$ for all
$t\in X(K)$.Then

${\mathcal{X}}({\mathcal{O}}_{K,S})\subseteq\\{t\in X(K)\colon
H_{{\mathcal{X}},{\mathcal{L}}}(t)=H_{{\mathcal{L}}}(t)\\}.$

The integral points are contained in the locus where the height can be
computed classically, in other words where the stacky part of the height is
trivial. The difference in these sets can be potentially explained by
interactions between
$f(\nu)=[{\mathcal{O}}_{K}/\mathfrak{p}_{\nu}\colon{\mathbb{Z}}/p_{\nu}]$ and
the integers $m_{P}$ and the splitting of the primes $p_{\nu}$ in $K$.

###### Proof of Theorem 2.3.

We have already shown part $(1)$ of Theorem 2.3 in (2.4). We turn to part
$(2)$ and assume that $K={\mathbb{Q}}$. We know that that
$\bigcap_{m_{P}>1}X(P;{\mathbb{Q}})\subseteq{\mathcal{X}}({\mathcal{O}}_{{\mathbb{Q}},S,\underline{X}})$
by (2.4). We now show the reverse inclusion. Let $t\in X({\mathbb{Q}})$ with
$H(P,t)=1$ for all $P$ with $m_{P}>1$. Since $K={\mathbb{Q}}$ we have that
$\textnormal{N}(\mathfrak{p}_{\nu})=p_{\nu}$ and $f(\nu)=1$ for all finite
places $\nu$. Fix $P$ with $m_{P}>1$. Towards a contradiction suppose that
$(t\cdot P)_{\nu_{0}}\neq 0\mod m_{P}$ for some $\nu_{0}\notin S$. Then
$e_{\nu_{0},P}(t)=0$. Notice that $H(P,t)=1$ means that $\lambda(P,t)$ is an
$m_{P}$-power. Since if $\nu\neq\nu^{\prime}$ we have that $p_{\nu}\neq
p_{\nu^{\prime}}$ we have by unique factorization of integers that

$\lambda(P,t)=\prod_{\nu\notin S}p_{\nu}^{m_{P}^{e_{\nu,P}(t)}\cdot
q_{\nu,P}(t)}=(\prod_{\nu\notin S}p_{\nu}^{z_{\nu}(t)})^{m_{P}}$

for some integers $z_{\nu}(t)$. In particular for $\nu_{0}$ we have

$p_{\nu_{0}}^{m_{P}^{e_{\nu_{0},P}(t)}\cdot
q_{\nu_{0},P}(t)}=p_{\nu_{0}}^{{q_{\nu_{0},P}(t)}}=p_{\nu_{0}}^{z_{\nu_{0}}(t)m_{P}}$

Thus $z_{\nu_{0}}(t)m_{P}=q_{\nu_{0},P}(t)$ which contradicts
$q_{\nu_{0},P}(t)$ being indivisible by $m_{P}$. Thus for all $m_{P}>1$ and
$\nu\notin S$ we have $(t\cdot P)_{\nu}\equiv 0\mod m_{P}$ and $t$ is an
$S$-integral point of ${\mathcal{X}}$ by definition. ∎

In the next subsection we demonstrate our height in the simplest cases, where
the base curve is ${\mathbb{P}}^{1}$ and we have three points with
multiplicity exceeding one.

###  2.4. Main example - ${\mathbb{P}}^{1}$ with three points of large
multiplicity

Now we apply these definitions in the case relevant to the conjecture of [5].
Let $X={\mathbb{P}}^{1}_{\mathbb{Q}}$ and $S=\\{\nu_{\infty}\\}$ and take
${\mathcal{L}}$ to be ${\mathcal{O}}_{{\mathbb{P}}^{1}}(1)$ so the ample
height is the usual one. Now we define the $M$-curve

${\mathbb{P}}^{1}_{p,q,r}:=({\mathbb{P}}^{1}_{\mathbb{Q}};0,p;-1,q;\infty,r)$

where $-1$ is used instead of 1 to match the constructions in [5]. Let
$t=[a:b]\in{\mathbb{P}}^{1}({\mathbb{Q}})-\\{\infty\\}$ with $a,b$ coprime
integers. Then we have that

$(t\cdot 0)_{\nu}=\operatorname{ord}(a)_{\nu},\
(t\cdot(-1))_{\nu}=\operatorname{ord}_{\nu}(a+b),\
(t\cdot\infty)_{\nu}=\operatorname{ord}_{\nu}(b)$

for all finite primes $\nu$. The product formula gives in our specific case
gives that

$\lambda(0,t)=\mid a\mid,\lambda(-1,t)=\mid a+b\mid,\textnormal{ and,
}\lambda(\infty,t)=\mid b\mid.$

Now we consider our points up to $m_{P}$-powers. That is when $t=[a:b]$ with
$a,b$ non-zero coprime integers we consider the image

$\overline{\lambda(P,t)}\in{\mathbb{Q}}^{*}/({\mathbb{Q}}^{*})^{m_{P}}$

and consider this to be the local contribution to the height of $t$ at $P$.
The contribution of these local heights and the global height now gives for
$t=[a:b]$ with $a,b$ coprime and non-zero integers that

$\displaystyle H_{{\mathbb{P}}^{1}_{p,q,r}}([a:b])$
$\displaystyle=H_{{\mathbb{P}}^{1}_{p,q,r}}(0,[a:b])H_{{\mathbb{P}}^{1}_{p,q,r}}(-1,[a:b])H_{{\mathbb{P}}^{1}_{p,q,r}}(\infty,[a:b])H_{{\mathbb{P}}^{1}_{\mathbb{Q}}}([a:b])$
$\displaystyle=p\textnormal{-free part}(\mid a\mid)\cdot q\textnormal{-free
part}(\mid a+b\mid)\cdot r\textnormal{-free part}(\mid b\mid)\cdot\max(\mid
a\mid,\mid b\mid)$

Taking $p=q=r=2$ we obtain

$H_{{\mathbb{P}}^{1}_{2,2,2}}([a:b])=2\textnormal{-free part}(\mid a\mid)\cdot
2\textnormal{-free part}(\mid a+b\mid)\cdot 2\textnormal{-free part}(\mid
b\mid)\cdot\max(\mid a\mid,\mid b\mid)$

which is the desired height function of ([5]).

These discussions lead to the following question:

_How many points $[a:b]\in{\mathbb{P}}^{1}({\mathbb{Q}})$ satisfy_

$p\textnormal{-free part}(\mid a\mid)\cdot q\textnormal{-free part}(\mid
a+b\mid)\cdot r\textnormal{-free part}(\mid b\mid)\cdot\max(\mid a\mid,\mid
b\mid)\leq T?$

More generally:

_Let ${\mathcal{X}}=(X;P_{1},m_{1};...;P_{r},m_{r})$ be a $M$-curve over a
number field $K$, $S$ a finite set of places of $K$ containing the infinite
places and all primes of bad reduction. Let $\underline{X}$ be a smooth proper
model for $X$ over ${\mathcal{O}}_{K,S}$. Then how many points $t\in X(K)$
satisfy_

$H_{{\mathcal{X}},S,\underline{X},{\mathcal{L}}}(t)\leq T$

_Can one find an asymptotic formula for the number of such points?_

The rest of this article is dedicated to analyzing the case $p=q=r=2$; that
is, to the proof of Theorem 1.2.

##  3\. Counting rational points on
${\mathcal{X}}_{\mathbb{Q}}=({\mathbb{P}}_{\mathbb{Q}}^{1};0,2;-1,2;\infty,2)$

In this section, we prove Theorem 1.2. To do so we will show that
$N(T)=O\left(T^{1/2}(\log T)^{3}\right)$ and give a separate argument to show
that $N(T)\gg T^{1/2}(\log T)^{3}$. The incompatibility of these two arguments
represents the main obstacle as to why an asymptotic formula for $N(T)$
remains elusive.

We consider the problem of counting integral points on the variety defined by
(1.2), subject to the constraint

(3.1) $0<|x_{2}x_{3}(x_{1}y_{1})^{2}|\leq
T,|x_{1}y_{1}^{2}|\geq|x_{2}y_{2}^{2}|.$

To obtain the upper bound we must dissect (3.1) into suitable ranges. When
$|x_{1}x_{2}x_{3}|\leq T^{1/2}$ we fix $x_{1},x_{2},x_{3}$ and treat (1.2) as
a diagonal ternary quadratic form, say $Q_{\mathbf{x}}$. It is then the case
that

(3.2) $|y_{i}|\leq\frac{T}{|x_{1}x_{2}x_{3}|\cdot|x_{i}|}$

for $i=1,2,3$, and by Corollary 2 of [3] we then have the estimate

$O\left(d(x_{1}x_{2}x_{3})\left(\frac{T^{1/2}}{|x_{1}x_{2}x_{3}|}+O(1)\right)\right)$

for the number of ${\mathbf{y}}\in{\mathbb{Z}}_{\neq 0}^{3}$ satisfying (3.1)
and (1.2) provided that the quadratic form $Q_{\mathbf{x}}$ has a rational
zero. Otherwise it is clear that there will be no contribution. Thus we must
estimate

$\sum_{\begin{subarray}{c}1\leq|x_{1}x_{2}x_{3}|\leq T^{1/2}\\\
Q_{\mathbf{x}}\text{ has a rational zero}\end{subarray}}d(x_{1}x_{2}x_{3}).$

This is similar to the work of Guo in [9], except he counted with respect to
the height $\lVert{\mathbf{x}}\rVert_{\infty}$. Nevertheless the techniques
are similar, and again this may be of independent interest.

Next we must deal with the case when $|x_{1}x_{2}x_{3}|\geq T^{1/2}$. For this
it suffices to observe from (3.2) that $|x_{1}x_{2}x_{3}|\geq T^{1/2}$ implies

$|y_{1}y_{2}y_{3}|\leq\frac{T^{3/2}}{(x_{1}x_{2}x_{3})^{2}}\leq T^{1/2}.$

We then treat (1.2) as a linear form $L_{\mathbf{y}}$ in ${\mathbf{x}}$. We
use this to show that the contribution for each ${\mathbf{y}}$ is
$O\left(T^{1/2}|y_{1}y_{2}y_{3}|^{-1}+1\right)$, which gives an acceptable
contribution upon summing over ${\mathbf{y}}$.

For the lower bound, we first restrict $y_{1},y_{2},y_{3}\in{\mathbb{Z}}_{\neq
0}$ satisfying

$|y_{1}y_{2}y_{3}|\leq T^{\delta}$

for some explicit $\delta>0$ to be specified later. We note that to obtain the
correct order of magnitude it is permissible to choose any $\delta>0$.

Having fixed ${\mathbf{y}}=(y_{1},y_{2},y_{3})$, we consider the simultaneous
conditions (1.2) and (3.1). This gives rise to a binary form inequality of the
shape

(3.3) $|x_{1}^{2}x_{2}(y_{1}^{2}x_{1}+y_{2}^{2}x_{2})|\leq
Ty_{3}^{2}y_{1}^{-2}.$

Because $|y_{1}y_{2}y_{3}|$ is small, we can count the number of solutions
${\mathbf{x}}$ to this inequality with reasonable precision. However, even
with $|y_{1}y_{2}y_{3}|$ counting the number of solutions ${\mathbf{x}}$ with
enough uniformity appears to still be a challenging task, because the binary
form in (3.3) is singular. This difficulty is exacerbated by the fact that we
will need to apply a square-free sieve eventually to produce triples
${\mathbf{x}}$ with each coordinate square-free.

To get around this issue, we simply count solutions to (3.3) with
$x_{1},x_{2}$ satisfying the inequalities

$|x_{i}y_{i}^{2}|\leq c_{i}T^{1/4}|y_{1}y_{2}y_{3}|^{1/2},i=1,2$

for some positive numbers $c_{1},c_{2}$. This has the effect that the long
cusps inherent in (3.3) are removed, and reduces the problem to a more
straightforward geometry of numbers question.

###  3.1. Upper bounds

To obtain upper bounds, it is crucial to view (1.2) as a plane in
$x_{1},x_{2},x_{3}$ when $|y_{1}y_{2}y_{3}|\leq T^{1/2}$ and viewing (1.2) as
a conic in $y_{1},y_{2},y_{3})$ when $|x_{1}x_{2}x_{3}|\leq T^{1/2}$. We call
the former the _linear case_ and the latter the _quadratic case_. We proceed
to deal with the linear case below.

####  3.1.1. The linear case

In this subsection we shall suppose that $|y_{1}y_{2}y_{3}|\leq T^{1/2}$ is
fixed, and count the triples $(x_{1},x_{2},x_{3})$ and $(y_{1},y_{2},y_{3})$
for which (1.2) holds.

The key is the following lemma on counting points in sublattices of
${\mathbb{Z}}^{2}$:

######  Lemma 3.1.

Let $\Lambda\subset{\mathbb{Z}}^{2}$ be a lattice. Then for all positive real
numbers $R_{1},R_{2}$ the number of primitive integral points
${\mathbf{x}}\in\Lambda$ satisfying $|x_{i}|\leq R_{i},i=1,2$ is at most
$O\left(R_{1}R_{2}/\det(\Lambda)+1\right)$.

###### Proof.

If the rectangle $[-R_{1},R_{2}]\times[-R_{2},R_{2}]$ contains at least two
primitive vectors in $\Lambda$, say ${\mathbf{x}}_{1},{\mathbf{x}}_{2}$, then
since this rectangle is convex it contains the parallelogram with end points
$\pm{\mathbf{x}}_{1},\pm{\mathbf{x}}_{2}$. The area of this parallelogram is
at least as large as $\det\Lambda$, since the lattice spanned by
${\mathbf{x}}_{1},{\mathbf{x}}_{2}$ is a sublattice of $\Lambda$. It thus
follows that

$R_{1}R_{2}\gg\det\Lambda.$

Otherwise, the rectangle $[-R_{1},R_{1}]\times[-R_{2},R_{2}]$ contains at most
one primitive vector in $\Lambda$. This completes the proof. ∎

The strength of this lemma is that it gives a strong upper bound even in
lopsided boxes.

Given (1.2), it follows that there is at least one $i\in\\{2,3\\}$ such that

$|x_{i}y_{i}^{2}|/2\leq x_{1}y_{1}^{2}\leq 2|x_{i}y_{i}^{2}|,$

whence

$\frac{x_{1}y_{1}^{2}}{2y_{i}^{-2}}\leq|x_{i}|\leq\frac{2x_{1}y_{1}^{2}}{y_{i}^{2}}.$

Without loss of generality, we assume that this holds for $i=2$. Suppose that
$M_{1}\leq x_{1}<2M_{1}$. By (3.1), we have

$|x_{3}|\leq\frac{T}{|x_{2}x_{1}^{2}y_{1}^{2}|},$

whence

$\displaystyle|x_{3}|$ $\displaystyle\leq
T\cdot\frac{2y_{2}^{2}}{(x_{1}y_{1}^{2})(x_{1}^{2}y_{1}^{2})}$
$\displaystyle\leq\frac{2y_{2}^{2}T}{M_{1}^{3}y_{1}^{4}}$

Applying Lemma 3.1 to the lattice defined by the congruence
$y_{1}^{2}x_{1}-y_{3}^{2}x_{3}\equiv 0\pmod{y_{2}^{2}}$ which has determinant
equal to $y_{2}^{2}$, there are

$O\left(M_{1}\cdot\frac{Ty_{2}^{2}}{M_{1}^{3}y_{1}^{4}}\cdot\frac{1}{y_{2}^{2}}+1\right)=O\left(\frac{T}{M_{1}^{2}y_{1}^{4}}+1\right)$

possibilities for $x_{1},x_{3}$, which then determines
$x_{2}=(y_{1}^{2}x_{1}-y_{3}^{2}x_{3})/y_{2}^{2}$. Similarly, applying Lemma
3.1 to the lattice defined by $y_{1}^{2}x_{1}+y_{2}^{2}x_{2}\equiv
0\pmod{y_{3}^{2}}$, with determinant equal to $y_{3}^{2}$, gives the estimate

$O\left(M_{1}\cdot\frac{y_{1}^{2}M_{1}}{y_{2}^{2}}\frac{1}{y_{3}^{2}}+1\right)=O\left(\frac{M_{1}^{2}y_{1}^{2}}{y_{2}^{2}y_{3}^{2}}+1\right)$

for the number of $x_{1},x_{2}$, which then also determine $x_{3}$. The two
bounds coincide when

$M_{1}=\frac{T^{1/4}|y_{2}y_{3}|^{1/2}}{|y_{1}|^{3/2}},$

and we get the bound

$O\left(\frac{T^{1/2}|y_{2}y_{3}|y_{1}^{2}}{y_{2}^{2}y_{3}^{2}|y_{1}|^{3}}+1\right)=O\left(\frac{T^{1/2}}{|y_{1}y_{2}y_{3}|}+1\right)$

for the number of $x_{1},x_{2},x_{3}$ given $y_{1},y_{2},y_{3}$. Thus, we
obtain an acceptable estimate whenever $|y_{1}y_{2}y_{3}|\ll T^{1/2}$, since

$\displaystyle\sum_{1\leq|y_{1}y_{2}y_{3}|\leq
T^{1/2}}\frac{T^{1/2}}{|y_{1}y_{2}y_{3}|}+1$ $\displaystyle\ll
T^{1/2}\sum_{n\leq T^{1/2}}\frac{d_{3}(n)}{n}+\sum_{n\leq T^{1/2}}d_{3}(n)$

It is well-known that

$\sum_{n\leq Z}d_{3}(n)=Z(\log Z)^{2}+O(Z\log Z).$

By partial summation, we have

$\displaystyle\sum_{n\leq Z}\frac{d_{3}(n)}{n}$
$\displaystyle=Z^{-1}\sum_{n\leq Z}d_{3}(n)+\int_{1}^{Z}\left(\sum_{n\leq
t}d_{3}(n)\right)\frac{dt}{t^{2}}$ $\displaystyle\ll(\log
Z)^{2}+\int_{1}^{Z}\frac{(\log t)^{2}dt}{t}$ $\displaystyle\ll(\log Z)^{3}$

It follows that

$T^{1/2}\sum_{n\leq T^{1/2}}\frac{d_{3}(n)}{n}+\sum_{n\leq T^{1/2}}d_{3}(n)\ll
T^{1/2}(\log T)^{3}.$

####  3.1.2. The quadratic case

It remains to deal with the case when $|y_{1}y_{2}y_{3}|\gg T^{1/2}$, where we
instead fibre over ${\mathbf{x}}$ and consider zeroes of the corresponding
diagonal quadratic forms $Q_{\mathbf{x}}$. Since

$|x_{i}y_{i}^{2}|\ll x_{1}y_{1}^{2}$

for $i=1,2$ by assumption, it follows that

$|x_{1}x_{2}x_{3}y_{1}^{2}y_{2}^{2}y_{3}^{2}|\leq x_{1}^{3}y_{1}^{6},$

hence

$|y_{1}^{2}y_{2}^{2}y_{3}^{2}|\ll\frac{x_{1}^{3}y_{1}^{6}}{x_{1}|x_{2}x_{3}|}.$

If $|x_{1}x_{2}x_{3}|\gg T^{1/2}$, then

$x_{1}^{3}y_{1}^{6}\gg T^{3/2}\Leftrightarrow x_{1}y_{1}^{2}\gg T^{1/2}.$

This implies that

$|x_{1}x_{2}x_{3}|\cdot x_{1}y_{1}^{2}\gg T,$

which violates (3.1) if the implied constants are sufficiently large. It thus
follows that we must have $|x_{1}x_{2}x_{3}|\ll T^{1/2}$ in this case.

We now fix $x_{1},x_{2},x_{3}$ and consider (1.2) as a ternary quadratic form
in $y_{1},y_{2},y_{3}$. We shall require the following version of Corollary 2
in [3], which is an analogue of Lemma 3.1:

######  Lemma 3.2.

Let $x_{1},x_{2},x_{3}$ be pairwise co-prime square-free integers. Let
$R_{1},R_{2},R_{3}$ be positive real numbers. Then the number of primitive
solutions $y_{1},y_{2},y_{3}$ to the equation

$x_{1}y_{1}^{2}+x_{2}y_{2}^{2}=x_{3}y_{3}^{2}$

with $|y_{i}|\leq R_{i}$ is bounded by

$O\left(d(x_{1}x_{2}x_{3})\left(\left(\frac{R_{1}R_{2}R_{3}}{|x_{1}x_{2}x_{3}|}\right)^{1/3}+1\right)\right).$

Since $|x_{i}y_{i}^{2}|\ll x_{1}y_{1}^{2}$ for $i=1,2$, it follows that

$|x_{1}x_{2}x_{3}(x_{i}y_{i}^{2})|\ll|x_{1}x_{2}x_{3}(x_{1}y_{1}^{2})|\leq T$

for $i=1,2$, whence

$|(x_{1}y_{1})^{2}x_{2}x_{3}|,|(x_{2}y_{2})^{2}x_{1}x_{3}|,|(x_{3}y_{3})^{2}x_{1}x_{2}|\ll
T.$

This implies that

$(y_{1}y_{2}y_{3})^{2}(x_{1}x_{2}x_{3})^{4}\ll T^{3},$

hence

$|y_{1}y_{2}y_{3}|\ll\frac{T^{3/2}}{(x_{1}x_{2}x_{3})^{2}}.$

Lemma 3.2 then implies that for fixed $x_{1},x_{2},x_{3}$ the number of
primitive ${\mathbf{y}}=(y_{1},y_{2},y_{3})$ satisfying (1.2) is

$O\left(d(x_{1}x_{2}x_{3})\left(\frac{T^{1/2}}{|x_{1}x_{2}x_{3}|}+1\right)\right).$

We now sum over primitive ${\mathbf{x}}\in{\mathbb{Z}}^{3}$ satisfying
$|x_{1}x_{2}x_{3}|\ll T^{1/2}$, with the property that the quadratic form
$Q_{\mathbf{x}}$ given by (1.2) has a rational zero. By the Hasse-Minkowski
theorem, this is tantamount to the form
$Q_{\mathbf{x}}({\mathbf{y}})=x_{1}y_{1}^{2}+x_{2}y_{2}^{2}-x_{3}y_{3}^{2}$
being everywhere locally soluble. The estimation of this is interesting on its
own right and will be handled in a separate subsection.

###  3.2. Counting soluble ternary quadratic forms

In this section, we consider the set

${\mathcal{S}}=\\{(x_{1},x_{2},x_{3})\in{\mathbb{Z}}^{3}:x_{1},x_{2},x_{3}>0,\gcd(x_{1},x_{2})=\gcd(x_{1},x_{3})=\gcd(x_{2},x_{3})=1,$
$x_{i}\text{ square-free for
}i=1,2,3,x_{1}y_{1}^{2}+x_{2}y_{2}^{2}-x_{3}y_{3}^{2}\text{ is everywhere
locally soluble}\\}.$

By a well-known theorem of Legendre (see [9]) the indicator function for
${\mathcal{S}}$ is given by

(3.4)
$f_{\mathcal{S}}(x_{1},x_{2},x_{3})=\left(2^{-\omega(x_{1})}\sum_{a_{1}|x_{1}}\left(\frac{x_{2}x_{3}}{a_{1}}\right)\right)\left(2^{-\omega(x_{2})}\sum_{a_{2}|x_{2}}\left(\frac{x_{1}x_{3}}{a_{2}}\right)\right)\left(2^{-\omega(x_{3})}\sum_{a_{3}|x_{3}}\left(\frac{-x_{1}x_{2}}{a_{3}}\right)\right).$

We will now combine the ideas given in [9] and those in [6].

Put

$\displaystyle{\mathcal{S}}(X)$ $\displaystyle=\sum_{1\leq x_{1}x_{2}x_{3}\leq
X}\sum_{(x_{1},x_{2},x_{3})\in{\mathcal{S}}}\frac{d(x_{1}x_{2}x_{3})}{x_{1}x_{2}x_{3}}$
$\displaystyle=\sum_{1\leq|x_{1}x_{2}x_{3}|\leq
X}\frac{d(x_{1}x_{2}x_{3})}{x_{1}x_{2}x_{3}}f_{\mathcal{S}}(x_{1},x_{2},x_{3}).$

Since $x_{1},x_{2},x_{3}$ are pairwise coprime and square-free, it follows
that

$d(x_{1}x_{2}x_{3})=2^{\omega(x_{1}x_{2}x_{3})}=2^{\omega(x_{1})}\cdot
2^{\omega(x_{2})}\cdot 2^{\omega(x_{3})},$

where $\omega(n)$ is the number of distinct prime factors of $n$. It follows
that

(3.5) ${\mathcal{S}}(X)=\sum_{1\leq x_{1}x_{2}x_{3}\leq
X}\frac{2^{\omega(x_{1}x_{2}x_{3})}}{x_{1}x_{2}x_{3}}f_{\mathcal{S}}(x_{1},x_{2},x_{3})$
$=\sum_{1\leq x_{1}x_{2}x_{3}\leq
X}\frac{1}{x_{1}x_{2}x_{3}}\left(1+\left(\frac{x_{2}x_{3}}{x_{1}}\right)\left(\frac{x_{1}x_{3}}{x_{2}}\right)\left(\frac{-x_{1}x_{2}}{x_{3}}\right)+\sum_{g}g(x_{1},x_{2},x_{3})\right),$

where $g$ expresses a product of Jacobi symbols. The sum

(3.6) ${\mathcal{S}}_{1}(X)=\sum_{1\leq|x_{1}x_{2}x_{3}|\leq
X}\frac{1}{x_{1}x_{2}x_{3}}\left(1+\left(\frac{x_{2}x_{3}}{x_{1}}\right)\left(\frac{x_{1}x_{3}}{x_{2}}\right)\left(\frac{-x_{1}x_{2}}{x_{3}}\right)\right)$

is expected to contribute the main term while the sum

(3.7) ${\mathcal{S}}_{2}(x)=\sum_{1\leq x_{1}x_{2}x_{3}\leq
X}\frac{1}{x_{1}x_{2}x_{3}}\sum_{g}g(x_{1},x_{2},x_{3})$

is expected to be negligible, due to the cancellation of characters.

By partial summation, we obtain:

(3.8)
${\mathcal{S}}_{i}(X)=\frac{1}{X}\Sigma_{i}(X)+\int_{1}^{X}\Sigma_{i}(t)\frac{t}{t^{2}},$

where

$\Sigma_{1}(X)=\sum_{\begin{subarray}{c}1\leq|x_{1}x_{2}x_{3}|\leq X\\\
x_{1}x_{2}x_{3}\text{ square-free}\\\ Q_{(x_{1},x_{2},x_{3})}\text{ is
soluble}\end{subarray}}\left(1+\left(\frac{x_{2}x_{3}}{x_{1}}\right)\left(\frac{x_{1}x_{3}}{x_{2}}\right)\left(\frac{x_{1}x_{2}}{x_{3}}\right)\right)$

and

$\Sigma_{2}(X)=\sum_{1\leq x_{1}x_{2}x_{3}\leq
X}\sum_{g}g(x_{1},x_{2},x_{3}).$

Our situation differs from that of Guo in [9] since we are counting over
triples with $|x_{1}x_{2}x_{3}|\leq X$ rather than
$\max\\{|x_{1}|,|x_{2}|,|x_{3}|\\}\leq X$, which introduces some difficulties.
However, this is exactly analogous to the situation encountered by Fouvry and
Kluners in [6].

Our key proposition will be:

######  Proposition 3.3.

We have the asymptotic upper bound

${\mathcal{S}}(X)=O\left((\log X)^{3}\right).$

In fact we can refine Proposition 3.3 to give an asymptotic formula, but this
is unnecessary for our purposes.

We

We proceed to prove Proposition 3.3 in the remainder of the section. We begin
by showing that triples $(x_{1},x_{2},x_{3})$ with
$\mu^{2}(x_{1}x_{2}x_{3})=1$ and $\omega(x_{1}x_{2}x_{3})$ large contribute
negligibly. To wit, put

${\mathcal{S}}_{2}^{(r)}(X)=\sum_{\begin{subarray}{c}1\leq x_{1}x_{2}x_{3}\leq
X\\\
\omega(x_{1}x_{2}x_{3})=r\end{subarray}}\frac{1}{x_{1}x_{2}x_{3}}\sum_{g}g(x_{1},x_{2},x_{3}).$

By the triangle inequality, it is clear that

$\left\lvert{\mathcal{S}}_{2}^{(r)}(X)\right\rvert\ll\sum_{\begin{subarray}{c}n\leq
X\\\ \mu^{2}(n)=1,\omega(n)=r\end{subarray}}\frac{d_{3}(n)}{n}.$

By partial summation, we have

$\sum_{\begin{subarray}{c}n\leq X\\\
\mu^{2}(n)=1,\omega(n)=r\end{subarray}}\frac{d_{3}(n)}{n}=X^{-1}\sum_{\begin{subarray}{c}n\leq
X\\\
\mu^{2}(n)=1,\omega(n)=r\end{subarray}}d_{3}(n)+\int_{1}^{X}\left(\sum_{\begin{subarray}{c}n\leq
t\\\ \mu^{2}(n)=1,\omega(n)=r\end{subarray}}d_{3}(n)\right)\frac{dt}{t^{2}}.$

To estimate the latter sum, we will need the following result, which is Lemma
11 in [6]:

######  Lemma 3.4.

There exists an absolute constant $B_{0}\geq 1$ such that for every $r\geq 0$,
we have

$|\\{n\leq X:\omega(n)=r,\mu^{2}(n)=1\\}|\leq B_{0}\cdot\frac{X}{\log
X}\cdot\frac{(\log\log X+B_{0})^{r}}{r!}$

Applying the lemma, we have for $\Omega=30(\log\log X+B_{0})$

$\displaystyle\sum_{\begin{subarray}{c}n\leq X\\\
\mu^{2}(n)=1,\omega(n)\geq\Omega\end{subarray}}d_{3}(n)$
$\displaystyle\ll\frac{X}{\log X}\sum_{r\geq\Omega}3^{r}\cdot\frac{(\log\log
X+B_{0})^{r}}{r!}$ $\displaystyle\ll\frac{X}{\log
X}\sum_{r\geq\Omega}\left(\frac{3e(\log\log X+B_{0})}{r}\right)^{r}$
$\displaystyle\ll\frac{X}{\log
X}\sum_{r\geq\Omega}\left(\frac{3e}{10}\right)^{r},$

the final sum a convergent geometric series. Hence

$\sum_{r\geq\Omega}\left(\frac{3e}{10}\right)^{r}\ll\left(\frac{3e}{10}\right)^{\Omega}\ll\frac{1}{\log
X}.$

We thus conclude that

(3.9) $\displaystyle\sum_{r\geq\Omega}\left\lvert S_{2}^{(r)}(X)\right\rvert$
$\displaystyle\ll 1+(\log X)^{-2}+\int_{1}^{X}\frac{dt}{t(\log t)^{2}}$
$\displaystyle=O(1)$

and is thus negligible.

Note that $x_{1},x_{2},-x_{3}$ cannot all be the same sign, otherwise (1.2)
will only have a trivial real solution. Hence the signs of
$(x_{1},x_{2},x_{3})$ must be $(+,+,+)$, or $(+,-,+)$, since we assumed
$x_{1}>0$ and $x_{1}y_{1}^{2}\geq|x_{2}y_{2}^{2}|$. By rearranging, we must
thus assume $x_{1},x_{2},x_{3}>0$.

We then expand (3.7) by writing $x_{i}=x_{i1}x_{i2}$ for $i=1,2,3$, and

$\sum_{\begin{subarray}{c}1\leq x_{1}x_{2}x_{3}\leq X\\\
\mu^{2}(x_{1}x_{2}x_{3})=1\end{subarray}}\sum_{g}g(x_{1},x_{2},x_{3})=\sum_{\begin{subarray}{c}(x_{11}x_{12})(x_{21}x_{22})(x_{31}x_{32})\leq
X\\\ 1<x_{i1}<x_{i}\text{ for }1\leq i\leq
3\end{subarray}}\left(\frac{x_{21}x_{22}x_{31}x_{32}}{x_{11}}\right)\left(\frac{x_{11}x_{12}x_{31}x_{32}}{x_{21}}\right)\left(\frac{x_{11}x_{12}x_{21}x_{22}}{x_{31}}\right).$

We now follow the strategy outlined in [6] and break up the set

$\\{(x_{11},x_{12},x_{21},x_{22},x_{31},x_{32})\in{\mathbb{N}}^{6}:x_{11}x_{12}x_{21}x_{22}x_{31}x_{32}\leq
X\\}$

by restricting the $x_{ij}$’s to intervals of the form

$[A_{ij},\Delta A_{ij}),$

where

$\Delta=1+(\log X)^{-3}.$

For a given $\mathbf{A}=(A_{11},A_{12},A_{21},A_{22},A_{31},A_{32})$, put

${\mathcal{S}}_{2}(X;\mathbf{A})=\sum_{\begin{subarray}{c}x_{ij}\in[A_{ij},\Delta
A_{ij})\\\ \mu^{2}(x_{11}x_{12}x_{21}x_{22}x_{31}x_{32})=1\\\
\prod_{i,j}x_{ij}\leq
X\end{subarray}}\left(\frac{x_{21}x_{22}x_{31}x_{32}}{x_{11}}\right)\left(\frac{x_{11}x_{12}x_{31}x_{32}}{x_{21}}\right)\left(\frac{x_{11}x_{12}x_{21}x_{22}}{x_{31}}\right).$

We then have the following lemma:

######  Lemma 3.5.

We have the bound

$\sum_{\prod
A_{ij}\geq\Delta^{-6}X}\left\lvert{\mathcal{S}}_{2}(X;\mathbf{A})\right\rvert=O\left(X(\log
X)^{-1}\right).$

###### Proof.

We have

$\displaystyle\sum_{\prod
A_{ij}\geq\Delta^{-6}X}\left\lvert{\mathcal{S}}_{2}(X;\mathbf{A})\right\rvert$
$\displaystyle\leq\sum_{\begin{subarray}{c}\Delta^{-6}X\leq n\leq X\\\
\mu^{2}(n)=1\end{subarray}}d_{3}(n)$ $\displaystyle\ll\sum_{\Delta^{-6}X\leq
n\leq X}3^{\omega(n)}$ $\displaystyle\ll(1-\Delta^{-6})X(\log X)^{2}.$

By Taylor’s theorem, we have

$\Delta^{-6}=(1+(\log X)^{-3})^{-6}=1-6(\log X)^{-3}+O\left((\log
X)^{-6}\right).$

The proof then follows. ∎

To proceed, we shall require the following well-known lemma regarding
character sums:

######  Lemma 3.6 (Double Oscillation Lemma).

Let $\\{\alpha_{n}\\},\\{\beta_{m}\\}$ be two sequences of complex numbers
with each term having absolute value bounded by $1$. Let $M,N$ be positive
real numbers. Then we have

$\sum_{m\leq M}\sum_{n\leq
N}\alpha_{m}\beta_{n}\mu^{2}(2m)\mu^{2}(2n)\left(\frac{m}{n}\right)$
$\ll\min\left\\{\left(M^{-1/2}+(N/M)^{-1/2}\right),\left(N^{-1/2}+(M/N)^{-1/2}\right)\right\\}$

and for every $\varepsilon>0$,

$\sum_{m\leq M}\sum_{n\leq
N}\alpha_{m}\beta_{n}\mu^{2}(2m)\mu^{2}(2n)\ll_{\varepsilon}MN\left(M^{-1/2}+N^{-1/2}\right)(MN)^{\varepsilon}$

We will also need the following variant of the Siegel-Walfisz theorem:

######  Lemma 3.7.

Let $\chi_{q}$ be a primitive character modulo $q\geq 2$. Then for every $A>1$
we have

$\sum_{Y\leq p\leq X}\chi_{q}(p)=O_{A}\left(\sqrt{q}\cdot X(\log
X)^{-A}\right)$

uniformly for $X\geq Y\geq 2$.

We now consider, as in [6], the quantities

(3.10) $X^{\dagger}=(\log X)^{9},X^{\ddagger}=\exp\left((\log
X)^{1/8}\right).$

We now consider those $\mathbf{A}$ with the property that at most $2$ entries
larger than $X^{\ddagger}$. We dissect the sum according to the number $r\leq
2$ of terms $A_{ij}$ greater than $X^{\ddagger}$. Let $n$ be the product of
those $x_{ij}$ which are larger than $X^{\ddagger}$, and $m$ the product of
the remaining ones. We sum over $\mathbf{A}$ with such properties to obtain

$\displaystyle\sideset{}{{}^{(2)}}{\sum}_{\mathbf{A}}|{\mathcal{S}}_{2}(X;\mathbf{A})|$
$\displaystyle\leq\sum_{r\leq
2}\sum_{m\leq(X^{\ddagger})^{6-r}}\mu^{2}(m)d_{6-r}(m)\sum_{n\leq
X/m}\mu^{2}(n)d_{r}(n)$ $\displaystyle\ll\sum_{r\leq
2}\sum_{m\leq(X^{\ddagger})^{6-r}}\mu^{2}(m)d_{6-r}(m)\left(\frac{X}{m}\right)(\log
X)^{r-1}$ $\displaystyle\ll X\left(\sum_{r\leq 2}(\log
X)^{r-1}\right)\left(\sum_{m\leq(X^{\ddagger})^{6}}\frac{d_{6}(m)}{m}\right)$
$\displaystyle\ll X(\log X)\left(\log\exp\left((\log
X)^{1/8}\right)\right)^{7}$ $\displaystyle\ll X(\log X)^{15/8}.$

This is sufficiently small for our purposes.

We may now assume that $A_{ij}\geq X^{\ddagger}$ for at least three pairs
$i,j$ with $1\leq i\leq 3,1\leq j\leq 2$. We now suppose that there exist
$a\neq b$ such that

$A_{a,2},A_{b,1}\geq X^{\dagger}.$

The sum over $\mathbf{A}$ satisfying these properties can be bounded by

$\displaystyle\sum_{\mathbf{A}}\left\lvert{\mathcal{S}}_{2}(X;\mathbf{A})\right\rvert$
$\displaystyle\leq\sum_{x_{ij},(i,j)\neq(a,2),(b,1)}\prod_{(i,j)\neq(a,2),(b,1)}\left\lvert\sum_{x_{a,2}}\sum_{x_{b,1}}\alpha_{(a,2)}\beta_{(b,1)}\left(\frac{x_{a,2}}{x_{b,1}}\right)\right\rvert,$

where $\alpha,\beta$ have modulus at most one. Lemma 3.6 then applies, and
since our variables $x_{a,2},x_{b,1}$ range over intervals exceeding
$X^{\dagger}$ in length, it follows that

$|{\mathcal{S}}_{2}(X;\mathbf{A})|\ll\left(\prod_{(i,j)\neq(a,2),(b,1)}A_{ij}\left(A_{a,2}A_{b,1}\left(A_{a,2}^{-1/3}+A_{b,1}^{-1/3}\right)\right)\right)\ll
X(X^{\dagger})^{-1/3}=O\left(X(\log X)^{-3}\right),$

which is again enough.

Next consider the family where the two previous conditions do not hold, and in
addition there exist $a\neq b$ such that $2\leq A_{b,1}\leq X^{\dagger}$ and
$A_{a,2}>X^{\ddagger}$. Under these conditions, we see that

$|{\mathcal{S}}_{2}(X;\mathbf{A})|\ll\sum_{x_{ij},(i,j)\neq(a,2),(b,1)}\sum_{x_{a,2}}\left\lvert\sum_{x_{b,1}}\mu^{2}\left(\prod_{(i,j)\neq(a,2),(b,1)}x_{ij}\right)\left(\frac{x_{a,2}}{x_{b,1}}\right)\right\rvert,$

where $A_{ij}\leq x_{ij}\leq\Delta A_{ij}$ and $\omega(x_{ij})\leq\Omega$ for
$1\leq i\leq 3,1\leq j\leq 2$. Now put $\ell=\omega(x_{a,2})$, writing

$x_{a,2}=p_{1}\cdots p_{\ell}$

with $p_{1}<p_{2}<\cdots<p_{\ell}$ we obtain

$|{\mathcal{S}}_{2}(X;\mathbf{A})|\ll\sum_{\begin{subarray}{c}x_{ij}\\\
(i,j)\neq(a,2),(b,1)\end{subarray}}\sum_{x_{b,1}}\sum_{0\leq\ell\leq\Omega}\left\lvert\sum_{\omega(x_{a,2})=\ell}\mu^{2}\left(\prod_{i,j}x_{ij}\right)\left(\frac{x_{a,2}}{x_{b,1}}\right)\right\rvert,$

the inner sum being bounded by

$\sum_{p_{1}\cdots
p_{\ell-1}}\left\lvert\sum_{p_{\ell}}\left(\frac{p_{\ell}}{x_{b,1}}\right)\right\rvert$

and $p_{1},\cdots,p_{\ell}$ satisfy $A_{a,2}\leq p_{1}\cdots
p_{\ell}\leq\Delta A_{a,2}$. Note that

$p_{\ell}\geq A_{a,2}^{1/\ell}\geq\exp\left((\log X)^{1/9}\right).$

We may now apply Lemma 3.7 to obtain the bound

$\left\lvert\sum_{p_{\ell}}\left(\frac{p_{\ell}}{x_{b,1}}\right)\right\rvert\ll_{A}A_{b,1}^{1/2}\frac{A_{a,2}}{p_{1}\cdots
p_{\ell-1}}(\log X)^{-A/9}+\Omega,$

with $A$ arbitrarily large. Note that $p_{1}\cdots p_{\ell-1}\leq X$, hence

$\sum_{p_{1}\cdots p_{\ell-1}\leq X}(p_{1}\cdots
p_{\ell-1})^{-1}\ll\sum_{n\leq X}\frac{1}{n}\ll\log X.$

Hence

$\sideset{}{{}^{(3)}}{\sum}_{\mathbf{A}}|{\mathcal{S}}_{2}(X;\mathbf{A})|\ll
A_{b,1}^{1/2}\prod_{i,j}A_{ij}(\log X)^{-A/9+1}\ll X(\log X)^{-A/9+11/2}.$

Choosing $A$ large shows that this contribution is negligible.

The remaining case can be summarized by the following properties:

  1. (1)

$\prod_{i,j}A_{ij}\leq\Delta^{-6}X$;

  2. (2)

$A_{ij}\geq X^{\ddagger}$ for at least three pairs of indices $(i,j)$;

  3. (3)

If $A_{ij},A_{k\ell}\geq X^{\dagger}$ then $j=\ell$;

  4. (4)

If $A_{ij}\leq A_{k\ell}$ with $j\neq\ell$, then either $A_{ij}=1$ or $2\leq
A_{ij}\leq X^{\dagger}$ and $A_{k\ell}<X^{\ddagger}$.

We now show that the second option in (4) cannot happen. This will imply that
we have accounted for all possibilities for (3.7), and hence reduced our
problem to estimating ${\mathcal{S}}_{1}(X)$.

Suppose, without loss of generality, that $2\leq A_{11}\leq X^{\dagger}$ and
$A_{22}<X^{\ddagger}$. Since $A_{ij}\geq X^{\ddagger}$ for at least three
pairs of indices $(i,j)$, one of $A_{12}$ or $A_{32}$ must exceed
$X^{\ddagger}$. We then have $A_{11}\leq X^{\dagger}$ and $A_{32}$, say,
exceeds $X^{\ddagger}$, which means that our earlier estimation covers this
case.

The upshot now is that

(3.11) $\Sigma_{2}(X)\ll_{A}X(\log X)^{15/8}$

for some $\kappa(A)>0$. It follows from (3.8) that

$\displaystyle{\mathcal{S}}_{2}(X)$
$\displaystyle=X^{-1}\Sigma_{2}(X)+\int_{1}^{X}\Sigma_{2}(t)\frac{dt}{t^{2}}$
$\displaystyle\ll(\log X)^{15/8}+\int_{1}^{X}\frac{(\log t)^{15/8}dt}{t}$
$\displaystyle=(\log X)^{23/8},$

which is sufficiently small for our purposes.

Finally, we may evaluate the main term, which is given by (3.6). By the
triangle inequality, we have

${\mathcal{S}}_{1}(X)\ll\sum_{x_{1}x_{2}x_{3}\leq
X}\frac{1}{x_{1}x_{2}x_{3}}=\sum_{n\leq X}\frac{d_{3}(n)}{n}$

which is $O((\log X)^{3})$. This completes the proof of the Proposition.

###  3.3. Lower bounds

For the lower bound, we shall assume

$1\leq|y_{1}y_{2}y_{3}|\leq T^{\delta}$

where $\delta$ is some explicit positive number which we shall specify later.
We then consider $x_{1},x_{2}$ satisfying

(3.12) $|x_{i}y_{i}^{2}|\leq c_{i}T^{1/4}|y_{1}y_{2}y_{3}|^{1/2},i=1,2$

where $c_{1},c_{2}$ are two small positive numbers. Note that

$|x_{3}y_{3}^{2}|=|x_{1}y_{1}^{2}+x_{2}y_{2}^{2}|\leq|x_{1}y_{1}^{2}|+|x_{2}y_{2}^{2}|\leq(c_{1}+c_{2})T^{1/4}|y_{1}y_{2}y_{3}|^{1/2},$

whence

$|x_{1}x_{2}x_{3}|(y_{1}y_{2}y_{3})^{2}\leq
c_{3}T^{3/4}|y_{1}y_{2}y_{3}|^{3/2}$

where $c_{3}=c_{1}c_{2}(c_{1}+c_{2})$. Thus

$|(x_{1}y_{1}^{2})x_{1}x_{2}x_{3}|\leq(c_{1}T^{1/4}|y_{1}y_{2}y_{3}|^{1/2})(c_{3}T^{3/4}|y_{1}y_{2}y_{3}|^{-1/2})$

which is less than $T$ provided that $c_{1}c_{3}\leq 1$. Therefore every pair
$(x_{1},x_{2})$ satisfying (3.12) with $x_{1},x_{2}$ both square-free and
$x_{3}=(y_{1}^{2}x_{1}+y_{2}^{2}x_{2})y_{3}^{-2}\in{\mathbb{Z}}$ square-free
will contribute to $N(T)$.

We now count pairs $(x_{1},x_{2})$ such that

  1. (1)

$(x_{1},x_{2})$ satisfies (3.12);

  2. (2)

$\gcd(x_{1},x_{2})=1$;

  3. (3)

$x_{1},x_{2}$ are square-free; and

  4. (4)

$y_{1}^{2}x_{1}+y_{2}^{2}x_{2}\equiv 0\pmod{y_{3}^{2}}$,
$(y_{1}^{2}x_{1}+y_{2}^{2}x_{2})y_{3}^{-2}$ is square-free.

For each prime $p$, we interpret conditions (2) to (4) modulo $p^{2}$.
Condition (2) is the assertion that $p|x_{1}\Rightarrow p\nmid x_{2}$,
Condition (3) is the assertion that for all primes $p$ we have $p^{2}\nmid
x_{1},x_{2}$, and Condition (4) is stating
$y_{3}^{2}|y_{1}^{2}x_{1}+y_{2}^{2}x_{2}$, and if $p^{s}||y_{3}$, then
$p^{2s+2}\nmid y_{1}^{2}x_{1}+y_{2}^{2}x_{2}$. Let

$\rho_{\mathbf{y}}(m)=\\#\\{(x_{1},x_{2})\pmod{m}:(2)\text{ to }(4)\text{
holds for all }p|m\\}.$

It is apparent that $\rho_{\mathbf{y}}(\cdot)$ is multiplicative. Put

$N^{\ast}({\mathbf{y}};T)=\\#\\{(x_{1},x_{2})\in{\mathbb{Z}}^{2}:(1)\text{ to
}(4)\text{ hold}\\}$

and

$N_{b}^{\ast}({\mathbf{y}};T)=\\#\\{(x_{1},x_{2})\in{\mathbb{Z}}^{2}:(\ref{box
bd})\text{ holds, }(2)\text{ to }(4)\text{ holds mod }b\\}$

By standard arguments, we have

$N^{\ast}({\mathbf{y}};T)=\prod_{p\leq
Y}\left(1-\frac{\rho_{\mathbf{y}}(p^{2k})}{p^{2k}}\right)\frac{T^{1/2}}{|y_{1}y_{2}y_{3}|}+O\left(\sum_{Y<p<T^{1/8}|y_{1}y_{2}y_{3}|^{1/4}\max\\{|y_{1}|^{-1},|y_{2}|^{-1}\\}}\left(\frac{T^{1/2}}{p^{2}|y_{1}y_{2}y_{3}|}+1\right)\right),$

the error term being bounded by

$O\left(\frac{T^{1/2}}{Y|y_{1}y_{2}y_{3}|}+\frac{T^{1/8}|y_{1}y_{2}y_{3}|^{1/2}}{\min\\{|y_{1}|,|y_{2}|\\}}\right).$

Since $|y_{1}y_{2}y_{3}|\leq T^{\delta}$, we obtain an acceptable error term
provided that $\delta<1/4$. This shows that

$N(T)\gg\sum_{1\leq|y_{1}y_{2}y_{3}|\leq
T^{\delta}}N^{\ast}({\mathbf{y}};T)\gg\sum_{1\leq|y_{1}y_{2}y_{3}|\leq
T^{\delta}}\frac{T^{1/2}}{|y_{1}y_{2}y_{3}|}.$

Since

$\sum_{1\leq|y_{1}y_{2}y_{3}|\leq Z}|y_{1}y_{2}y_{3}|^{-1}\gg\sum_{n\leq
Z}d_{3}(n)n^{-1}\gg(\log Z)^{3},$

this confirms the lower bound.

## Appendix: Prolegomena to a theory of heights on algebraic stacks

In this section we give a hint of the flavor of heights on algebraic stacks,
leaving the details to the forthcoming ([5]). Our purpose here is to highlight
the difficulties faced when attempting to define heights on algebraic stacks,
while instilling a sense of excitement about the future possibilities of this
theory.

In order to recognize recognize the Manin and Malle conjectures in a unified
theoretical framework, ([5]) developed a theory of heights on algebraic
stacks. We now explain why such a theory naturally arises when trying to unify
Manin and Malle. In Manin’s conjecture one counts points using the anti-
canonical height, therefore Manin’s conjecture is intimately related to the
theory of heights on projective varieties. We take the theory of heights as
our starting point and naively attempt to use this approach for the Malle
conjecture. To approach Malle’s conjecture in a similar manner one might
attempt to endow the collection of $G$-extensions of a number field $K$ with
the structure of an algebraic variety, and then count points on this variety
using the height machine. Concretely one way to realize this approach would be
as follows.

  1. (1)

Construct a projective variety $\mathcal{X}_{G}$ such that the $K$-rational
points $\mathcal{X}_{G}(K)$ correspond bijectively to extensions of $K$ with
Galois group $G$.

  2. (2)

Find a good height function $h_{\mathcal{X}_{G}}$ on $\mathcal{X}_{G}$ that
relates the height of a point $P\in\mathcal{X}_{G}(K)$ to the discriminant of
the Galois extension associated to $P$.

  3. (3)

Use the theory heights and the geometry of $\mathcal{X}_{G}$ to count points
on $\mathcal{X}_{G}(K)$ and thus count $G$-extensions of $K$.

One runs into problems immediately because the set of $G$ extensions of a
number field $K$ cannot naturally be realized as the set of points of a
scheme. Indeed if a collection of objects can be _naturally_ realized as the
set of points of a scheme, then the objects in question must have no non-
trivial automorphisms. On the other hand, $G$-extensions of $K$ _always_ have
non-trivial automorphisms given by the Galois group $G$. As is well known at
this point, an appropriate setting for moduli problems with automorphisms is
given by the theory of algebraic stacks introduced by Deligne and Mumford in
their foundational study of the moduli space of curves. An important basic
example of an algebraic stack is the classifying stack $BG$ of a finite group
$G$. As the name suggests the classifying stack is a moduli space, whose
points correspond to $G$-torsors. When $K$ is a number field the $K$-points of
$BG$ correspond to $G$-torsors over $K$ which are precisely the Galois
extensions of $K$ with Galois group $G$. Thus the theory of algebraic stacks
provides a moduli space $BG$ whose points correspond to the arithmetic objects
of interest, namely $G$-extensions of $K$, achieving the first task in the
outline above.

A more serious problem arises in the second point. Let
$G=\mathbb{Z}/2\mathbb{Z}$ and consider the classifying stack
$B({\mathbb{Z}}/2{\mathbb{Z}})$. A theory of heights parallel to that of
schemes would suggest that a height function on
$B({\mathbb{Z}}/2{\mathbb{Z}})$ should correspond to a line bundle on
$\mathcal{L}$ on $B({\mathbb{Z}}/2{\mathbb{Z}})$. In general a vector bundle
of rank $r$ on $BG$ corresponds to an $r$-dimensional representation of $G$.
Taking $r=1$ we see that $B({\mathbb{Z}}/2{\mathbb{Z}})$ has line bundles
corresponding to the characters of the group ${\mathbb{Z}}/2{\mathbb{Z}}$.
There are precisely two characters of ${\mathbb{Z}}/2{\mathbb{Z}}$, the
trivial character $\textnormal{triv}(\epsilon)=1$ for
$\epsilon\in{\mathbb{Z}}/2{\mathbb{Z}}$ corresponding to the trivial line
bundle and the sign representation
$\textnormal{sgn}(\epsilon)=\textnormal{sgn}(\epsilon)$ where
$\epsilon\in{\mathbb{Z}}/2{\mathbb{Z}}$ is considered as an element of the
permutation group $S_{2}$. Thus we expect that up to bounded functions that
there are two height functions on $B({\mathbb{Z}}/2{\mathbb{Z}})$. The height
$h_{\textnormal{sgn}}$ associated the sign representation and the height
function $h_{\textnormal{triv}}$ associated to the trivial line bundle. The
functoriality property of the height machine tells us that for any line bundle
${\mathcal{L}}$ we should expect that $h_{{\mathcal{L}}^{\otimes
n}}=nh_{{\mathcal{L}}}+O(1)$. Taking ${\mathcal{L}}=\textnormal{triv}$ we see
that $\textnormal{triv}^{\otimes n}=\textnormal{triv}$ and so

$h_{\textnormal{triv}}=h_{\textnormal{triv}^{\otimes
n}}=nh_{\textnormal{triv}}+O(1)$

for all $n$. Thus $h_{\textnormal{triv}}$ must be a bounded function. On the
other hand as the tensor product of characters is the function given by taking
the product of the characters we have that
$\textnormal{sgn}\otimes\textnormal{sgn}=\textnormal{sgn}^{2}=\textnormal{triv}$
the trivial representation. Thus functoriality of heights suggests that we
should have an equality

$h_{\textnormal{triv}}=h_{\textnormal{sgn}\otimes\textnormal{sgn}}=2h_{\textnormal{sgn}}+O(1).$

Consequently $2h_{\textnormal{sgn}}$ would be the trivial height meaning that
$h_{\textnormal{triv}}$ would be some bounded function. Clearly this is not
satisfactory. For example, no Northcott property can be expected for any
height function as $B({\mathbb{Z}}/2{\mathbb{Z}})({\mathbb{Q}})$ corresponds
to quadratic extensions of ${\mathbb{Q}}$ of which there are infinitely many,
but the argument above suggests that the points of
$B({\mathbb{Z}}/2{\mathbb{Z}})$ is a set of bounded height.

Despite these obstacles, J. Ellenberg, M. Satriano, and D. Zuerick-Brown
realized that one may develop a theory of heights on algebraic stacks at the
cost of losing the functoriality properties of the height machine. Their
theory associates a height function $h_{\mathcal{E}}$ to each vector bundle
${\mathcal{E}}$ on an algebraic stack ${\mathcal{X}}$. If ${\mathcal{X}}$ is
taken to be a scheme then the associated height function is the classical
height $h_{\det{\mathcal{E}}}$ associated to the determinant line bundle
$\det{\mathcal{E}}$. Thus this new theory of heights recovers the classical
theory as a special case. Furthermore, given a suitable algebraic stack
${\mathcal{X}}$ and a vector bundle ${\mathcal{E}}$ on ${\mathcal{X}}$ such
that the associated height $h_{\mathcal{E}}$ satisfies a Northcott property
one has a conjecture ([5, Main Conjecture]) that predicts the asymptotic
behaviour of points of bounded height on ${\mathcal{X}}$ with respect to
$h_{\mathcal{E}}$. Given a Fano variety with an ample line bundle
${\mathcal{L}}$ ([5, Main Conjecture]) applied to $(X,h_{{\mathcal{L}}})$ is
the Manin conjecture, while ([5, Main Conjecture]) applied to
$(BG,h_{\textnormal{regular}})$ recovers the Malle conjecture. Here
$h_{\textnormal{regular}}$ is the height obtained from the vector bundle
associated to the regular representation of the finite group $G$.

To sum up, there is a theory of heights on algebraic stacks that is mostly
unexplored. Given an algebraic stack $\mathcal{X}$ and nice enough vector
bundle $\mathcal{E}$ on $\mathcal{X}$ there is a conjectur ([5, Conjecture]),
that describes the behavior of the pair $(\mathcal{X},\mathcal{E})$.
Furthermore, ([5, Main Conjecture]) specializes to the Manin and Malle
conjecture by choosing $\mathcal{X}$ and $\mathcal{E}$ appropriately. The full
conjecture is almost completely open, though in ([5]) some additional cases
will be considered.

## References

  * [1] M. Bhargava, B. Poonen, _The local-global principle for integral points on stacky curves_ , arXiv:2006.00167 [math.NT]
  * [2] T. D. Browning, _Quantitative Arithmetic of Projective Varieties_ , Progress in Mathematics 277, Birkhauser 2009.
  * [3] T. D. Browning, D. R. Heath-Brown, _Counting rational points on hypersurfaces_ , J. reine angew. Math. 584 (2005), 83-115.
  * [4] H. Darmon,_Faltings plus epsilon, Wiles plus epsilon, and the generalized Fermat equation_ , C. R. Math. Rep. Acad. Sci. Canada 97 (1997), 3-14.
  * [5] J. Ellenberg,M. Satriano,D. Zureick-Brown, _Forthcoming_.
  * [6] E. Fouvry, J. Kluners, _On the $4$-rank of class groups of quadratic number fields_, Invent. Math. 167 (2007), 455-513.
  * [7] J. Franke,Y. I. Manin, Y. Tschinkel _Rational points of bounded height on Fano varieties_ , Invent. Math. 95 (1989), 421–435.
  * [8] A. Geraschenko, M. Satriano, _A "bottom up" characterization of smooth Deligne-Mumford stacks_ , Int. Math. Res. Notices. IMRN, 21 (2017), 6469–6483
  * [9] C. R. Guo, _On solvability of ternary quadratic forms_ , Proc. of. Lond. Math. Soc (2) 70 (1995), 241-263.
  * [10] D. R. Heath-Brown, _The density of rational points on cubic surfaces_ , Acta. Arith. 79 (1997), 17-30.
  * [11] G. Malle, _On the Distribution of Galois Groups, II_ , Experiment. Math.,13 (2004),129-136.
  * [12] C. L. Stewart, _On the number of solutions of polynomial congruences and Thue equations_ , J. Amer. Math. Soc (4) 4 (1991), 793-835.
  * [13] C. L. Stewart, S. Y. Xiao, _On the representation of $k$-free integers by binary forms_, to appear in Revista Matem tica Iberoamericana.
  * [14] G. Tenebaum, _Introduction to Analytic and Probabilistic Number Theory_ , Cambridge University Press
  * [15] J. L. Thunder, _Decomposable form inequalities_ , Ann. of. Math (2) 153 (2001), 767-804.
  * [16] J. Voight, D. Zureick-Brown, _The canonical ring of a stacky curve_ , arxiv:1501.04657[math.AG].
  * [17] Stacks project authors, _The stacks project_ , https://stacks.math.columbia.edu/tag/04V3