# How to find solutions of $x^2-3y^2=-2$?

According to MathWorld,

Pentagonal Triangular Number: A number which is simultaneously a pentagonal number $P_n$ and triangular number $T_m$. Such numbers exist when $$\frac{1}{2}n(3n-1)=\frac{1}{2}m(m+1).$$ Completing the square gives $$(6n-1)^2-3(2m+1)^2=-2.$$ Substituting $x=6n-1$ and $y=2m+1$ gives the Pell-like quadratic Diophantine equation $$x^2-3y^2=-2,$$ which has solutions $(x,y)=(5,3),(19,11),(71,41),(265,153), \ldots$.

However, it does not state how these solutions for $(x,y)$ were obtained.

I know that the solution $(5,3)$ can be obtained by observing that $1$ is both a pentagonal and a triangular number.

Does obtaining the other solutions simply involve trial-and-error? Or is there a way to obtain these solutions?

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} -1 \\ 1 \end{array} \right) \; = \; \left( \begin{array}{c} 1 \\ 1 \end{array} \right),$$

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} 1 \\ 1 \end{array} \right) \; = \; \left( \begin{array}{c} 5 \\ 3 \end{array} \right),$$

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} 5 \\ 3 \end{array} \right) \; = \; \left( \begin{array}{c} 19 \\ 11 \end{array} \right),$$

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} 19 \\ 11 \end{array} \right) \; = \; \left( \begin{array}{c} 71 \\ 41 \end{array} \right),$$

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} 71 \\ 41 \end{array} \right) \; = \; \left( \begin{array}{c} 265 \\ 153 \end{array} \right),$$

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} 265 \\ 153 \end{array} \right) \; = \; \left( \begin{array}{c} 989 \\ 571 \end{array} \right),$$

$$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right) \left( \begin{array}{c} 989 \\ 571 \end{array} \right) \; = \; \left( \begin{array}{c} 3691 \\ 2131 \end{array} \right),$$

EDIT, March 2016: From the stuff with the matrix above, we can use the Cayley-Hamilton theorem to give separate linear recurrences for $x$ and for $y.$ Just these: $$x_{k+2} = 4 x_{k+1} - x_k,$$ $$y_{k+2} = 4 y_{k+1} - y_k.$$ The $x$ sequence is $$1, 5, 19, 71, 265, 989, 3691, 13775, 51409, 191861, \ldots$$ while the $y$ sequence is $$1, 3, 11, 41, 153, 571, 2131, 7953, 29681, 110771, \ldots$$

Well. The theorem of Lagrange is that all values of the quadratic form (that are primitively represented) occur as output of the neighboring forms method, the same as doing continued fractions, if they are below $\frac{1}{2} \; \sqrt \Delta$ in absolute value, where in this case $\Delta = 12.$ So half the square root of that is $\sqrt 3,$ and $2$ is larger than this. This means that, while $-2$ is permitted to show up by the continued fraction method, it is possible that unexpected representations may occur. However, one may check with Conway's topograph method from The Sensual Quadratic Form and confirm that all appearances of $-2$ are along the "river" itself, meaning the simplest possible collection, as I illustrate with the matrix multiplications above. For your viewing pleasure, the topograph for $x^2 - 3 y^2,$ with a fair amount of detail:

=-=-=-=-=-=-=-=-=-=-=

=-=-=-=-=-=-=-=-=-=-=

Oh, well. The $-2$ at coordinates $(5,3)$ goes in the lower right open space, while the $-2$ at coordinates $(-5,3)$ goes in the lower left open space. If you think about it long enough, each edge in the infinite tree, including the little blue numbered arrow and the value on either side, is an indefinite quadratic form equivalent to $\langle 1,0,-3 \rangle,$ but is also an element in $PSL_2 \mathbb Z$ given by a little 2 by 2 matrix using the two column vectors in green.

Note that the automorph $$\left( \begin{array}{cc} 2 & 3 \\ 1 & 2 \end{array} \right)$$ is visible as a pair of column vectors corresponding once again to $\langle 1,0,-3 \rangle,$ as, indeed, it must.

• Where did you obtain the matrix $\begin{bmatrix} 2 & 3\\ 1 & 2 \end{bmatrix}$ and how come you started off the multiplication with the matrix $\begin{bmatrix} -1 \\ 1 \end{bmatrix}$? Feb 4, 2015 at 16:29
• @user130018, that matrix does appear by placing two of the green column vectors side by side. Or for a Pell form $x^2 - n y^2,$ find the fundamental solution $u^2 - n v^2 = 1$ with minimal positive entries, then the matrix is $$\left( \begin{array}{cc} u & nv \\ v & u \end{array} \right)$$ Feb 4, 2015 at 18:40
• @user130018, if you do your diagram with that much detail (I'm not so sure they are asking for more than the values this time) you will eventually find that your square matrix is $$\left( \begin{array}{cc} 664 & 975 \\ 585 & 859 \end{array} \right)$$ for your form $3 x^2 + x y - 5 y^2.$ Getting that far with the (green) $x,y$ coordinates is a large effort but can be done by hand. I wrote software, also know many ways to find the matrix. Feb 4, 2015 at 18:50
• @user130018, the other book I recommend is John Stillwell, Elements of Number Theory, pages 87-99. Excerpt, not necessarily all those pages, books.google.com/… Page 100 is also nice, it says Conway made a video on this, available from the AMS !! Feb 4, 2015 at 19:38
• Feb 4, 2015 at 19:45

Suppose that we have found a particular solution of $x^2-3y^2=-2$, say $(x_0,y_0)$. We can then write $$(x_0+y_0\sqrt{3})(x_0-y_0\sqrt{3})=-2.$$ Note that $2^2-3(1^2)=1$. Write this as $$(2+\sqrt{3})(2-\sqrt{3})=1.$$ Combining the two results above, we see that $$(x_0+\sqrt{3}y_0)(2+\sqrt{3})(x_0-\sqrt{3}y_0)(2-\sqrt{3})=-2.$$ Expanding, we get $$[2x_0+3y_0+\sqrt{3}(x_0+2y_0)] [2x_0+3y_0-\sqrt{3}(x_0+2y_0)]=-2.$$ This just says that $$(2x_0+3y_0)^2-3(x_0+2y_0)^3=-2.$$ Put $x_1=2x_0+3y_0$, and $y_1=x_0+2y_0$. We have shown that $x_1^2-3y_1^2=-2$.

In general, once we have found a solution $(x_n,y_n)$ we can find another solution $(x_{n+1},y_{n+1})$ where $$x_{n+1}=2x_n+ 3y_n \qquad\text{and}\qquad y_{n+1}=x_n+2y_n.$$

Remark: The above idea is very old. You may be interested in looking up the Brahmagupta Identity.

• Sorry, I did not notice you had the automorph approach, just starting a different way. Nov 4, 2012 at 0:53

If you're a bit familiar with algebraic number theory:

$x^2 - 3y^2$ is the norm of the element $x + y\sqrt{3}$ in $\mathbb{Q}(\sqrt{3})$. Given the obvious element $1 + \sqrt{3}$ with norm $-2$, every other possibility differs by multiplication with an element of norm $1$. Dirichlet's unit theorem characterizes them: all powers of $2 + \sqrt{3}$ (up to $\pm 1$).

So the solutions are given by $\pm x \pm y\sqrt{3} = (1 + \sqrt{3})(2 + \sqrt{3})^n$ for $n \in \mathbb{Z}$.

This is an issue that comes up over and over again. The quadratic form $m^2-3n^2$ happens to be the norm form for the quadratic field $\mathbb{Q}(\sqrt3)$. That is, when you write $z=m+n\sqrt3$ and $\bar z=m-n\sqrt3$, you see that $z\mapsto\bar z$ preserves both multiplication and addition. So $z\mapsto z\bar z$ is also multiplicative, taking integral things in the field to ordinary integers. And it takes the value $\pm1$ on the group of units of the corresponding integer ring $\mathbb{Z}[\sqrt3]$. We know, from the study of Pell’s Equation, or from continued fractions, or from much more advanced methods, that every unit is plus-or-minus a power of the primitive unit $2+\sqrt3$.

So what? If you can only find one of these quadratic integers, $z_0$, whose “norm” $z\bar z$ is equal to $-2$, you can get all the others by multiplying by units. But of course the norm of $1+\sqrt3$ is $-2$, you’ve got your recipe for finding all. So: $(1+\sqrt3)(2+\sqrt3)=5+3\sqrt3$; $(1+\sqrt3)(2+\sqrt3)^2=19+11\sqrt3$, etc.

As an alternative approach which you might like to investigate:

If you write $\sqrt{3}$ as a continued fraction, you get

$$1+\cfrac{1}{1+\cfrac{1}{2+\cfrac{1}{1+\cfrac{1}{2+ \cfrac{1}{1+\cfrac{1}{2+\cfrac{1}{1+\cfrac{1}{2+\cdots}}}}}}}}$$

If you then calculate the partial convergents by stopping the continued fraction after a certain point, you will find that the solutions appear as the numerators and denominators of some of the convergents. It is an interesting exercise to decide which ones.

Here's another approach.

$$X^2-AY^2=B\tag1$$ $$x^2-Ay^2=1\tag2$$

If we know fundamental solution $(a,b/A)$ for $(2)$ and “trivial” solutions $(t,v)$ for $(1)$ then:

$$X_n = \sum_{k=0}^{n}\frac{a^{n-k}b^k\displaystyle\binom{n}{k}\left(\left(\left\lceil\frac{k}{2}\right\rceil -\left\lfloor\frac{k}{2}\right\rfloor\right)v + \left(\left\lceil\frac{k+1}{2}\right\rceil -\left\lfloor\frac{k+1}{2}\right\rfloor\right)t\right)}{A^{\left\lfloor\frac{k}{2}\right\rfloor}}$$

$$Y_n = \sum_{k=0}^n \frac{a^{n-k}b^k\displaystyle\binom{n}{k}\left(\left( \left\lceil\frac{k+1}{2}\right\rceil -\left\lfloor\frac{k+1}{2}\right\rfloor\right)v + \left(\left\lceil\frac{k}{2}\right\rceil - \left\lfloor\frac{k}{2}\right\rfloor\right)t\right)}{A^{\left\lceil\frac{k}{2}\right\rceil}}$$

For $X^2 -3Y^2 = -2$; $t = 1, v = 1, a = 2, b/A = 1$

$$X_n = \sum_{k=0}^n 3^{k-\left\lfloor\frac{k}{2}\right\rfloor}2^{n-k}\binom{n}{k}$$

$$Y_n = \sum_{k=0}^n 3^{k-\left\lceil\frac{k}{2}\right\rceil}2^{n-k}\binom{n}{k}$$

• I've replaced the words 'floor' and 'ceiling' with the corresponding symbols. If you didn't want the symbols, you can always revert back to your original answer. Jan 8, 2016 at 5:22