# Talk:Pell's equation

<quote>  It turns out that if (p, q) satisfies Pell's equation, then so does (2pq, 2q^2-1).</quote>
Does it?

  
    
      
        n
        (
        2
        
          q
          
            2
          
        
        −
        1
        
          )
          
            2
          
        
        +
        1
        =
        4
        n
        
          q
          
            4
          
        
        −
        4
        n
        
          q
          
            2
          
        
        +
        n
        +
        1
      
    
    {\displaystyle n(2q^{2}-1)^{2}+1=4nq^{4}-4nq^{2}+n+1}
  
;
  
    
      
        4
        
          p
          
            2
          
        
        
          q
          
            2
          
        
        =
        4
        (
        n
        
          q
          
            2
          
        
        +
        1
        )
        
          q
          
            2
          
        
        =
        4
        n
        
          q
          
            4
          
        
        +
        4
        
          q
          
            2
          
        
      
    
    {\displaystyle 4p^{2}q^{2}=4(nq^{2}+1)q^{2}=4nq^{4}+4q^{2}}
  

Which aren't generally equal. (Probably only for n = -1) --User:Xaos

I removed the words "quadratic indeterminate" from

"Pell's equation is any quadratic indeterminate Diophantine equation of the form 
  
    
      
        
          x
          
            2
          
        
        −
        n
        
          y
          
            2
          
        
        =
        1
      
    
    {\displaystyle x^{2}-ny^{2}=1}
  
."
because the form already says that the equation is quadratic and indeterminate (in the sense of underdetermined). It is claimed that "there are many scholars referring to Pell's equation as an indeterminate equation", but I've seen no evidence for it and I still doubt that it's a standard term; anyway, it clearly is superfluous. -- Jitse Niesen (talk) 07:49, 10 April 2006 (UTC)

What is the purpose of this section with the square root of 2, and averaging the two fractions and so on.  This method is not detailed like the Indian method or Lagrange's, and it only seems to work with this specific example.  It provides no evidence to back the procedure up.  Perhaps this section could be clarified, or maybe it should be considered for removal. —The preceding unsigned comment was added by Xcelerate (talk • contribs) 17:18, 15 January 2007 (UTC).

As part of a major reorganization of this article, I removed this section. Like you I found it unhelpful. I replaced it with a more straightforward worked-out example for n = 7, which gives I think a better flavor of the general technique. —David Eppstein 20:09, 20 March 2007 (UTC)

A (partial) solution given by Euler (??) was to write Pell's equation

  
    
      
        N
        
          x
          
            2
          
        
        −
        
          y
          
            2
          
        
        =
        1
      
    
    {\displaystyle Nx^{2}-y^{2}=1}
  
 as 
  
    
      
        (
        
          
            m
            n
          
        
        
          )
          
            2
          
        
        =
        (
        1
        
          /
        
        
          x
          
            2
          
        
        )
        +
        (
        y
        
          /
        
        x
        
          )
          
            2
          
        
      
    
    {\displaystyle ({\frac {m}{n}})^{2}=(1/x^{2})+(y/x)^{2}}
  
 then for big (x,y) y=m and x=n with m and n the convergents of the continued fraction for 
  
    
      
        
          
            (
          
        
        N
        )
      
    
    {\displaystyle {\sqrt {(}}N)}
  
 —Preceding unsigned comment added by Karl-H (talk • contribs) 

I believe the continued fraction solution technique described in the article is due to Euler. Is that what you mean? —David Eppstein 22:58, 24 March 2007 (UTC)

ok, i dont know about the indians, but it was certainly studied before Pell's times.  Fermat certainly did.  Fermat's theorem on Epll eqn.  
16:48, 10 June 2007 (UTC)70.18.52.179 16:48, 10 June 2007 (UTC)
This really needs some more citations in the history section.  Where's the source that Archimedes used it to get an approximation to the square root of 3?  How do we know Greeks studied in the 5th century BCE?  These are assumptions, possibly sound ones, but we need sources.  Sceptic1954 (talk) 19:42, 13 May 2013 (UTC)

"Gauss classified such solutions into 64 or 65 sets, with the precise classification of one or the other implying the truth or falsity of the Riemann hypothesis."
This seems too ridiculous to be true, even though it is from an old edit (Feb 2005) and one would think some expert would have noticed it by now. I don't believe Gauss could have possessed any mathematical statement that is equivalent to the Riemann hypothesis. (At best he could have guessed the precise error term for the Prime Number Theorem that is equivalent to RH, and he didn't.) It is not clear what the quoted sentence refers to as "such solutions", but anyway I don't think there exists any such statement known to be equivalent to RH. 128.36.156.146 (talk) 05:18, 1 December 2008 (UTC)

i have worked  on equation of same type that is Nx^2 + k = y^2 , i have found that when N is not a perfect square, then y(2m) = {2({y(m)}^2} - k}/√k and x(2m) = 2x(m)× y(m); where m is the iteration number or the mth value for  x and y , that is y(m) is the mth value for y and y(2m) is the 2×mth value for y. Ranjitr303 (talk) 06:48, 24 June 2010 (UTC)

The article is generally fine but I can't grasp the intent of 

An alternative method to solving, once finding the first non-trivial solution, one could take the original equation 
  
    
      
        
          x
          
            2
          
        
        −
        n
        
          y
          
            2
          
        
        =
        1
      
    
    {\displaystyle x^{2}-ny^{2}=1}
  
 and factor the left hand side as a difference of squares, yielding 
  
    
      
        (
        x
        +
        y
        
          
            n
          
        
        )
        (
        x
        −
        y
        
          
            n
          
        
        )
        =
        1.
      
    
    {\displaystyle (x+y{\sqrt {n}})(x-y{\sqrt {n}})=1.}
  
  Once in this form, one can simply raise each side of the equation to the kth power, and recombining the factored form to a single difference statement.  The solution 
  
    
      
        s
      
    
    {\displaystyle s}
  
 will be of the form 
  
    
      
        (
        x
        −
        s
        
          )
          
            k
          
        
        +
        n
        ∗
        (
        y
        −
        s
        
          )
          
            k
          
        
        =
        1.
      
    
    {\displaystyle (x-s)^{k}+n*(y-s)^{k}=1.}
  

The fundamental solution is not used and the result is a big mess
There are all kinds of true facts such as: If α is the fundamental solution then 
  
    
      
        
          α
          
            k
          
        
      
    
    {\displaystyle \alpha ^{k}}
  
 is very close to an even integer 2a (In fact it is very very close to 2a+1/2a or 2a-1/2a) and the kth solution is |a^2-nb^2|=1 where b is easy to find once one has a. (even with k=1, 8+3√7=15.937253933.. while 16-1/16=15.9375 and for bigger k it is even more dramatic ) BUT cute as that is, it is not a very effective computational method, so I don't advocate for it, just making the indicated two sentences clearer or killing them. Gentlemath (talk) 03:28, 16 July 2010 (UTC)

The passage makes no sense to me. It is unreferenced and was put in on 21 September 2009 by User:Cup of Calculus, who has never had any other content edits on Wikipedia except one other one that same day. I'll delete it. Loraof (talk) 15:57, 7 January 2016 (UTC)

It is mentioned in the article that Diophantus solved an equation of the form a²x² + c = y² for a = 1 and c = -1, 1, 12, and for a = 3 and c = 9. Aren't all these cases quite trivial? Somehow it doesn't make sense to me that this is what he did, and even if so, that it is worth mentioning. 188.169.229.30 (talk) 10:33, 8 January 2012 (UTC)

Not when all numbers involved are integers (or, which is equivalent in non-triviality, rational). Which in this context they are.--Matt Westwood 21:36, 8 January 2012 (UTC)
Actually I think the integer case is trivial, at least with a = 1 — it's the rational case that isn't. My understanding is that Diophantus was concerned more with rational solutions than with integer solutions. —David Eppstein (talk) 22:32, 8 January 2012 (UTC)

The whole part about Brahmagupta solving the formula 1000 years earlier is fishy - all of the Brahmagupta, Chakravala method and Bashkara II pages disagree with this. Brahmagupta found a partial solution, and didn't invent the charkravala method.  — Preceding unsigned comment added by 194.126.175.154 (talk) 17:55, 4 December 2013 (UTC) 

From the paragraph 'Solutions/Quantum algorithms' in the article:
Hallgren (2007) showed that a quantum computer can find a product representation, as described above, for the solution to Pell's equation in polynomial time. Hallgren's algorithm, which can be interpreted as an algorithm for finding the group of units of a real quadratic number field, was extended to more general fields by Schmidt & Völlmer (2005).
It seems from this text that Schmidt & Völlmer used Hallgren work to extend it and produce a more generic solution but they published their algorithm before Hallgren ! Isn't it a bit strange ?
I double checked the abstracts and the paper of Schmidt & Völlmer does cite Hallgren works:
Our algorithms generalize and improve upon Hallgren's work [9] for the one-dimensional case corresponding to real-quadratic fields.
And from Hallgren abstract it seems to really be this paper that is cited:
The second problem we solve is the principal ideal problem in real quadratic number fields.
How is it possible ? Could the date not be the dates of the first publication ?  — Preceding unsigned comment added by 2A01:E35:8A3A:9A80:1E4B:D6FF:FEBB:19BC (talk) 05:16, 25 April 2015 (UTC) 

The comment(s) below were originally left at Talk:Pell's equation/CommentsTalk:Pell's equation/Comments, and are posted here for posterity. Following several discussions in past years, these subpages are now deprecated. The comments may be irrelevant or outdated; if so, please feel free to remove this section.
Last edited at 22:21, 9 June 2007 (UTC).
Substituted at 02:27, 5 May 2016 (UTC)

Notice: Better sooner or later, the title of the article must be changed to "Pell equation". The English version of wikipedia must avoid bad grammar in its titles.Highness 04:58, 1 July 2016 (UTC)  — Preceding unsigned comment added by J20160628 (talk • contribs)  

There is nothing ungrammatical about "Pell's equation". Your own grammar, however, is faulty: "Pell equation" cannot be used in that form without an article. —David Eppstein (talk) 17:44, 1 July 2016 (UTC)

The section The smallest solution of Pell equations begins as follows:
"The following is a list of the smallest solution (fundamental solution) to 
  
    
      
        
          x
          
            2
          
        
        −
        n
        
          y
          
            2
          
        
        =
        1
      
    
    {\displaystyle x^{2}-ny^{2}=1}
  
 with n ≤ 128."
But the meaning of "smallest" solution is not explained.
Of course, if two solutions are (x,y) and (x',y') with x < x' and y < y' then it is natural to consider (x,y) to be a "smaller" solution than (x',y').
But what if, for instance, x < x' < y' < y ? (Or can this never happen?) 2601:200:C000:1A0:1860:7903:F5E8:6EE (talk) 21:31, 22 June 2021 (UTC)

it's the solution 
  
    
      
        x
        ,
        y
      
    
    {\displaystyle x,y}
  
 for which the value of 
  
    
      
        x
        +
        y
        
          
            n
          
        
      
    
    {\displaystyle x+y{\sqrt {n}}}
  
 is smallest. The more common term is "fundamental solution", which is defined in the article; I changed the section title accordingly. Thank you.--Qcomp (talk) 21:55, 22 June 2021 (UTC)
It is never going to be the case that a smaller x corresponds to a bigger y. Saying that 
  
    
      
        x
        +
        y
        
          
            n
          
        
      
    
    {\displaystyle x+y{\sqrt {n}}}
  
 is smallest is making it unnecessarily complicated and WP:TECHNICAL. —David Eppstein (talk) 22:06, 22 June 2021 (UTC)
true, but I think the question was legitimate, as "smallest" for a pair (x,y) had not been defined. I gave the customary definition. But the article already defines the "fundamental solution" before the section that caused the confusion. Therefore I changed the section title and removed he notion of "smallest" (and also the sentence with the square root term, that I had added), as it is not needed. Hope that is both clearer and less technical. --Qcomp (talk) 22:26, 22 June 2021 (UTC)

I would like to add in the section Solutions/Additional solutions from the fundamental solution the following:
With z = x_1 + Sqrt(x_1^2 - 1) we also get a closed form formula for all other solutions (x_k,y_k) with k>=1:
x_k = cosh(k*ln(z))
y_k = sinh(k*ln(z))/sqrt(n) Beehrter Maibock (talk) 15:42, 2 June 2022 (UTC)

 Not done: This is just a more complicated way of expressing 
  
    
      
        
          x
          
            k
          
        
        +
        
          y
          
            k
          
        
        
          
            n
          
        
        =
        (
        
          x
          
            1
          
        
        +
        
          y
          
            1
          
        
        
          
            n
          
        
        
          )
          
            k
          
        
      
    
    {\displaystyle x_{k}+y_{k}{\sqrt {n}}=(x_{1}+y_{1}{\sqrt {n}})^{k}}
  
, so I don't see why this should be included. If you can find a reliable source which uses these cosh, sinh forms to write the solutions, please do. —lightbulbMEOW!!! (meow) 15:46, 4 June 2022 (UTC)

In the 'Generalized Pell's equation section, there is:
If x and y and positive integer solutions to the Pell's equation with
should be
If x and y are positive integer solutions to the Pell's equation with 185.48.129.79 (talk) 13:07, 22 November 2022 (UTC)

Thank you, done. --Mvqr (talk) 14:37, 22 November 2022 (UTC)

The suggestion of testing each convergent until a solution is found, perhaps was lifted explicitly from the reference (I don't have it at hand), but it is unfortunate. The specific convergent that works is known, it depends on the period of the continued fraction and the parity of the period (before the period, when the period is even or before twice the period, when the period is odd). It wouldn't cost much explanation to be more specific. I would be surprised if Andreescu (the reference) didn't mention it in his book. Thatwhichislearnt (talk) 15:39, 13 February 2024 (UTC)

Indeed, Andreescu's book is certainly more specific than just testing all convergents. All details that all positive solutions are convergents and which convergents they are are mentioned in the book. I added some to the article. Otherwise a casual reader would be wasting time testing all convergents from the beginning until they find a solution. I added the detail about the portion of the period of the continued fraction being palindromic. I have no strong opinion on whether to include that or not. It is not terribly important for this article. I guess it could save a bit of computation, if one guesses that one has reached the midpoint of the period and the coefficients are starting to reflect. Thatwhichislearnt (talk) 15:50, 14 February 2024 (UTC)

Do we have any good sources for the claim that it was studied in 400 BC in India for n=2? I cannot find any. 2A02:587:B806:A600:DD78:C378:46ED:459A (talk) 13:50, 22 June 2024 (UTC)