Quantum Algorithm for Solving Pell's Equation
Total Page:16
File Type:pdf, Size:1020Kb
CS682 Project Report Hallgren's Efficient Quantum Algorithm for Solving Pell's Equation by Ashish Dwivedi (17111261) under the guidance of Prof Rajat Mittal November 15, 2017 Abstract In this project we aim to study an excellent result on the quantum computation model. Hallgren in 2002 [Hal07] showed that a seemingly difficult problem in classical computa- tion model, solving Pell's equation, is efficiently solvable in quantum computation model. This project explains the idea of Hallgren's quantum algorithm to solve Pell's equation. Contents 0.1 Introduction..................................1 0.2 Background..................................1 0.3 Hallgren's periodic function.........................3 0.4 Quantum Algorithm to find irrational period on R .............4 0.4.1 Discretization of the periodic function...............4 0.4.2 Quantum Algorithm.........................5 0.4.3 Classical Post Processing.......................7 0.5 Summary...................................8 0.1 Introduction In this project we study one of those problems which have no known efficient solution on the classical computation model and are assumed hard to be solved efficiently, but in recent years efficient quantum algorithms have been found for them. One of these problems is the problem of finding solution to Pell's equation. Pell's equation are equations of the form x2 − dy2 = 1, where d is some given non- square positive integer and x and y are indeterminate. Clearly, (1; 0) is a solution of this equation which are called trivial solutions. We want some non-trivial integer solutions satisfying these equations. There is no efficient algorithm known for solving such equations on classical compu- tation model. But in 2002, Sean Hallgren [Hal07] gave an algorithm on quantum compu- tation model which takes time only polynomial in input size (log d). Our main reference is the paper by Hallgren "Polynomial-Time Quantum Algorithms for Pell's Equation and the Principal Ideal Problem". We also refer to an excellent article by R. Jozsa [Joz03] which contains all necessary background for Hallgren's paper and a classical survey article by H. W. Lenstra [LJ02]. 0.2 Background Given a square free integer d, the equation x2 − dy2 = 1 is known as Pell's equation. We look for its non-trivial positive integer solutions. This equation name has nothing to do with John Pell (1611-85). It was a mistake by Euler (1707-1783) who mistakenly attributed to Pell for the work of Brounckner (1620-1684). This problem has a 2000 yr long history (Greece and India). Brahmgupta (approx. 1000 AD) gave a method to solve Pell's equation known as "Chakravala Method". At the time of Pythagoras 1 these equations were used to approximate the square root of 2. Later Lagrange (1736- 1813) proved that this equation has a solution for every such d and in fact there are infinitelyp many solutions. He also showed that only the smallest solution to Pell's equation x1 + y1 d can give all other solutions to Pell's equation. Since the smallest solution generates all other solutions we only need to find the smallest solution for these equations. The problem is that fundamental solution for different ds are distributed very unevenly and can be exponentiallyp large. In fact, Lenstra [LJ02] mentioned in the survey that there is an upper bound O(e d) on the magnitude of the smallestp solution to the Pell's equation. So even to write down the smallest solution takes O( d) bits which is exponential in size of the solution. p So, we introduce a term, called Regulator, defined as R := ln(x1 + y1 d). Now, our task is to find the irrational number R to sufficient amount of precision.p The survey [LJ02] mentions that the best known classical algorithm to find R takes O(e logdpoly(n)) time assuming GRH. The idea of Hallgren's algorithm has two parts: • Classical Part: Setup a periodic function h(x), x 2 R s.t. Period of h is the regulator R. h(x) should be efficiently computable, i.e. for x accurate to n decimal digit, computing h(x) should take poly(log x; log d; n) time. This task is totally classical, which reduces the task of solving Pell's equation to finding period (irrational) of an efficiently computable function. • The quantum part generalises the standard period finding algorithm to finding irrational periods. To define such a periodic function, we need to have some background in algebraic number theory. Since putting everything here is not possible we refer reader to see the article by Jozsa [Joz03] which contains sufficient background. We will try to give informal definition of algebraic objects as we will use them and will also state their properties which will be required in construction of the periodicp function h. p The quadratic number field is the set Q[ d] = fa + b d j a; b 2 Qg. Thep ring of polynomials Z[x] is the set of all integer polynomials. Algebraic integers α 2 Q[ d]p are roots of an integer monic polynomial f 2 Z[x]. O is set of all algebraic integers of Q[ pd]. Units of O are elements in O that they have multiplicative inverses. Any element x+y d 2 2 of O is a unit iff x − dy = ±1. Smallest unit 0 > 0 is called fundamental unit. It is the k property of the units that any unit is is power of the fundamental unit ±0 . Hence, to solve Pell's equation we onlyp need to find 0. Take R = ln(0). Ideals of O are I ⊂ Q[ d]p s.t I:O = I. An integral ideal I is a subset of O.A fractional ideal I is a subset Q[ d]. An ideal I is called principal ideal if I ⊂ γO.A property of two principal ideals αO and γO is that αO=γO iff γ = α for a unit . This follows by the fact that O=O. We can use this property of principal ideals to define a periodic function whose period is R. Let P be the set of all principal ideals. Define a periodic function h : R ! P as h(x) = exO Here principal ideals γO are being considered as function of x = ln(γ). Clearly the period of this function is R = ln(0). 2 But we are not done. We want our function h to be efficiently computable. The way h has been defined has some problems.We will need to check if two ideals are same. The arithmetic operations needed to check ex = e(x+R) would require exponential time. Also we have infinitely many distinct ideals in O for every α, so identification of ideal αO may need full precision of α. We need to have some effective notion of checking equality (almost) for two ideals. Two circumvent these difficulties we will use the concept of reduced ideals. Again we will not give complicated definition of reduced ideals. We will just state some properties of these ideals and some algebraic operations defined on them. Assuming all these we will be able to understand how function h is defined and why it will be efficiently computable and periodic with period R. Reduced ideals are special principal ideals. The set of all reduced ideals RI = fJ ;J ;:::;J g of O is a finite set whose size is exponential in log d. Each reduced 0 1 k0−1 p ideal has a definition completelyp depending on pair of integers 0 ≥ a; b < D, where D is the discriminant of Q[ d]. Hence reduced ideals have poly(log d) size description, which is great. The set RI forms a principal cycle of length R, the regulator. There is a distance function defined for reduced ideals δ. If I = αO then δ(I) = lnjαj mod R. δ(I) is distance of I from O. O has distance 0. δ is also defined for two ideals Ji = αiO and jαij Jk = αkO as δ(Ji;Jk) = ln( ) mod R. jαkj For a reduced ideal I = Z + γZ, define ρ(I) = 1/γI. ρ acts as a movement operator for reduced ideals. ρ(I) is again principal for principal ideal I. If J is reduced then ρ(J) is next reduced ideal in the principal cycle. ρ(I) repeatedly gives reduced ideal I0 in poly number of steps. Similar to pρ an operatorp σ is defined which is like step back operator. σ(I) conjugates I, i.e. takes D ! − D. It comes out that ρ−1 = σρσ. So using ρ and σ we can move back and forth among reduced ideals. Distance function has more properties. Distance function δ for I1 = γI2 is defined as x δ(I1;I2) = ln(γ) mod R. Distance from O of e O is δ(O) = x mod R. It allows ordering of ideals along number line. δ(I; ρ(I)) is efficiently computable. spacing of Ji and Ji+1 has lower bound 3=32D and upper bound 1=2ln(D). Distance between Ji and Ji+2 is ≥ ln2. For non-reduced I, jδ(I;Ired)j ≤ lnD, and Ired 2 fJk−1;Jk;Jk+1g. We also have jump operator to cover exponential distance between two ideals in poly time. Jump operator is ∗. Jumping is defined using product of two ideals δ(I1:I2) = δ(I1) + δ(I2) without mod R. 0.3 Hallgren's periodic function Now we will define our periodic function h whose period is regulator R. We define h : R ! RI × R as, h(x) = (Ix; x^ − δ(Ix)) Where Ix is the nearest reduced principal ideal to the left of x andx ^ = x mod R so 0 ≤ x^ < R.