# How many integer pairs satisfy the ellipse $x^2+ay^2=r?$

How many integer pairs satisfy the ellipse $x^2+ay^2=r?$

What I have discovered thus far:

This post is largely to document the thinking that I have already done... I know that this can be frowned upon in this community. BUT! This is not just a journal entry. I am asking about what happens for the $a>4$ case which I suspect is an open question.

Relevant OEIS: $a=1$,$a=2$, $a=3$,$a=4$. These links reference a text by Fine which I haven't yet seen. (But if someone who owns it wanted to confirm the formulae below... I wouldn't complain. I am confident about them but these are verified empirically and I haven't proven this explicitly but I hope that my formulas match up with: Page 78 of Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988;).

Let $\phi_a(r)$ be the number of solutions of $x^2+ay^2=r$.

Then for $a\in 1,2,3,4$ $$\phi_a(r)=2\sum_{d|r}\chi_a(d)$$

Where $\chi_{1}(x) = \cases{ \hspace{.14 in} 2 \hspace{1.86 in} \text{ when } x \cong 1 \text{ mod }4 \\ -2 \hspace{1.86 in} \text{ when }x\cong 3 \text{ mod }4 \\ \hspace{.14 in} 0 \hspace{1.86 in} \text{ when } 2|x }$

Where $\chi_{2}(x) = \cases{ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 1 \text{ mod }8 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x\cong 3 \text{ mod }8 \\ -1 \hspace{1.86 in} \text{ when } x \cong 5 \text{ mod }8 \\ -1 \hspace{1.86 in} \text{ when } x\cong 7 \text{ mod }8 \\ \hspace{.14 in} 0 \hspace{1.86 in} \text{ when } 2|x }$

Where $\chi_{3}(x) = \cases{ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 1 \text{ mod }12 \\ -1 \hspace{1.86 in} \text{ when } x\cong 2 \text{ mod }12 \\ \hspace{.14 in} 3 \hspace{1.86 in} \text{ when } x \cong 4 \text{ mod }12 \\ -1 \hspace{1.86 in} \text{ when } x\cong 5 \text{ mod }12 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 7 \text{ mod }12 \\ -3 \hspace{1.86 in} \text{ when } x\cong 8 \text{ mod }12 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 10 \text{ mod }12 \\ -1 \hspace{1.86 in} \text{ when } x\cong 11 \text{ mod }12 \\ \hspace{.14 in} 0 \hspace{1.86 in} \text{ when } 3|x }$

UPDATE: I also have found $\chi_4$ which is of a similar pattern.

Where $\chi_{4}(x)= \cases{ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 1 \text{ mod }16 \\ -1 \hspace{1.86 in} \text{ when } x \cong 2 \text{ mod } 16 \\ -1 \hspace{1.86 in} \text{ when } x \cong 3 \text{ mod } 16 \\ \hspace{.14 in} 2 \hspace{1.86 in} \text{ when } x \cong 4 \text{ mod } 16 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 5 \text{ mod }16 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 6 \text{ mod }16 \\ -1 \hspace{1.86 in} \text{ when } x \cong 7 \text{ mod }16 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 9 \text{ mod }16 \\ -1 \hspace{1.86 in} \text{ when } x \cong 10 \text{ mod }16 \\ -1 \hspace{1.86 in} \text{ when } x \cong 11 \text{ mod }16 \\ -2 \hspace{1.86 in} \text{ when } x \cong 12 \text{ mod }16 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 13 \text{ mod }16 \\ \hspace{.14 in} 1 \hspace{1.86 in} \text{ when } x \cong 14 \text{ mod }16 \\ -1 \hspace{1.86 in} \text{ when } x \cong 15 \text{ mod }16 \\ \hspace{.14 in} 0 \hspace{1.86 in} \text{ when } 8|x }$

Note that these functions have some odd symmetry to them in addition to being periodic:

$\chi_a(x)=\chi_a(x+4at)$

$\chi_a(2a+k)= -\chi_a(2a-k)$

Why I think this is cool!

It gets us explicit series of rationals for transcendental numbers like:

$\pi\sqrt{2}=4(1+\frac{1}{3}-\frac{1}{5}-\frac{1}{7}+\frac{1}{9}+\frac{1}{11}+\dots$.

I know this because $\sum_{r=1}^{R^2} {\phi_2(r)}$ should approximate the area inside $x^2+2y^2=R^2$.

Update 9/10/18:

Let's write $\psi(\vec{v},n)=\sum_{d|n}{\vec{v}(n)}$ where for a finite vector $\vec{v}$ we interpret $\vec{v}(n)$ as the $n$th position of $\vec{v}$ mod the length of $\vec{v}$. That is, if $\vec{v}=(v_1, v_2 \dots v_p)$ we define an infinite vector of period $p$. We let $\vec{v}(n)=v_n=v_{n+p}$ for all whole numbers $n$.

\begin{align} & \phi_{1}(n)= 2\psi\bigg((2,0,-2,0),n\bigg) \\ & \phi_{2}(n)= 2\psi\bigg((1,0,1,0,-1,0,-1,0),n\bigg)\\ &\phi_{3}(n)= 2\psi\bigg((1,-1,0,3,-1,0,1,-3,0,1,-1,0),n \bigg) \end{align}

I think this notation is superior to the many cases above. If we look at the OEIS links above we will find the length of vector seems to be communicated in a statement about how this relates to the Euler Transform. In the $a=3$ case, Michael Somos writes of an "Euler transform of period 12 sequence $[ 2, -3, 4, -1, 2, -6, 2, -1, 4, -3, 2, -2, ...]$" I suppose I will need to look into what this Euler Transform means... For now I will comment that the period of this sequence commented on matches the length of this vector for $a=1,2,3,4,7,$ and I would assume for $a=5$. I haven't worked out the details for $a=5$ but this is a sequence of period $60$.

Just as a note: This seems to be a property that may happen only when $x^2$ is accompanied with the coefficient $1$. I will let $\phi_{(2,3)}(n)$ denote the number of integer solutions to $2x^2+3y^2=n$ which can be found here. In this link we can find the same type of comment: "Euler transform of period 24 sequence $[0, 2, 2, -3, 0, -1, 0, -1, 2, 2, 0, -4, 0, 2, 2, -1, 0, -1, 0, -3, 2, 2, 0, -2, ...]$." However, there doesn't seem to exist any vector $\vec{w}$ of length $24$ such that $\phi_{(2,3)}(n)=\psi({\vec{w},n)$.

• A table of these values can be found at desmos.com/calculator/tp9sfwmqgy – Mason Jun 27 '18 at 21:25
• I think Kronecker Symbols must play a role. – Mason Jun 28 '18 at 7:52
• Also I didn't realize that Kronecker symbols are canonically written with $\chi$. That makes this notation somewhat unfortunate. – Mason Jun 28 '18 at 19:21
• Dirichlet's L-Function for prime q=3 mod 4 seems related to this question in general. en.wikipedia.org/wiki/Quadratic_residue – Mason Jul 14 '18 at 20:38
• This may be the better link: en.wikipedia.org/wiki/Quadratic_reciprocity – Mason Jul 14 '18 at 21:28

This isn't an answer so much as it is "moving the question." Let $\phi_a(n)$ be the number of integer solutions to $x^2+ay^2=n$.

Claim

$$\sum_{n=0}^\infty{\phi_a(n)}q^n = \theta_3(q)\theta_3(q^a)$$ This fact is cool but doesn't really get us much closer to knowing what $\phi_a(n)$ is... To prove this claim we will need to

1) Know the definitions of these theta functions. We will use

$$\theta_3(q) = \sum_{k = -\infty}^\infty{q^{k^2}}$$

2) Acknowledge that an absolutely convergent series will give the same result regardless of how it is traversed. For this proof we will traverse an infinite sum elliptically (How appropriate!).

Proof

So we have to write out the product of two double infinite series. This can be imagined as an infinite array. I will index this array with the Guassian integers.

$$\theta_3(q)\theta_3(q^a) = \sum_{x+yi\in \mathbb{Z}[i]}{q^{x^2+ay^2}}$$ But now we rearrange the sum so that we can "traverse" it. We need to make sure every point in this array is accounted for. We will then start at the center of the array and head outward.

$$\sum_{x+yi\in \mathbb{Z}[i]}{q^{x^2+ay^2}}=\sum_{n=0}^\infty\sum_{x^2+ay^2=n} q^{x^2+ay^2}=\sum_{n=0}^\infty\sum_{x^2+ay^2=n} q^{n}= \sum_{n=0}^\infty \phi_a(n)q^{n}$$

The first equality holds because each Guassian integer lies on some ellipse $x^2+ay^2=r$. The second equality is substitution. The third equality follows from the definition $\phi_a(n)$.

$\square$

Great! So what's $\phi_a(n)$? It seems like it might be tricky without a given $a$.

One more comment. By considering the area inside of the curve $x^2+ay^2=R^2$ we arrive at:

Comment $$\lim_{R\to\infty} R^{-2} \sum_{n=0}^{R^2} \phi_a(n) = \frac{\sqrt{a}}{a}\pi$$

Generalize To generalize the argument above. I haven't verified the claim below I am just leaving myself bread crumbs to follow up on.

Given $\bar{a}= (a_1 \dots a_m)$ we let $\phi_{\bar{a}}(n)$ denote the total number of integer solutions of $\sum{a_i x_i^2}=n$. Then $\sum\phi_{\bar{a}}(n)q^n=\prod{\theta_3{(q^{a_i})}}$.

• At least that it what it looks like when $a=1$ for the general case I am going to have to find the $n$th derivative of $h(x^a)$ which shouldn't be too awful but will need me to investigate: en.wikipedia.org/wiki/Fa%C3%A0_di_Bruno%27s_formula – Mason Jul 2 '18 at 3:08
• $\phi_j(n)$= a[ n_,j_] := SeriesCoefficient[ EllipticTheta[ 3, 0, q]*EllipticTheta[ 3, 0, q^j] , {q, 0, n}] – Mason Jul 2 '18 at 6:23
• Indeed they use Faa Di Bruno: arxiv.org/pdf/1105.6279.pdf – Mason Jul 4 '18 at 3:21
• I wrote out the a generalization to the argument above: math.stackexchange.com/questions/2837316/… – Mason Jul 8 '18 at 19:31