Integer Solutions of Pell Equation in a Closed Rotated Square Region
Full text
#A112 INTEGERS 25 (2025) INTEGER SOLUTIONS OF PELL EQUATION IN A CLOSED ROTATED SQUARE REGION Kun Yi Ong Department of Mathematical Sciences, Faculty of Science and Technology, Universiti Kebangsaan Malaysia, Bangi, Selangor, Malaysia [email protected] Eddie Shahril Bin Ismail Department of Mathematical Sciences, Faculty of Science and Technology, Universiti Kebangsaan Malaysia, Bangi, Selangor, Malaysia [email protected] Received: 3/25/25, Revised: 10/19/25, Accepted: 11/15/25, Published: 11/25/25 Abstract The Pell equation x2−Dy2= 1 with non-square D > 1 has infinitely many integer solutions, yet most research has centered on the asymptotic behavior of fundamental units as Dvaries. By contrast, the exact distribution of solutions for a fixed D within bounded regions has received little attention. In this paper, we contribute to this direction by giving an explicit enumeration of all solutions to the Pell equation inside the square |x|+|y|≤λfor any λ > 0. We further extend our results to the shifted Pell equation (x−a)2−D(y−b)2= 1 for integers aand b, obtaining exact counts for sufficiently large λ. 1. Introduction Let Dbe a non-square positive integer. The Pell equation is the Diophantine equation x2−Dy2= 1 (1.1) whose solutions are integer pairs (x, y) satisfying (1.1). Its history dates back to the ancient Greeks, including Archimedes’ Cattle Problem (see [5, 6, 13]) and to the work of Brahmagupta and Bhaskara in India, as well as Fermat and Euler in Europe. It was Lagrange who finally established the fundamental fact that Pell equation (1.1) possesses infinitely many integer solutions. Proofs of this result can be found in numerous books and articles on number theory, see for example [2,4,10]. DOI: 10.5281/zenodo.17711743
INTEGERS: 25 (2025) 2 The positive solution (x, y)∈N2with the smallest value of x+y√Damong them is called the fundamental solution and is denoted by (α, β). In particular, it can be determined by α+β√D= inf nx+y√D: (x, y)∈Z2, x2−Dy2= 1, x +y√D > 1o. The following well-known result describes the set of integer solutions to Equation (1.1) (see [1,8–12,14]). Proposition 1.1. Let FDbe defined as the set of all integer solutions to (1.1), i.e., FD:= (x, y)∈Z2:x2−Dy2= 1.(1.2) Then FD=[ i,j∈{1,−1}(iun, jvn)∈Z2:n∈Z≥0, where unand vnare integers given by un+vn√D=α+β√Dn for all integers n≥0. Define functions u: [0,∞)→[1,∞) and v: [0,∞)→[0,∞) by u(x) := 1 2nα+β√Dx +α−β√Dxo(1.3) v(x) := 1 2√Dnα+β√Dx −α−β√Dxo(1.4) where (α, β) is the fundamental solution. We now state an alternative result to Proposition 1.1 describing the set of integer solutions to Equation (1.1) in terms of the functions uand v. Proposition 1.2 ([3]).Consider the functions uand vas defined in (1.3) and (1.4), respectively. Then u(n) = unand v(n) = vnfor all integers n≥0, where un and vnare integers as described in Proposition 1.1. This implies FD=[ i,j∈{1,−1}(iu(x), jv(x)) ∈Z2:x∈Z≥0. Much of the literature has focused on the growth of the fundamental unit εD:= α+β√Dassociated with the fundamental solution (α, β) as the integer Dvaries. For example, in 2011 Fouvry and Jouve [7] proved that the set of parameters D≤x for which log εDis larger than D1 4has a cardinality essentially larger than x1 4log2x. More recently, Xi [15] established uniform lower bounds for the counting function Sf(x, α) := n(εD, D):2≤D≤x, D =□, εD≤D1 2+αo,
INTEGERS: 25 (2025) 3 proving that for any fixed α∈1 2,1,Sf(x, α)≫√xlog2xas x→+∞. These works emphasize the asymptotic distribution of the fundamental unit as Dvaries. By contrast, comparatively little attention has been given to the case where Dis fixed and one studies the exact enumeration of integer solutions in bounded regions of the plane. To our knowledge, this problem has not been investigated in the literature. 2. Main Results Consider the functions uand vas defined in (1.3) and (1.4), respectively. Define the function f: [0,∞)→[1,∞)byf:= u+v. Since uand vare strictly increasing and unbounded, and since u(0) + v(0) = 1, it follows that fis bijective and strictly increasing. Therefore, we may define g: [1,∞)→[0,∞) as the inverse function of f, namely g:= f−1, which is also bijective and strictly increasing. In this paper, we study the set of integer solutions to Equation (1.1), where D is a fixed non-square positive integer, lying in the square |x|+|y|≤λwith λ > 0. For any set G⊆Z2and any real number λ > 0, we define QG(λ) := {(x, y)∈G:|x|+|y|≤λ}. We now address the problem of enumerating the set QFD(λ). As it turns out, the following result holds. Theorem 2.1. Consider the set FDas defined in (1.2). Then for any real number λ>0, QFD(λ) = ∅if λ < 1 [ i,j∈{1,−1}(iu(x), jv(x)) ∈Z2:x∈Z≥0, x ≤g(λ)if λ≥1, where g=f−1,f=u+v. This implies |QFD(λ)|=(0if λ < 1 2+4⌊g(λ)⌋if λ≥1. Proof. The case of λ < 1 is trivial, hence assume that λ≥1. By Proposition 1.2, QFD(λ) = [ i,j∈{1,−1}(iu(x), jv(x)) ∈Z2:x∈Z≥0,|iu(x)|+|jv(x)|≤λ =[ i,j∈{1,−1}(iu(x), jv(x)) ∈Z2:x∈Z≥0, f(x)≤λ,
INTEGERS: 25 (2025) 4 where f=u+v. Since gis strictly increasing, f(x)≤λimplies x≤g(λ) and the formula of QFD(λ) follows. For the number of elements, |QFD(λ)|, the case of λ<1 is obvious. For λ≥1, QFD(λ) = [ i,j∈{1,−1}(iu(x), jv(x)) ∈Z2:x∈Z≥0, x ≤g(λ) ={(1,0),(−1,0)}∪ [ i,j∈{1,−1}(iu(x), jv(x)) ∈Z2:x∈N, x ≤ ⌊g(λ)⌋, which implies |QFD(λ)|= 2 + 4 ⌊g(λ)⌋. Based on Theorem 2.1, it is natural to ask whether there exists an explicit formula for the function g(λ), where λ≥1. This will be addressed in the following result. Theorem 2.2. Consider the functions uand vas defined in (1.3) and (1.4), respectively. Let f=u+vand g=f−1. Then for any real number x≥1, g(x) = 1 log α+β√Dcosh−1 Dx −√Dx2−D+ 1 D−1!,(2.1) where cosh−1is the inverse cosh function. Equivalently, g(x) = log Dx −√Dx2−D+ 1 + √Dq(D+ 1) x2−D+ 1 −2x√Dx2−D+ 1 D−1 log α+β√D. (2.2) Proof. We begin with the function f: [0,∞)→[1,∞), f=u+v: f(x) =1 2nα+β√Dx +α−β√Dxo+1 2√Dnα+β√Dx −α−β√Dxo =1 2α+β√Dx +α+β√D−x+1 2√Dα+β√Dx −α+β√D−x =1 2nelog(α+β√D)x+e−log(α+β√D)xo+1 2√Dnelog(α+β√D)x−e−log(α+β√D)xo = cosh log α+β√Dx+1 √Dsinh log α+β√Dx. For simplicity, let y= log α+β√Dx. Then f(x) = cosh y+1 √Dsinh y= cosh y+1 √Dqcosh2y−1,
INTEGERS: 25 (2025) 5 which implies √D(f(x)−cosh y) = qcosh2y−1.(2.3) By squaring both sides of Equation (2.3) and rearranging the terms in cosh y, we obtain the quadratic equation (D−1) cosh2y−(2Df(x)) cosh y+D(f(x))2+ 1= 0. Applying the quadratic formula gives cosh y= 2Df(x)±r(2Df(x))2−4 (D−1) D(f(x))2+ 1 2 (D−1) =Df(x)±qD(f(x))2−D+ 1 D−1.(2.4) Here the symbol ±denotes either the plus (+) or minus (−) sign. Substituting x= 0 into (2.4), we find 1 = D±√D−D+ 1 D−1=D±1 D−1, which shows that the minus sign must be chosen. Substituting back y= log α+β√Dxinto (2.4) and solving for x, we obtain x=1 log α+β√Dcosh−1 Df(x)−qD(f(x))2−D+ 1 D−1 . Finally, replacing xwith g(x) := f−1(x), we obtain (2.1). To obtain (2.2), we start from (2.1) and use the identity cosh−1x= log x+√x2−1. In particular, for any x≥1, cosh−1 Dx −√Dx2−D+ 1 D−1! = log Dx −√Dx2−D+ 1 D−1+v u u t Dx −√Dx2−D+ 1 D−1!2 −1 = log Dx −√Dx2−D+ 1 + qDx −√Dx2−D+ 12−(D−1)2 D−1
INTEGERS: 25 (2025) 6 and rDx −pDx2−D+ 12−(D−1)2 =qD2x2+Dx2−D+ 1 −2DxpDx2−D+ 1 −D2+ 2D−1 =√Dq(D+ 1) x2−D+ 1 −2xpDx2−D+ 1. Expression (2.2) is rather complicated. From Theorem 2.1, we observe that the formula for QFD(λ) remains valid if we replace the function g(λ) with ⌊g(λ)⌋. This observation motivates us to ask whether there exists a simpler explicit formula for the function ⌊g(x)⌋compared to the original expression for g(x) given in (2.2). It turns out that the answer is yes, as we will describe in the following theorem. Theorem 2.3. Let gbe the function as described in Theorem 2.2. Then for any real number x≥1, ⌊g(x)⌋= log (⌊x⌋)+C log α+β√D ,(2.5) where C= log 2√D 1 + √D!is a positive real constant. More precisely, there exists a bounded function µ(x) : [1,∞)→[0,1) which vanishes precisely at the points f(0), f(1), f(2), . . ., and satisfies g(x) = log (⌊x⌋)+C log α+β√D +µ(x) (2.6) for all x≥1. Proof. We have the function f: [0,∞)→[1,∞) as f(x) =1 2nα+β√Dx +α−β√Dxo+1 2√Dnα+β√Dx −α−β√Dxo =1 + √D 2√Dα+β√Dx +√D−1 2√Dα−β√Dx . Since 0 <√D−1 2√D<1 and 0 <α−β√Dx =α+β√D−x ≤1, we have 0<√D−1 2√Dα−β√Dx <1.
INTEGERS: 25 (2025) 7 This implies that f(x)−1<1 + √D 2√Dα+β√Dx < f(x) and hence 2√D 1 + √D(f(x)−1) <α+β√Dx <2√D 1 + √D(f(x)) .(2.7) Focusing on the right-hand side of (2.7), substituting xwith ⌊x⌋and then taking logarithms, we obtain ⌊x⌋<log (f(⌊x⌋))+C log α+β√D(2.8) where C= log 2√D 1 + √D!. Since fis strictly increasing, we have f(x)≥f(⌊x⌋). Because f(⌊x⌋)∈Z, it follows that ⌊f(x)⌋≥f(⌊x⌋). Therefore, (2.8) becomes ⌊x⌋<log (⌊f(x)⌋)+C log α+β√D.(2.9) On the other hand, focusing on the left-hand side of (2.7), substituting xwith ⌊x⌋+ 1 and then taking logarithms, we obtain ⌊x⌋+ 1 >log (f(⌊x⌋+ 1) −1)+C log α+β√D(2.10) where C= log 2√D 1 + √D!. Since fis strictly increasing, f(⌊x⌋+ 1) > f (x)≥ ⌊f(x)⌋. Since f(⌊x⌋+ 1) and ⌊f(x)⌋are integers, the strict inequality f(⌊x⌋+ 1) > ⌊f(x)⌋implies f(⌊x⌋+ 1) ≥ ⌊f(x)⌋+ 1. Therefore, (2.10) becomes ⌊x⌋+ 1 >log (⌊f(x)⌋)+C log α+β√D.(2.11) By (2.9) and (2.11), we conclude that ⌊x⌋= log (⌊f(x)⌋)+C log α+β√D . Finally, replacing xwith g(x) := f−1(x), we obtain (2.5). Since Equation (2.6) follows from Equation (2.5), it remains to show that µ(x) = 0 if and only if x∈ {f(0), f(1), f(2), . . .}. First suppose that µ(x) = 0. Then by (2.6), we have g(x) = f−1(x)∈Z≥0, which implies that x∈ {f(0), f(1), f(2), . . .}. Conversely, if x∈ {f(0), f(1), f(2), . . .}, then g(x)∈Z≥0. By (2.6), it follows that µ(x) = 0.
INTEGERS: 25 (2025) 8 By combining Theorem 2.1 and Theorem 2.3, we may conclude the following consequence. Corollary 2.4. Consider the set FDas defined in (1.2). Then for any real number λ>0, QFD(λ) = ∅if λ<1 [ i,j∈{1,−1} (iu(x), jv(x)) ∈Z2:x∈Z≥0, x ≤ log (⌊λ⌋)+C log α+β√D if λ≥1, where C= log 2√D 1 + √D!is a positive real constant. This implies |QFD(λ)|= 0if λ<1 2+4 log (⌊λ⌋)+C log α+β√D if λ≥1. 3. Further Results The Pell equation (1.1) can be written as (x−0)2−D(y−0)2= 1, which is the Pell equation centered at the origin. More generally, for any fixed a, b ∈Z, we consider the shifted Pell equation, (x−a)2−D(y−b)2= 1.(3.1) As an analogue to (1.2), we define the set F(a,b) Das the set of integer solutions to Equation (3.1), i.e., F(a,b) D:= n(x, y)∈Z2: (x−a)2−D(y−b)2= 1o.(3.2) Then, by Proposition 1.2, we obtain the result F(a,b) D=[ i,j∈{1,−1}(iu(x)+a, jv(x) + b)∈Z2:x∈Z≥0,(3.3) where uand vare the functions as defined in (1.3) and (1.4), respectively. Similarly to the case of integer solutions, the set of real solutions to Equation (3.1) is given by [ i,j∈{1,−1}(iu(x)+a, jv(x) + b)∈R2:x∈R, x ≥0.(3.4)
INTEGERS: 25 (2025) 9 For simplicity, denote each real solution in the set (3.4) by Ri,j(x) := (iu(x) + a, jv(x)+b).(3.5) Notice that the x-intercepts and y-intercepts of Equation (3.1) are a±√1+Db2,0and 0, b ±ra2−1 D!, respectively (there is no y-intercept if a= 0). For any k∈ {1,2,3,4}, let Hkdenote the set of all real pairs in the k-th quadrant of the real plane, including the boundary axes. The following proposition describes the location of the real solutions Ri,j(x) in the real plane for all sufficiently large x≥0. Proposition 3.1. Let Ri,j (x)be a real solution as defined in (3.5). Then R1,1(x)∈ H1,R−1,1(x)∈ H2,R1,−1(x)∈ H3, and R−1,−1(x)∈ H4for all sufficiently large x≥0. Proof. We prove this for a, b ≥0, as the proofs when a<0 or b<0 are very similar. It follows that R1,1(x)∈ H1for all x∈[0,∞). For the case of a>0, there exist x-intercepts and y-intercepts to the Equation (3.1). In particular, there exist p, q, r ∈[0,∞) such that 1. R−1,1(p) = 0, b +ra2−1 D!∈ H2, 2. R−1,−1(q) = 0, b −ra2−1 D!if 0, b −ra2−1 D!∈ H3 a−√1+Db2,0if a−√1+Db2,0∈ H3, and 3. R1,−1(r) = a+√1+Db2,0∈ H4. Since the functions uand vare strictly increasing, this implies that R−1,1(x)∈ H2 for all x∈[p, ∞), that R−1,−1(x)∈ H3for all x∈[q, ∞), and R1,−1(x)∈ H4for all x∈[r, ∞). For the case of a= 0, we have R−1,1(x)∈ H2for all x∈[0,∞). There exist x-intercepts (but no y-intercept) to the Equation (3.1). By similar argument, there exist q, r ∈[0,∞) such that R−1,−1(x)∈ H3for all x∈[q, ∞) and R1,−1(x)∈ H4 for all x∈[r, ∞). The following proposition helps establish the setting of Theorem 3.3. Proposition 3.2. Let a= 0. Then |a|+p1+Db2= max (a±p1+Db2, b±ra2−1 D).