A p-adic Euclidean Algorithm Cortney Lager Winona State University October 0, 009 Introduction The rational numbers can be completed with respect to the standard absolute value and this produces the real numbers However, there are other absolute values on the rationals besides the standard one Completing the rationals with respect to one of these produces the p-adic numbers In this paper, we take some basic number theory concepts and apply them to rational p-adic numbers Using these concepts, a p-adic division algorithm is developed along with a p-adic Euclidean Algorithm These algorithms produce a generalized greatest common divisor in the p-adics along with a p-adic simple continued fraction In Section, we describe the p-adic numbers, and in Section 3 we present our p- adic Division Algorithm and Euclidean Algorithm In Section 4, we show some applications, including a connection to Browkin s p-adic continued fractions, which motivatored our investigations in the first place Finally, in Section 5, we give some open questions for further study p-adic Numbers Since we will use different absolute value functions in this paper, to avoid confusion we will denote the standard absolute value as rather than For each prime p there exists an absolute value on the rationals p : Q Q defined by a = p v(b) v(a) b p where v(n) is the number of times p divides the integer n Also 0 p = 0 This is called a p-adic absolute value, and in the context of measuring the size of a number (ie its distance to zero), it states that the more a rational number is divisible by p, the smaller it is For example, 6 3 = 3 4 < 5 7 = 3 3 3 So 6 is smaller than 5 7 in the 3-adics
Completing the rationals with respect to the p-adic absolute value yields Q p, the p-adic numbers Let p be an odd prime for the remainder of the paper Then there are a few different ways to think about p-adic numbers ([],[3], [4], [5]) but for the purposes of this paper we will consider them in the following way Definition An element ζ Q p is a Laurent series in the odd prime p, ζ = c j p j = c m p m + c m+ p m+ + c m+ p m+ + () j=m where m is a (possibly negative) integer and c j { p,, p } Note that in the standard absolute value, the p-series in () would only converge if it had a finite number of terms However, under the p-adic absolute value, each term is in fact getting smaller, and it can be shown [3] that all such infinite Laurent series in p converge under the p-adic absolute value It s also worth noting that the rational numbers are a subset of the p-adics, although they are slightly disguised For example, / in the 7-adics is given by the power series 4 + 3 7 + 3 7 + 3 7 3 + Since the geometric series test still applies to the p-adic absolute value and to convergence in Q p, then it gives the following, ( ) 4 + 3 7 + 3 7 + 3 7 3 + = + 3 = 7 For the remainder of the paper we will use the fractional representation instead of the p-series for rationals elements of Q Q p Using the notation in (), we can define v(ζ) = m, thus ζ p = p m Further, every ζ Q p \{0} can be written as ζ = up ɛ, where ɛ = v(ζ) and u p = We also have the standard properties of a non-archimedean norm: ζ ζ p = ζ p ζ p and ζ + ζ p max( ζ p, ζ p ) The non-archimedean triangle inequality gives equality if ζ p ζ p 3 The p-adic Division Algorithm and Euclidean Algorithm Both the division algorithm and the Euclidean algorithm are elements of classical number theory With the goal of recreating the real aspects of classical number theory in the p-adics, we now re-invent these two important classical ] = { m p k algorithms Let Z [ p m, k Z addition and multiplication; in fact, it is a subring of Q } Notice that Z [ is closed under
Theorem (p-adic Division Algorithm) Let p be an odd prime Then given any σ and τ Q p where τ 0, there exists uniquely q Z [ with q < p, and η Q p with η p < τ p such that σ = qτ + η Proof If σ p < τ p, then let q = 0 and η=σ Otherwise, write σ=sp v(σ), τ=tp v(τ) where s p = t p = Let q = qp v(σ) v(τ), where q Z such that q st mod p v(τ) v(σ)+ and q < p v(τ) v(σ)+ / Then q < p Then let η = spv(σ) qtp v(τ) = (s qt)p v(σ) Thus, v(τ) + v(η) and therefore η p < τ p To prove uniqueness, suppose σ = τq + η = τq + η where q = m p k, and q = m p k Then, τ(q q ) = η η Thus, τ p q q p = τ(q q ) p = η η p max( η p, η p ) < τ p, which implies that p q q = m m Thus, p k+ m m However, since p k q q < p, then m m < p k+ Hence, m = m, q = q, and η = η Note in the proof of Theorem that if q 0, then in fact p q, and therefore v(q) = v(σ) v(τ) 0; that is q p Since we now have a division algorithm in the p-adics, we can iterate the process in a way similar to the classical Euclidean Algorithm Definition (p-adic Euclidean Algorithm) Let p be an odd prime The p-adic Euclidean Algorithm applied to σ and τ Q p and where τ 0 is as follows First, apply Theorem to σ and τ to produce σ = q τ + η () In each subsequent step shift to the left and apply Theorem again, τ = q η + η η = q 3 η + η 3 η i = q i η i + η i (3) This process either continues indefinitely or stops when η i = 0 The outputs of this algorithm are the sequences {q i } and {η i } When appropriate we will consider the inputs as σ = η and τ = η 0 3
Example The 7-adic Euclidean Algorithm applied to 865 and 0555 yields ( ) 0555 ) ( 9360 = () + 7 ( ) ( ) ( ) 9360 5 = 7 7 + 7 ( ) ( ) ( ) 0 5 5 7 + 7 74 ( ) ( ) ( ) 50 5 5 7 = 7 74 + 75 ( ) ( ) 5 7 75 + 0 865 0555 9360 7 = 5 5 74 = The algorithm stops since η 5 = 0 The outputs are the sequences { {q i } =, 7, 0 7, 50 7, } 7 and {η i } = { 9360 7, 5 7, 5 74, 5 } 75 Lemma Let η i be the outputs from the p-adic Euclidean Algorithm of σ = a b pv(σ) Q, τ = c d pv(τ) Q when a b and c d are in lowest terms Then lcm(b, d) η i Z [ Proof Let l = lcm(b, d) From multiplying through by l in (), la b pv(σ) = q lc d pv(τ) + lη Since la b pv(σ), q lc d pv(τ) Z [ ] p then lη Z [ Then, inductively lη i = q i lη i + lη i [ with lη i, q i lη i Z [ Thus, lηi Z Theorem Let p be an odd prime and σ, τ Q with τ 0 Then the p-adic Euclidean Algorithm applied to σ and τ has a finite number of steps Proof For all i such that q i, η i 0, write η i = h i p ɛ i and q i = c i p δ i where ɛ i = v(η i ), δ i = v(q i ), and h i p = c i p = Then we have the following (i) By Theorem and the note afterwards, v(q i ) = v(η i ) v(η i ) Thus δ i = ɛ i ɛ i (ii) Also, ɛ i ɛ i + which implies ɛ i > ɛ i, and p ] 4
(iii) c i < p δ i since c i p δ i < p Then by (3), h i = p ɛi ɛi (h i c i h i ), where h i, c i Q Q p, and therefore h i p ɛi ɛi ( h i + c i h i ) by the Triangle Inequality < p ɛ i ɛ i ( h i + p δ i h i ) by (iii) = p ɛi ɛi ( h i + p+ɛi ɛi h i ) by (i) = p ɛ i ɛ i h i + p ɛ i+ɛ i h i < h i + h i by (ii) Thus, h i < h i + h i Now consider the sequence { h i + h i } of positive rational numbers From the previous inequality, h i + h i < h i + h i Therefore, h i + h i is decreasing If σ = a b pv(σ) and τ = c d pv(τ), and l = lcm(b, d), then, by the Lemma, l h i + l h i Z Therefore, l h i +l h i = 0 for some finite i and thus the p-adic Euclidean Algorithm has a finite number of steps for rational inputs 4 Applications of the p-adic Euclidean Algorithm 4 Greatest Common Divisor Recall the following definition Definition 3 Let a, b Z, not both zero Then the greatest common divisor, or gcd, of a and b is the unique positive integer g = gcd(a, b) that satisfies the following properties (i) a g, b g Z, and (ii) if there exists f Z with a f, b f Z, then g f Z We can extend the definition of the gcd to t, s Q, where t = a b and s = c d are in lowest terms, by setting gcd(t, s) = gcd(a, c) lcm(b, d) This satisfies the properties that if g = gcd(t, s) then t g, s g Z and if there exists f Q with t g, s g Z, then g f Z Recall that the classical Euclidean Algorithm applied to integers a and b computes gcd(a, b) as the last non-zero remainder The p-adic Euclidean Algorithm produces a similar computation 5
Theorem 3 Let nonzero σ, τ Q Q p, with σ = sp v(σ), τ = tp v(τ) Suppose the p-adic Euclidean Algorithm applied to σ and τ stops after k steps and let η i = h i p v(ηi) Then h k = gcd(t, s) Proof Since η k = q k η k then n k η k = q k Z [ ] p and thus, h k h k Z Then, proceeding inductively backwards through the p-adic Euclidean Algorithm, Hence, η k i η k = q k i η k i η k s h k = h h k Z and + η k i η k Z [ p ] t h k = h 0 h k Z Now suppose f Q such that t f, s f Z Note that v(f) 0, since v(s) = v(t) = 0, then h p v(η ) = t s f f pv(τ) q f pv(σ) Z [ ] p Thus, h f Z Then again, inductively h k f Z Our previous example of the p-adic Euclidean Algorithm shows that ( 5 865 =, 0555 ) Although this computation may seem trivial when the rational numbers are presented as fractions, all calculations in the p-adic Euclidean algorithm are amenable to elements of Q p expressed as in () 4 Simple Continued Fractions In addition to the gcd, the classical Euclidean Algorithm also computes the simple continued fraction form of a b : a b = q + q + q 3 + = [q, q, q 3, ] where q i Z are the quotients obtained during the Euclidean algorithm In [] Browkin defined a simple continued fraction form of a p-adic number, ζ, as follows: ζ = b + = [b, b, b 3, ] b + b 3 + where b i Q with b i < p The following summarizes Browkin s method 6
For ζ with v(ζ) = m as in () define π(ζ) = { 0 if m > 0 0 j=m c jp j otherwise Theorem 4 (Browkin) Let ζ Q p \{0}, and let ζ = ζ For i, let b i = π(ζ i ), ζ i+ = (ζ i b i ) until ζ i b i = 0, then ζ = [b, b, b 3, ] The following theorem relates Browkin s method to the p-adic Euclidean Algorithm In fact, our proof of Theorem was strongly motivated by the stopping theorem in [] Theorem 5 Let ζ Q p \{0}, and let {q i } be the outputs of the p-adic Euclidean Algorithm applied to ζ and Then ζ = [q, q, q 3, ] Proof It suffices to show q i = b i However, we will also prove that ζ i = η i η i We proceed by induction In the base case, ζ = ζ = ζ = η η 0 Now, let ζ be as in (), then 0 0 0 ( b = c j p j p c j p j j=m j=m j=m ( ) 0 p = j=m ) p j p j = p p p m p < p Also, ζ b p = ζ π(ζ ) p < = p Then since ζ = b +(ζ b ), by the uniqueness of the p-adic division algorithm, b = q In the inductive case, assume q i = b i and ζ i = η i η i Then, Thus, ζ i+ = η i n i Now consider (ζ i+ ) = ζ i b i = η i η i q i = η i q i η i η i = η i η i η i = b i+ η i + (η i b i+ η i ) Using the same logic from the base case, b i+ < p, and η i b i+ η i p = η i p ζ i+ b i+ p < η i p Thus, by the uniqueness of the p-adic division algorithm b i+ = q i+ Therefore, q i = b i, and by Theorem 4, ζ = [q, q, q 3, ] 7
Using the theorem in our previous example computes that 865 0555 = + 7 + 0 7 + 50 7 + 7 Even though the p-adic Euclidean Algorithm and Browkin s method produce the same results, the p-adic Euclidean Algorithm is computationally quicker since performing the p-adic division algorithm only requires an inversion modulo a prime power Further Theorem 5 tells us exactly under what conditions the p-adic Euclidean Algorithm terminates Corollary For σ, τ Q p, τ 0, the p-adic Euclidean Algorithm terminates in a finite number of steps if and only if σ/τ Q 5 Open Questions The following questions concerning the techniques discussed in this paper remain open to the authors How does the sequence {η i } from the computation (σ, τ) relate to the sequence {η i } from computing (τ, σ)? Examples quickly show that they are not always related in the simple way the remainders are in the classical case Do we have to use the modular representatives { p p } or would another set of representatives also work? Again, small examples will show that if we choose {0,, p } as the set of representatives, the p-adic Euclidean Algorithm applied to two rational numbers may not terminate In a more general setting, do the representatives depend on the choice of uniformizer for the local field? In the classical setting the division algorithm leads to modular arithmetic Is there a similar theory to come from the p-adic division algorithm? Lastly, as is always the case, an analagous theory remains to be worked out in the -adics Acknowledgements: The author would like to thank Erica Fremstad, another Winona State University student, who also worked on the independent study, Dr Eric Errthum for his mentorship throughout this project, and the anonymous reviewer for the many helpful comments 8
References [] Browkin, J Continued Fractions in Local Fields, Demonstratio Mathematica, 978 [] Gouvea, F p-adic Numbers: An Introduction, Universitext, Springer- Verlag, Berline, 993 [3] Koblitz, B p-adic Numbers, p-adic Analysis, and Zeta-Functions, Springer- Verlag, 984, nd ed [4] Rotman, J Advanced Modern Algebra, Prentice Hall, 00 [5] Serre, J-P A Course in Arithmetic, Springer, 973 9