8

It is quite straightforward to find the fundamental solutions for a given Pell's equation when $d$ is small. But I am unable to solve this equation, as I'm unable to find the fundamental solutions:

Solve: $x^2-29y^2=1$ and $x^2-29y^2=-1$ with $y\not=0$.

Could you please guide me through the solution

vonbrand
  • 27,812
L887
  • 427
  • 1
    The first integer solution with $|x|>1$ is $x=\pm9801$. – Lucian Dec 01 '14 at 05:37
  • 1
    The fundamental solution to x^2−29y^2=1 is (9801, 1820) according to http://www.had2know.com/academics/pell-equation-calculator.html. But I want to know the method to calculate this. – L887 Dec 01 '14 at 07:02
  • A commonly used method to find the fundamental solution to the Pell's equation is the Dirichlet's approximation theorem, but I didn't understand how to apply it. Could anyone throw some light on this.Thanks – L887 Dec 01 '14 at 07:32
  • @WillJagy Yes you are right, we can use the method discovered by Gauss and Lagrange, but in order to do so you need to first find out the fundamental solutions and then you could use the recursive formulae formulated by them to find the rest of the solutions trivially.These formulae were derived by them using the Pigeon hole principle. But as you see although 29 seems like a small number the fundamental solution is very large. So how do we go about it in such cases using only mechanical calculation techniques? – L887 Dec 01 '14 at 07:38
  • L887, I meant something rather different, equivalent to continued fractions, which you should learn in any case, continued fractions are quite easy. – Will Jagy Dec 01 '14 at 20:36
  • Take a peek at Wikipedia's article – vonbrand Jan 03 '16 at 01:58
  • @Lucian $9801=99^2$ by the way – Mr Pie May 02 '18 at 10:45

4 Answers4

7

(Too long for a comment.)

If you're lucky and your discriminant $d$ has a certain form ($d = 5, 13, 21, 29, 53, 61, \dots$), you can use the smaller fundamental solutions of the Pell equation,

$$p^2-dq^2 = -4\tag{1}$$

Let,

$$\left(\frac{p+q\sqrt{d}}{2}\right)^3=u+v\sqrt{d}\tag2$$

$$\left(\frac{p+q\sqrt{d}}{2}\right)^6=x+y\sqrt{d}\tag3$$

then,

$$u^2-dv^2 = -1\tag4$$

$$x^2-dy^2 = 1\tag5$$

If fundamental $p,q$ are odd, then $(2),(3)$ are also fundamental. For your $d=29$, it is just $p,q = 5,1$. Hence the fundamental unit,

$$U_{29} =\tfrac{5+\sqrt{29}}{2}$$

and,

$$\big(U_{29}\big)^3=70+13\sqrt{29},\quad \text{thus}\;\;\color{blue}{70}^2-29\cdot\color{blue}{13}^2=-1$$

$$\big(U_{29}\big)^6=9801+1820\sqrt{29},\quad \text{thus}\;\;\color{blue}{9801}^2-29\cdot1820^2=1$$

$$2^6\left(\big(U_{29}\big)^6+\big(U_{29}\big)^{-6}\right)^2 =\color{blue}{396^4}$$

Incidentally, since certain eta quotients involve $U_{29}$, we find those integers all over Ramanujan's famous pi formula,

$$\frac{1}{\pi} = \frac{2 \sqrt 2}{\color{blue}{9801}} \sum_{k=0}^\infty \frac{(4k)!}{k!^4} \frac{29\cdot\color{blue}{70\cdot13}\,k+1103}{\color{blue}{(396^4)}^k}$$

Nice, eh?

6

The standard method for finding the fundamental solution is continued fractions for $\sqrt {29},$ and would not be difficult with a calculator. HERE is a summary using $\sqrt 7$ instead. Gauss and Lagrange made an equivalent but better method with "reduced" quadratic forms, that requires no decimal accuracy for the square root, just the integer part, just integer arithmetic, and no "cycle detection." I have described it often on this site.

http://zakuski.utsa.edu/~jagy/BLOG_2014_July_15.pdf

jagy@phobeusjunior:~/old drive/home/jagy/Cplusplus$ ./Pell 29

0 form 1 10 -4 delta -2 1 form -4 6 5 delta 1 2 form 5 4 -5 delta -1 3 form -5 6 4 delta 2 4 form 4 10 -1 delta -10 5 form -1 10 4 delta 2 6 form 4 6 -5 delta -1 7 form -5 4 5 delta 1 8 form 5 6 -4 delta -2 9 form -4 10 1 delta 10 10 form 1 10 -4

Pell automorph 9801 52780 1820 9801

Pell unit 9801^2 - 29 * 1820^2 = 1

=========================================

Pell NEGATIVE 70^2 - 29 * 13^2 = -1

=========================================

4 PRIMITIVE 27^2 - 29 * 5^2 = 4

=========================================

-4 PRIMITIVE 3775^2 - 29 * 701^2 = -4

NOTE by hand: 5^2 - 29 * 1^2 = -4 was passed over by my program; that's life.

=========================================

Well. The general, reliable method is continued fractions. Doing these with an ordinary calculator for $\sqrt n$ will work nicely for most small $n.$ However, as you can check in various places, this becomes problematic for $\sqrt {61}.$ You can switch to continued fractions with large decimal accuracy on computer, but eventually one runs into problems. The method above is very similar to continued fractions, it just has a more careful style of bookkeeping, with the result that it always works. The fundamental theorem here is due to Lagrange, I will put a jpeg from a 1929 book by L. E. Dickson, it is Theorem 85. Notice that everyone is now using LED light bulbs, that can't be a coincidence.

enter image description here

Will Jagy
  • 139,541
2

Method described by Prof. Lubin at Continued fraction of $\sqrt{67} - 4$

$$ \sqrt { 29} = 5 + \frac{ \sqrt {29} - 5 }{ 1 } $$ $$ \frac{ 1 }{ \sqrt {29} - 5 } = \frac{ \sqrt {29} + 5 }{4 } = 2 + \frac{ \sqrt {29} - 3 }{4 } $$ $$ \frac{ 4 }{ \sqrt {29} - 3 } = \frac{ \sqrt {29} + 3 }{5 } = 1 + \frac{ \sqrt {29} - 2 }{5 } $$ $$ \frac{ 5 }{ \sqrt {29} - 2 } = \frac{ \sqrt {29} + 2 }{5 } = 1 + \frac{ \sqrt {29} - 3 }{5 } $$ $$ \frac{ 5 }{ \sqrt {29} - 3 } = \frac{ \sqrt {29} + 3 }{4 } = 2 + \frac{ \sqrt {29} - 5 }{4 } $$ $$ \frac{ 4 }{ \sqrt {29} - 5 } = \frac{ \sqrt {29} + 5 }{1 } = 10 + \frac{ \sqrt {29} - 5 }{1 } $$

Simple continued fraction tableau:
$$ \begin{array}{cccccccccccccccccccccccc} & & 5 & & 2 & & 1 & & 1 & & 2 & & 10 & & 2 & & 1 & & 1 & & 2 & & 10 & \\ \\ \frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 5 }{ 1 } & & \frac{ 11 }{ 2 } & & \frac{ 16 }{ 3 } & & \frac{ 27 }{ 5 } & & \frac{ 70 }{ 13 } & & \frac{ 727 }{ 135 } & & \frac{ 1524 }{ 283 } & & \frac{ 2251 }{ 418 } & & \frac{ 3775 }{ 701 } & & \frac{ 9801 }{ 1820 } \\ \\ & 1 & & -4 & & 5 & & -5 & & 4 & & -1 & & 4 & & -5 & & 5 & & -4 & & 1 \end{array} $$

$$ \begin{array}{cccc} \frac{ 1 }{ 0 } & 1^2 - 29 \cdot 0^2 = 1 & \mbox{digit} & 5 \\ \frac{ 5 }{ 1 } & 5^2 - 29 \cdot 1^2 = -4 & \mbox{digit} & 2 \\ \frac{ 11 }{ 2 } & 11^2 - 29 \cdot 2^2 = 5 & \mbox{digit} & 1 \\ \frac{ 16 }{ 3 } & 16^2 - 29 \cdot 3^2 = -5 & \mbox{digit} & 1 \\ \frac{ 27 }{ 5 } & 27^2 - 29 \cdot 5^2 = 4 & \mbox{digit} & 2 \\ \frac{ 70 }{ 13 } & 70^2 - 29 \cdot 13^2 = -1 & \mbox{digit} & 10 \\ \frac{ 727 }{ 135 } & 727^2 - 29 \cdot 135^2 = 4 & \mbox{digit} & 2 \\ \frac{ 1524 }{ 283 } & 1524^2 - 29 \cdot 283^2 = -5 & \mbox{digit} & 1 \\ \frac{ 2251 }{ 418 } & 2251^2 - 29 \cdot 418^2 = 5 & \mbox{digit} & 1 \\ \frac{ 3775 }{ 701 } & 3775^2 - 29 \cdot 701^2 = -4 & \mbox{digit} & 2 \\ \frac{ 9801 }{ 1820 } & 9801^2 - 29 \cdot 1820^2 = 1 & \mbox{digit} & 10 \\ \end{array} $$

======================================================================================

$$ \sqrt { 95} = 9 + \frac{ \sqrt {95} - 9 }{ 1 } $$ $$ \frac{ 1 }{ \sqrt {95} - 9 } = \frac{ \sqrt {95} + 9 }{14 } = 1 + \frac{ \sqrt {95} - 5 }{14 } $$ $$ \frac{ 14 }{ \sqrt {95} - 5 } = \frac{ \sqrt {95} + 5 }{5 } = 2 + \frac{ \sqrt {95} - 5 }{5 } $$ $$ \frac{ 5 }{ \sqrt {95} - 5 } = \frac{ \sqrt {95} + 5 }{14 } = 1 + \frac{ \sqrt {95} - 9 }{14 } $$ $$ \frac{ 14 }{ \sqrt {95} - 9 } = \frac{ \sqrt {95} + 9 }{1 } = 18 + \frac{ \sqrt {95} - 9 }{1 } $$

Simple continued fraction tableau:
$$ \begin{array}{cccccccccccccc} & & 9 & & 1 & & 2 & & 1 & & 18 & \\ \\ \frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 9 }{ 1 } & & \frac{ 10 }{ 1 } & & \frac{ 29 }{ 3 } & & \frac{ 39 }{ 4 } \\ \\ & 1 & & -14 & & 5 & & -14 & & 1 \end{array} $$

$$ \begin{array}{cccc} \frac{ 1 }{ 0 } & 1^2 - 95 \cdot 0^2 = 1 & \mbox{digit} & 9 \\ \frac{ 9 }{ 1 } & 9^2 - 95 \cdot 1^2 = -14 & \mbox{digit} & 1 \\ \frac{ 10 }{ 1 } & 10^2 - 95 \cdot 1^2 = 5 & \mbox{digit} & 2 \\ \frac{ 29 }{ 3 } & 29^2 - 95 \cdot 3^2 = -14 & \mbox{digit} & 1 \\ \frac{ 39 }{ 4 } & 39^2 - 95 \cdot 4^2 = 1 & \mbox{digit} & 18 \\ \end{array} $$

=================================================================================

$$ \sqrt { 74} = 8 + \frac{ \sqrt {74} - 8 }{ 1 } $$ $$ \frac{ 1 }{ \sqrt {74} - 8 } = \frac{ \sqrt {74} + 8 }{10 } = 1 + \frac{ \sqrt {74} - 2 }{10 } $$ $$ \frac{ 10 }{ \sqrt {74} - 2 } = \frac{ \sqrt {74} + 2 }{7 } = 1 + \frac{ \sqrt {74} - 5 }{7 } $$ $$ \frac{ 7 }{ \sqrt {74} - 5 } = \frac{ \sqrt {74} + 5 }{7 } = 1 + \frac{ \sqrt {74} - 2 }{7 } $$ $$ \frac{ 7 }{ \sqrt {74} - 2 } = \frac{ \sqrt {74} + 2 }{10 } = 1 + \frac{ \sqrt {74} - 8 }{10 } $$ $$ \frac{ 10 }{ \sqrt {74} - 8 } = \frac{ \sqrt {74} + 8 }{1 } = 16 + \frac{ \sqrt {74} - 8 }{1 } $$

Simple continued fraction tableau:
$$ \begin{array}{cccccccccccccccccccccccc} & & 8 & & 1 & & 1 & & 1 & & 1 & & 16 & & 1 & & 1 & & 1 & & 1 & & 16 & \\ \\ \frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 8 }{ 1 } & & \frac{ 9 }{ 1 } & & \frac{ 17 }{ 2 } & & \frac{ 26 }{ 3 } & & \frac{ 43 }{ 5 } & & \frac{ 714 }{ 83 } & & \frac{ 757 }{ 88 } & & \frac{ 1471 }{ 171 } & & \frac{ 2228 }{ 259 } & & \frac{ 3699 }{ 430 } \\ \\ & 1 & & -10 & & 7 & & -7 & & 10 & & -1 & & 10 & & -7 & & 7 & & -10 & & 1 \end{array} $$

$$ \begin{array}{cccc} \frac{ 1 }{ 0 } & 1^2 - 74 \cdot 0^2 = 1 & \mbox{digit} & 8 \\ \frac{ 8 }{ 1 } & 8^2 - 74 \cdot 1^2 = -10 & \mbox{digit} & 1 \\ \frac{ 9 }{ 1 } & 9^2 - 74 \cdot 1^2 = 7 & \mbox{digit} & 1 \\ \frac{ 17 }{ 2 } & 17^2 - 74 \cdot 2^2 = -7 & \mbox{digit} & 1 \\ \frac{ 26 }{ 3 } & 26^2 - 74 \cdot 3^2 = 10 & \mbox{digit} & 1 \\ \frac{ 43 }{ 5 } & 43^2 - 74 \cdot 5^2 = -1 & \mbox{digit} & 16 \\ \frac{ 714 }{ 83 } & 714^2 - 74 \cdot 83^2 = 10 & \mbox{digit} & 1 \\ \frac{ 757 }{ 88 } & 757^2 - 74 \cdot 88^2 = -7 & \mbox{digit} & 1 \\ \frac{ 1471 }{ 171 } & 1471^2 - 74 \cdot 171^2 = 7 & \mbox{digit} & 1 \\ \frac{ 2228 }{ 259 } & 2228^2 - 74 \cdot 259^2 = -10 & \mbox{digit} & 1 \\ \frac{ 3699 }{ 430 } & 3699^2 - 74 \cdot 430^2 = 1 & \mbox{digit} & 16 \\ \end{array} $$

Will Jagy
  • 139,541
0

Pell Equation - from Wolfram MathWorld is a good resource. To summarize (without proofs):

Ignore trivial solution $(x,y) = (1,0)$. Let $p_n / q_n$ denote the $n$th convergent $[a_0; a_1, \dots, a_n]$ of $\sqrt D$.

$x^2 - Dy^2 = \pm 1$ is solved if we can find a convergent obeying $$p^2_n - D q^2_n = (-1)^{n+1}$$

The continued fraction always becomes periodic at some term $a_{r+1} = 2 a_0$, so that $$ \sqrt D = [a_0; \overline{a_1, \dots, a_r, 2 a_0}] $$

The partial denominators $a_0, \dots, a_r$ can be extracted via the following process starting with $(P_0,Q_0) = (0,1)$ and $a_0 = \lfloor \sqrt D \rfloor $:

$$ \begin{align} P_n &= a_{n-1} Q_{n-1} - P_{n-1} \\ Q_n &= \frac{D - P_{n}^2}{Q_{n-1}} \\ a_n &= \left\lfloor \frac{a_0 + P_n}{Q_n} \right\rfloor \\ \end{align} $$

The convergents $p_n / q_n$ are computed with

$$ \begin{align} p_n &= a_n p_{n-1} + p_{n-2} \\ q_n &= a_n q_{n-1} + q_{n-2} \\ \end{align} $$

starting with $(p_0, q_0) = (a_0, 1)$ and $(p_1, q_1) = (a_0 a_1 + 1, a_1)$.

The fundamental solution $(x,y)$ is then $(p_r, q_r)$ for $r$ odd and $(p_{2r+1}, q_{2r+1})$ for $r$ even.

The proofs are in Beiler, A. H. "The Pellian." Ch. 22 in Recreations in the Theory of Numbers: The Queen of Mathematics Entertains. New York: Dover, pp. 248-268, 1966.

qwr
  • 10,716