Continuants and some decompositions into squares
aa r X i v : . [ m a t h . N T ] A ug CONTINUANTS AND SOME DECOMPOSITIONS INTOSQUARES
CHARLES DELORME AND GUILLERMO PINEDA-VILLAVICENCIO
Abstract.
In 1855 H. J. S. Smith [8] proved Fermat’s two-squaretheorem using the notion of palindromic continuants. In his paper,Smith constructed a proper representation of a prime number p as asum of two squares, given a solution of z +1 ≡ p ), and viceversa. In this paper, we extend the use of continuants to properrepresentations by sums of two squares in rings of polynomialsover fields of characteristic different from 2. New deterministicalgorithms for finding the corresponding proper representations arepresented.Our approach will provide a new constructive proof of the four-square theorem and new proofs for other representations of integersby quaternary quadratic forms. Introduction
Fermat’s two-square theorem has always captivated the mathemat-ical community. Equally captivating are the known proofs of sucha theorem; see, for instance, [4, 5, 8, 21, 39, 53]. Among these proofswe were enchanted by Smith’s elementary approach [8], which is wellwithin the reach of undergraduates. We remark Smith’s proof is verysimilar to Hermite’s [21], Serret’s [39], and Brillhart’s [5].Two main ingredients of Smith’s proof are the notion of continuant(Definition 2 for arbitrary rings) and the famous Euclidean algorithm.Let us recall here, for convenience, a definition taken from [25, pp. 148]
Definition 1.
Euclidean rings are rings R with no zero divisors whichare endowed with a Euclidean function N from R to the nonnegativeintegers such that for all τ , τ ∈ R with τ = 0 , there exists q, r ∈ R such that τ = qτ + r and N( r ) < N( τ ) . Among well-known examples, we are going to use the integers withN( u ) = | u | , and polynomials over a field with N( P ) = 2 degree( P ) andN(0) = 0. Date : October 19, 2018.2000
Mathematics Subject Classification.
Primary 11E25, Secondary 11D85,11A05.
Key words and phrases.
Fermat’s two-square theorem; four-square theorem; con-tinuant; integer representations.
Definition 2 (Continuants in arbitrary rings, [17, Sec. 6.7]) . Let Q bea sequence of elements ( q , q , . . . , q n ) of a ring R . We associate with Q an element [ Q ] of R via the following recurrence formula [ ] = 1 , [ q ] = q , [ q , q ] = q q + 1 , and [ q , q , . . . , q n ] = [ q , . . . , q n − ] q n + [ q , . . . , q n − ] if n ≥ . The value [ Q ] is called the continuant of the sequence Q . A sequence ( q , q , . . . , q n ) of quotients given by the Euclidean algo-rithm on τ and τ , with τ and τ in R , is called a continuant repre-sentation of ( τ , τ ) as we have the equalities τ = [ q , q , . . . , q n ] h and τ = [ q , . . . , q n ] h unless τ = 0. If τ = 0, then h is a gcd of ( τ , τ ),else h = τ ; in other words Rτ + Rτ = Rh , where Rτ denotes the leftideal generated by τ .Continuants have prominently featured in the literature. For com-mutative rings many continuant properties are given in [17, Sec. 6.7],while for non-commutative rings a careful study is presented in [44]. Forapplications of continuants to representations of integers by quadraticforms, see [4,5,20,45,46]. In all these papers, continuants have featuredas numerators (and denominators) of continued fractions. For instance,the continuant [ q , q , q ] equals the numerator of the continued fraction q + 1 q + 1 q , while the continuant [ q , q ] equals its denominator.Let p be a prime number of the form 4 k + 1. Smith’s approach [8] re-lies on the existence of a palindromic sequence Q = ( q , . . . , q s , q s , . . . , q )of even length such that p = [ Q ]. He then derives a solution z for z + 1 ≡ p ) with 2 ≤ z ≤ p/
2, namely [ q , . . . , q s , q s , . . . , q ].On the other hand, from z one can retrieve the palindromic sequenceby applying the Euclidean algorithm to p and z , and then p = x + y where x = [ q , . . . , q s ] and y = [ q , . . . , q s − ].With regards to the question of finding square roots modulo a prime p , a deterministic algorithm can be found in [38]. The paper [43] alsodiscusses the topic.Brillhart’s optimisation [5] on Smith’s construction took full advan-tage of the palindromic structure of the sequence( q , . . . , q s − , q s , q s , q s − , . . . , q )given by the Euclidean algorithm on p and z , a solution of z + 1 ≡ p ). He noted that the Euclidean algorithm gives the remainders r i = [ q i +2 , . . . , q s − , q s , q s , q s − , . . . , q ] ( i = 1 , . . . , s − r i = [ q s − − i , . . . , q ] ( i = s − , . . . , s − r s − = [ ] , and r s = 0 . ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 3 so, in virtue of Smith’s construction, rather than computing the wholesequence we need to obtain ( x = r s − = [ q s , q s − , . . . , q ] y = r s = [ q s − , . . . , q ] . In this case, we have y < x < √ p , Brillhart’s stopping criterium.1.1. Previous extensions of Fermat’s two-square theorem toother rings.
The question of extending Fermat’s two-square theoremto other rings has been extensively considered in the literature; see, forinstance, [7, 15, 16, 19, 23, 27, 33, 35].Quadratic fields have naturally received much attention. Niven [35]considered imaginary quadratic fields and studied the problem of ex-pressing an integer a +2 b √− h as a sum of two squares of integers in thefield. Alternative proofs for the case of Gaussian integers (i.e. h = 1)appeared in [28, 34, 52]. The number of representations of non-zeroGaussian integers as sums of two Gausssian integers was obtained byPall [36], and later by Williams [48, 50]. Elia [15] proved that a totallypositive integer m in Q ( √ ) is a sum of two squares iff in the primedecomposition of m each of its prime factors of field norm congruentto 11 ,
19 modulo 20 occurs with an even exponent. An integer in aquadratic field is called totally positive if it and its conjugate are pos-itive. Later, Elia and Monico [16] obtained a similar result for totallypositive integers in Q ( √ Q ( √ ) and proved that a prime with − Q ( √ ).Many results in this area rely on theorems about binary quadraticforms. For instance, Niven’s proof of the aforementioned result heavilydepends on a theorem by Mordell [33]. In [33] Mordell gave necessaryand sufficient conditions for a positive binary quadratic form ax +2 hxy + by with integral coefficients to be representable as a sum ofthe squares of two linear forms a x + b y and a x + b y with integralcoefficients. The number of representations of ax + 2 hxy + by inthe aforementioned manner was given in [36, 51]. Mordell’s result wassubsequently extended by Hardy [19] to forms with Gaussian integersas coefficients. See also [29, 30, 49].Polynomial rings have also attracted much attention. Hsia [23] stud-ied the representation of cyclotomic polynomials as the sum of twosquares in K [ X ], where K is an algebraic field. Leahey [27] proved atheorem in the same vein as Fermat’s two-square theorem for polyno-mials in F [ X ], where F is a finite field of characteristic different from 2and − F . Leahey’s theorem reads as follows: CHARLES DELORME AND GUILLERMO PINEDA-VILLAVICENCIO
Theorem 3 ( [27]) . Let m ∈ F [ X ] be a monic polynomial, then anyassociate of m is a sum of two squares iff in the prime decomposition of m each of its prime factors of odd degree occurs with an even exponent. Perhaps one of the most important extensions of Fermat’s two-squaretheorem was given by Choi, Lam, Reznick and Rosenberg [7]. In [7]Choi et al. proved the following theorem.
Theorem 4 ( [7, Thm. 2.5]) . Let R be an integral domain, F R its fieldof fractions, − h a non-square in F R and R [ √− h ] the smallest ringcontaining R and √− h .If both R and R [ √− h ] are unique factorisation domains, then thefollowing assertions hold. (1) Any element m ∈ R representable by the form x ′ + hy ′ with x ′ , y ′ ∈ F R is also representable by the form x + hy with x, y ∈ R . (2) Any element m ∈ R representable by the form x + hy canbe factored into p · · · p k q · · · q l , where p i , q j are irreducible ele-ments in R and q j is representable by x + hy for all j . (3) An associate of a non-null prime element p ∈ R is representableby x + hy iff − h is a square in F R/Rp , where F R/Rp denotesthe field of fractions of the quotient ring
R/Rp . Our work.
In this paper we study proper representations x + y (that is, with x and y coprime) in some Euclidean rings via continuants.Specifically, we concentrate on the following problems. Below a unit inthe ring is denoted by u . Problem 5 (From x + y to z + 1) . If m = u ( x + y ) and x, y are coprime, can we find z such that z + 1 is a multiple of m usingcontinuants? Problem 6 (From z + 1 to x + y ) . If m divides z + 1 , can we find x, y such that m = u ( x + y ) using continuants? As far as we know, this paper presents for the first time the appli-cation of continuants to representations in Euclidean rings other thanthe integers. Specifically, we present the following new deterministicalgorithms for the form Q ( x, y ) = x + y .(1) Algorithm 1: for every m in a commutative Euclidean ring, itfinds a solution z of Q ( z, ≡ m ), given a representa-tion uQ ( x, y ) of m .(2) Algorithm 2: for every polynomial m ∈ F [ X ], where F is a fieldof odd characteristic, it finds a proper representation uQ ( x, y )of m , given a solution z of Q ( z, ≡ m ).As an application of continuants, we provide a new constructive proofof the four-square theorem (Section 4). Many proofs of this theorem ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 5 can be found in the literature; see, for instance, [18, Sec. 20.5, 20.9,20.12] and [1, 3, 22, 40, 41].Furthermore, we use continuants to prove a number of other resultsabout quaternary forms which represent all integers (Section 5).From the outset we emphasise that Smith’s approach heavily dependson the existence of a Euclidean-like division algorithm and that, if onetries to extend it to other Euclidean rings R , the uniqueness of thecontinuant representation may be lost. The uniqueness of the contin-uant representation boils down to the uniqueness of the quotients andthe remainders in the division algorithm. This uniqueness is achievedonly when R is a field or R = F [ X ], the polynomial algebra over afield F (considering the degree as the Euclidean function) [26]. Notethat in Z the uniqueness is guaranteed by requiring the remainder tobe nonnegative.The rest of the paper is structured as follows. In Section 2 we studyproperties of continuants in arbitrary rings. Section 3 is devoted tostudying proper representations x + y in some Euclidean rings. Weexamine later some representations xx + yy using rings with an anti-automorphism x x (Sections 4 and 5).2. Continuants
In this section we derive some properties of continuants from Defini-tion 2, which we will refer to as continuant properties. Many of theseproperties are already known; see [17, Sec. 6.7] and [44].P–1 The first property is the so-called “Euler’s rule” [10, pp. 72]:Given a sequence Q , compute all the products of subsequencesof Q obtained by removing disjoint pairs of consecutive elementsof Q . Then the continuant [ Q ] is given by the sum of all suchproducts. The empty product is 1, as usual. Example 7.
Consider Q = ( q , q , q , q , q ) . Then the productsof relevant subsequences are: q q q q q , q q q , q q q , q q q , q q q , q , q , and q . Thus, the continuant is [ Q ] = q q q q q + q q q + q q q + q q q + q q q ++ q + q + q . P–2 If in a ring R we find a unit τ commuting with all q i ’s, then[ τ − q , τ q , . . . , τ ( − k q k , . . . , τ ( − n q n ] = ( [ q , . . . , q n ] if n even τ − [ q , . . . , q n ] if n oddP–3 [ q , . . . , q n ] = [ q , . . . , q i − ][ q i +2 , . . . , q n ]+[ q , . . . , q i ][ q i +1 , . . . , q n ].To obtain this equality, it suffices to divide the products of sub-sequences of Q = ( q , q , . . . , q n ) obtained by removing disjointpairs of consecutive elements of Q into two groups, depending CHARLES DELORME AND GUILLERMO PINEDA-VILLAVICENCIO on whether the pair q i q i +1 (1 ≤ i < n ) has been removed ornot.P–4 From the previous points it follows[ − q h , − q h − , . . . , − q , , q , q , . . . , q n ] = [ q h +2 , q h +3 , . . . , q n ] for 0 ≤ h ≤ n −
21 if h = n −
10 if h = n P–5 [ q , . . . , q n ] and [ q , . . . , q n − ] are coprime.From Properties P–2 and P–4, we can derive more identities, forinstance, the following.P–6 [ − q n − , . . . , − q , q , . . . , q n ] + [ − q n − , . . . , − q ][ q , . . . , q n ] = 1.P–7 Property P–6 is equivalent to[ − q n − , . . . , − q ][ q , . . . , q n ] + [ − q n − , . . . , − q ][ q , . . . , q n ] = 1 , which is in turn equivalent to[ q n − , . . . , q ][ q , . . . , q n ] − [ q n − , . . . , q ][ q , . . . , q n ] = ( − n This last property first appeared in Theorem 3 of [44], where othervariants were also presented.If the ring R is commutative, then we have some additional proper-ties.P–8 [ q , q , . . . , q n ] = [ q n , . . . , q , q ].P–9 The continuant [ q , . . . , q n ] is the determinant of the tridiagonal n × n matrix A = ( a ij ) with a i,i = q i for 1 ≤ i ≤ n , a i,i +1 = 1and a i +1 ,i = − ≤ i < n .The following identity, due to Lewis Carroll (alias Charles LutwidgeDodgson), plays an important role in our study of continuants. Lemma 8 (Lewis-Carroll’s identity, [14]) . Let C be an n × n matrix ina commutative ring. Let C i ,...,i s ; j ,...,j s denote the matrix obtained from C by omitting the rows i , . . . , i s and the columns j , . . . , j s . Then det( C ) det( C i,j ; i,j ) = det( C i ; i ) det( C j ; j ) − det( C i ; j ) det( C j ; i ) where the determinant of the 0 × The use of Lewis-Carroll’s identity and Property P–9 provides moreproperties.P–10 [ q , q , . . . , q n ][ q , . . . , q n − ] = [ q , . . . , q n − ][ q , . . . , q n ] + ( − n (when n ≥ ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 7
P–11 In the case of even n with q i = q n +1 − i for 1 ≤ i ≤ n (i.e if thesequence is palindromic ), we have[ q , . . . , q n/ , q n/ , . . . , q ] + 1 =[ q , . . . , q n/ , q n/ , . . . , q ][ q , . . . , q n/ , q n/ , . . . , q ] =([ q , . . . , q n/ ] + [ q , . . . , q n/ − ] )([ q , . . . , q n/ ] + [ q , . . . , q n/ − ] )Note that Property P-10 also follows from Properties P–7 and P–8. More properties and proof techniques for the commutative case aregiven in [17, Sec. 6.7]2.1. Quasi-palindromic sequences.
Here again the rings are notnecessarily commutative.
Definition 9. An anti-automorphism of a ring R is an involution τ τ such that τ + σ = τ + σ and τ σ = σ τ for all elements τ , σ of R . Definition 10.
Let R be a ring endowed with an anti-automorphism τ τ . A quasi-palindromic sequence of length n satisfies q i = q n +1 − i for ≤ i ≤ n ; in particular, if n is odd the element q ( n +1) / satisfies q ( n +1) / = q ( n +1) / . We have an obvious relation.P–12 [ q n , . . . , q ] = [ q , . . . q n ]and counterparts of Properties P–10 and P–11. Lemma 11 (Noncommutative Lewis-Carroll-like identity) . Let τ τ be an anti-automorphism in a ring R , which also satisfies the conditions (1) ( τ τ = τ τ, andif τ = τ then τ belongs to the centre of R. Let ( q , . . . q n ) be a quasi-palindromic sequence of length n ≥ in R .The following relation holds [ q , . . . , q n ][ q , . . . , q n − ] = [ q , . . . , q n ][ q , . . . , q n − ] + ( − n = [ q , . . . , q n − ][ q , . . . , q n ] + ( − n . Proof.
We proceed by induction on n . Our basic cases are n = 2 , n = 2.For n = 3, since q is in the centre of R and q commutes with q ,from [ q , q ][ q , q ] − q q + 1)( q q + 1) − q q q q + q q + q q = q q q q + q q + q q we obtain q q q q + q q + q q = [ q , q ][ q , q ] − q , q , q ] q .For larger n , write E = [ q , . . . , q n − ] and F = [ q , . . . , q n − ]. Wewant to prove that [ q , . . . , q n ] E = [ q , . . . , q n − ][ q , . . . , q n ] + ( − n . CHARLES DELORME AND GUILLERMO PINEDA-VILLAVICENCIO
Observe that E and F belong to the centre of R , and that the fol-lowing results come from the definition of continuant and PropertyP–3.On one hand, we have that[ q , . . . , q n − ][ q , . . . , q n ] = ( q E + [ q , . . . , q n − ])( Eq n + [ q , . . . , q n − ])= q E q n + q E [ q , . . . , q n − ] + [ q , . . . , q n − ] Eq n + [ q , . . . , q n − ][ q , . . . , q n − ] . On the other hand, we have that[ q , q , . . . , q n − , q n ] E = ( q [ q , . . . , q n − , q n ] + [ q , . . . , q n ]) E = ( q ( Eq n + [ q , . . . , q n − ]) + [ q , . . . , q n − ] q n + F ) E = q Eq n E + q [ q , . . . , q n − ] E + [ q , . . . , q n − ] q n E + F E.
First note that [ q , . . . , q n ][ q , . . . , q n − ] = [ q , . . . , q n − ][ q , . . . , q n ] be-cause of the equality [ q , . . . , q n − ] = [ q , . . . , q n ].Since E = E , E commutes with the whole R and we have q E q n = q Eq n Eq E [ q , . . . , q n − ] = q [ q , . . . , q n − ] E, and[ q , . . . , q n − ] Eq n = [ q , . . . , q n − ] q n E. It only remains to check EF = [ q , . . . , q n − ][ q , . . . , q n − ] + ( − n = [ q , . . . , q n − ][ q , . . . , q n − ] + ( − n , but these equalities follows from the inductive hypothesis. (cid:3) Remark . For a quasi-palindromic sequence Q of length n ≥
3, wehave [ q , q , . . . , q n − ] = q [ q , . . . , q n − ] + [ q , . . . , q n − ]= q [ q , . . . , q n − ] + [ q , . . . , q n − ]3. Proper representations in Euclidean rings
As said before, if one tries to extend Smith’s approach to other Eu-clidean rings R , the uniqueness of the continuant representation maybe lost. Given two elements m, z ∈ R , the uniqueness of the contin-uant representation of ( m, z ) is necessary to recover representations m = xx + yy from a multiple zz + 1 of m . ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 9
Euclidean rings not necessarily commutative.
We first usecontinuants to obtain a multiple zz +1 of an element m of the form xx + yy , with x, y satisfying Rx + Ry = R and τ τ an anti-automorphismin the ring under consideration. Theorem 13.
Let R be a Euclidean ring, and let τ τ be an anti-automorphism of R satisfying the conditions (1) of Lemma 11. If m ∈ R admits a proper representation m = xx + yy (that is, with Rx + Ry = R ), then the equation zz + 1 ∈ Rm admits solutions.Furthermore, one of these solutions is equal to [ q s , . . . , q , q , . . . , q s − ] ,where ( q , q , . . . , q s ) is a sequence provided by the Euclidean algorithmon x and y .Proof. Let N denote the Euclidean function of R and let ( x, y ) (withN( x ) ≥ N( y )) be a proper representation of m .If y = 0 then x is a unit, so m must be a unit and the ideal Rm isthe whole ring R . Otherwise, the Euclidean algorithm on x and y givesa unit u and a sequence ( q , q , . . . , q s ) such that x = [ q , q , . . . , q s ] u and y = [ q , . . . , q s ] u . Then xx = [ q , . . . , q s ] uu [ q s , . . . , q ] , using Property P–12 xx = [ q s , . . . , q ][ q , . . . , q s ] uu, since uu belongs to the centre of Ryy = [ q s , . . . , q ][ q , . . . , q s ] uum = xx + yy = [ q s , . . . , q , q , . . . , q s ] uu, by Property P–3Let z = [ q s , . . . , q , q , . . . , q s − ]. Then applying Lemma 11 we obtain zz + 1 = ( uu ) − m [ q s − , . . . , q , q , . . . , q s − ]= ( uu ) − [ q s − , . . . , q , q , . . . , q s − ] m since m is in the center of R That is, z satisfies zz + 1 ∈ Rm , which completes the proof of thetheorem. (cid:3) Commutative rings: from x + y to z + 1 . In this subsectionwe deal with the problem of going from a representation x + y of anassociate of an element m to a multiple z + 1 of m . We begin with avery general remark valid in every commutative ring. Corollary 14.
In a commutative ring R , if Rx + Ry = R then thereexists some z ∈ R such that x + y divides z + 1 .If R is Euclidean, we can explicitly find z and the quotient ( z +1) / ( x + y ) with continuants. This relation can be interpreted using Lewis-Carroll’s identity. Thedeterminant of the tridiagonal matrix A associated with the palin-dromic sequence ( q s , . . . , q , q , . . . , q s ) (see property P–9 of continu-ants) is x + y with x = [ q , . . . , q s ] and y = [ q , . . . , q s ] if s ≥ Moreover, ( x + y )([ q , . . . q s − ] + [ q , . . . q s − ] ) = z + 1, where z isthe determinant of matrix formed by the 2 s − A (see properties P–10 and P–8). These remarks can readily beconverted into a deterministic algorithm; See Algorithm 1. Algorithm 1:
Deterministic algorithm for constructing a solution z of Q ( z, ≡ m ), given a representation uQ ( x, y ) of anelement m . input : A commutative Euclidean ring R .An element m ∈ R .A proper representation uQ ( x, y ) of m , where Q ( x, y ) = x + y . output : A solution z of Q ( z, ≡ m ) with N(1) ≤ N( z ). /* Apply the Euclidean algorithm to x and y and obtaina sequence ( q , . . . , q s ) of quotients. */ s ← m ← m ; r ← z ; repeat s ← s + 1; m s ← r s − ;find q s , r s ∈ R such that m s − = q s m s + r s with N( r s ) < N( m s ); until r s = 0; z ← [ q s , q s − , . . . , q , q , q , . . . , q s − ]; return z Commutative rings: from z + 1 to x + y . Here we deal withthe problem of going from a solution z of z + 1 ≡ m ) to arepresentation x + y of an associate of m .A natural question goes as follows: if m divides z + 1, does thereexist x, y such that m = x + y ? We now give examples showing thatno simple answer is to be expected.In general, we cannot construct a representation x + y of an element m from a solution of z + 1 ≡ m ). As an illustration, considerthe Euclidean domain F [ X ] of polynomials over the field F , where z + 1 is a multiple of m = z + 1 for any polynomial z , square or not.Recall that in F [ X ] the squares, and therefore the sums of squares,are exactly the even polynomials (i.e. the coefficient of X t is null if t is odd). Thus, the converse of Corollary 14 is false in F [ X ]. Otherexamples are the ring Z [ i ] of Gaussian integers and its quotients by aneven integer, since the squares and the sum of squares have an evenimaginary part. Thus, no Gaussian integer with an odd imaginarypart is a sum of squares, although it obviously divides 0 = i + 1;see [35, Sec. 3]. ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 11
However, there are cases where the answer is positive. Propositions15-17 discuss some of these cases.
Proposition 15.
Let R be a commutative ring. If 2 is invertible and − is a square, say k = 0 , then x = (cid:0) x +12 (cid:1) + (cid:0) x − k (cid:1) . Variants of Proposition 15 have appeared previously in the literature.For instance, a variant can be found in [27, p. 817] in the context offinite fields.
Proposition 16.
Let R = F [ X ] be the ring of polynomials over a field F with characteristic different from 2 and let − be a non-square in F .If m divides z + t with z, t coprime, then m is an associate of some x + y with x, y coprime.Proof. We introduce the extension G of F by a square root ω of − G [ X ] is principal and z + t factorises as ( z − ωt )( z + ωt ). Thetwo factors are coprime, since their sum and difference are respectively2 z and 2 ωt , and 2 and ω are units. Introduce gcd( m, z + ωt ) = x + ωy ,then x − ωy is a gcd of m and z − ωt owing to the natural automorphismof G . The polynomials x − ωy and x + ωy are coprime and both divide m . Thus, m is divisible by ( x − ωy )( x + ωy ) = x + y . On the otherhand, m divides ( z − ωt )( z + ωt ). Consequently, ( x − ωy )( x + ωy ) isan associate of m . Since x − ωy and x + ωy are coprime, we have x , y are coprime. (cid:3) On one hand, Corollary 14 and Proposition 16 somehow generalisethe main theorem of [27]. On the other hand, in the case of m beingprime, Proposition 16 is embedded in Theorem 2.5 of [7]. Proposition 17.
Let m be a non-unit of F [ X ] and a divisor of z + 1 for some z ∈ F [ X ] with deg( z ) < deg( m ) .If F is a field of characteristic different from 2, where − is a non-square, then continuants provide a method for representing m as a sumof squares.Specifically, the Euclidean algorithm on m and z gives the unit u andthe sequence ( uq s , u − q s − , . . . , u ( − s − q , u ( − s q , . . . , u − q s ) such that x = [ q , . . . , q s ] and y = [ q , . . . , q s ] .Proof. Having a divisor m of z + 1, we already know from Proposi-tion 16 that the degree of m is even. We may assume that degree( z ) < degree( m ) as we may divide z by m .From Proposition 16 we also know that, for this given z , m/u = x + y for some coprime x, y . Consequently, the Euclidean algorithmon these x and y will give the unit 1 and the sequence ( q , . . . , q s ) suchthat x = [ q , . . . q s ], y = [ q , . . . , q s ] and m/u = [ q s , . . . , q , q , . . . , q s ].Theorem 13 tells that, given these x and y , the element z has theform [ q s , . . . , q , q , . . . , q s − ], which, by Property P8, is equivalent to [ q s − , . . . , q , q , . . . , q s ]. Note that the uniqueness of the continuantrepresentation of ( x, y ) has implicitly been invoked.We may also assume degree( x ) > degree( y ), otherwise, if x = λy + t with λ a unit and t a polynomial of degree smaller than the degree of x and y , then m = (((1 + λ ) y + λt ) + t ) u λ . As a result, we consideronly the case where all q i ’s have degree at least 1 in the continuantrepresentation of ( x, y ).We then apply the Euclidean algorithm to m and z , and obtain,by virtue of the uniqueness of the division in polynomials, a sequencewhose last non-null remainder is u . Consequently, m/u = x + y (seeProperty P–2 of continuants). (cid:3) We illustrate this proposition through some examples. First take m = 2 X − X + 3 X − X + 1, then m divides (2 X + X ) + 1. TheEuclidean divisions give successively2 X − X + 3 X − X + 1 =(2 X + X )( X −
1) + 2 X − X + 12 X + X =(2 X − X + 1)( X + 1 /
2) + ( X/ − / X − X + 1 =( X/ − / X + 2) + 2 X/ − / X/ − / . Here we have m/ · ( X − / , − · (2 X + 1) , · (2 X + 1) , − · ( X − /
2] with u = 2, which gives m/ X − X/ / +( X/ − / = x + y . Since 2 is also a sum of two squares, we obtain m = ( x + y ) + ( x − y ) = X + ( X − X + 1) .We find other examples among the cyclotomic polynomials. Thecyclotomic polynomial Φ n ∈ Q [ X ] divides X n + 1. Thus, Φ n is,up to a constant, a sum of two squares; see, for instance, [37]. SinceΦ n (0) = 1, the constant can be chosen equal to 1. For an odd prime p , it is easy to checkΦ p ( X ) = p − X k =0 ( − k X k = ( p − / X k =0 ( − k X k + X ( p − / X k =0 ( − k X k ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 13
For the small composite odd number 15, the computation givesΦ ( X ) = X + X − X − X − X + X + 1= [ X, X, X − X, − X, − X, X, X, − X, − X, X − X, X, X ] X = [ X, X − X, − X, − X, X, X, − X, − X, X − X, X, X ] x = [ X, − X, − X, X − X, X, X ]= X − X + 1 y = [ − X, − X, X − X, X, X ]= X + X − X − X Φ ( X ) = x + y At this stage the following remark is important.
Remark . If a polynomial with integer coefficients is the sum ofsquares of two polynomials with rational coefficients, it is also the sumof squares of two polynomials with integer coefficientsFor example, we see that 50 X +14 X +1 = (5 X +3 / +(5 X +4 / ,but it is also X + (7 X + 1) .This remark follows from Theorem 2.5 of [7]. Other proofs can befound in [42] and [11, Sec. 5]. Remark
19 (Algorithmic considerations) . For the cases covered in Propo-sition 17, given an element m and a solution z of z + 1 ≡ m ),we can recover a representation x + y of an associate of m via continu-ants and Brillhart’s [5] optimisation. We divide m by z and stop whenwe first encounter a remainder r s − with degree at most deg( m ) /
2. Thiswill be the ( s − uq s , u − q s − , . . . , u − ( s − q ). In this context x = ( r s − for odd su − r s − for even sy = ( [ uq s , u − q s − , . . . , u ( − s − q ] for odd su − [ uq s , u − q s − , . . . , u ( − s − q ] for even s This observation follows from dividing m/u = [ q s , . . . , q , q , . . . , q s ] by z = [ q s − , . . . , q , q , . . . , q s ] using continuant properties.Algorithm 2 implements Remark 19.4. Four-square theorem
The four-square theorem has been proved in a number of ways.Hardy and Wright [18, Sec. 20.5, 20.9, 20.12] present three proofs:one based on the “method of descent”, one based on quaternions, andone based on elliptic functions. We are aware of five other proofs
Algorithm 2:
Deterministic algorithm for constructing a properrepresentation uQ ( x, y ) = u ( x + y ) of an element m input : A field F with characteristic different from 2.The ring R = F [ X ] of polynomials over F .A polynomial m with N(1) < N( m ).A solution z of Q ( z, ≡ m ) withN(1) < N( z ) < N( m ). output : A unit u and a proper representation uQ ( x, y ) of m . /* Divide m by z using the Euclidean algorithm untilwe find a remainder r s − with degree at most deg( m ) / . */ s ← m ← m ; r ← z ; repeat s ← s + 1; m s − ← r s − ;find k s − , r s − ∈ R such that m s − = k s − m s − + r s − withN( r s − ) < N( m s − ); until deg( r s − ) ≤ deg( m ) / /* Here we have a sequence ( k , . . . , k s − ) of quotients.*/ x temp ← r s − ; y temp ← [ k , . . . , k s − ]; /* We obtain a unit u . */ if s is odd then Solve m = u ( x temp + y temp ) for u endelse Solve um = x temp + y temp for u end /* We obtain ( x, y ) so that m = ( x + y ) u . */ if s is odd then x ← x temp else x ← u − x temp ; if s is odd then y ← y temp else y ← u − y temp ; return ( x, y, u )[1, 3, 22, 40, 41]. The proofs in [1, 3, 22] are based on the triple-productidentity, the paper [41] gives an arithmetic proof based on the numberof representations of a positive number as the sum of two squares, andthe proof in [40] is based on factorisations of 2 × Z [ i ] of Gaussian integers.In this section, we provide a new constructive proof of the four-squaretheorem. Our proof is based on continuants over Z [ i ]. ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 15
We start by stating the following formula, which was already knownto Euler, see [13, pp. 277].
Lemma 20 (Product formula) . Let R be a commutative ring endowedwith an anti-automorphism. Let x, y, z, u be elements of R . Then ( xx + yy )( zz + uu ) = ( xz − yu )( xz − yu ) + ( xu + yz )( xu + yz ) Proof.
This can be seen by looking at the determinants in the equality (cid:20) x y − y x (cid:21) (cid:20) z u − u z (cid:21) = (cid:20) xz − yu xu + yz − xu + yz xz − yu (cid:21) . (cid:3) We use Lemma 20 for the case of R being the ring of Gaussianintegers, with its conjugation. This product formula allows to reducethe proof of the four-square theorem to the case of primes.We recall that each prime p is either of the form zz or divides zz + 1,for some z ∈ Z [ i ] [9, Prop. 4.18]. If p = zz then p is trivially a sumof four squares. Assume the equation zz + 1 ≡ p ) admitsa solution z over Z [ i ]. Given this solution z , we prove the four-square theorem by constructing a representation of p as xx + yy , with x, y ∈ Z [ i ].By reducing z modulo p , we may assume | z | ≤ p/ √
2, and thus z z + 1 < p (if p = 2, a parity argument shows the inequality remainsvalid). Here | z | denotes the complex norm of z .Let p := p . Then, we produce a succession of s equalities p i p i +1 = z i z i + 1 and z i = q i +1 p i +1 + z i +1 , where the sequence of positive integers p = p , p , . . . , p s = 1 is decreasing. At the end, we have p s − p s = z s − z s − + 1 and q s = z s − .We now build a continuant representation of q . The equation p s − p s = z s − z s − + 1 can be written as p s − = [ q s , q s ] = [ q s , q s ], since p s = 1, z s − = q s , and q s and q s commute; see Lemma 11. From the equa-tion z s − = q s − p s − + z s − and Remark 12, it follows that z s − =[ q s − , q s , q s ]. The equation p s − p s − = z s − z s − + 1 can therefore bewritten as p s − [ q s , q s ] =[ q s − , q s , q s ][ q s − , q s , q s ] + 1 p s − [ q s , q s ] =[ q s − , q s , q s ][ q s , q s , q s − ] + 1 (by Property P–12)Hence, p s − = [ q s − , q s , q s , q s − ] (by Lemma 11). Continuing this pro-cess, we obtain continuant representations for p s − , . . . , p . The repre-sentation for p = p is the quasi-palindromic continuant [ q , q , . . . , q , q ],where the central pair is q s , q s if s is odd and q s , q s if s is even. Thus, we have a representation of p = xx + yy , with x and y being as follows: x = ( [ q , q , . . . , q s − , q s ] if s is odd[ q , q , . . . , q s − , q s ] if s is even .y = ( [ q , q , . . . , q s − ] if s is odd[ q , q , . . . , q s − ] if s is even . This completes the proof of the four-square theorem.Consider the following example, where p = 431 and z = 54 + 10 i .431 · i )(54 − i ) + 1 →
54 + 10 i = (8 + i )7 + ( − i )7 · − i )( − − i ) + 1 → − i = ( − i )2 + i · i )( − i ) + 1 → i = i · q , q , q ) = (8 + i, − i, i ), x = [8 + i, − − i, i ] and y =[8 + i, − − i ]. Thus,431 = [8 + i, − − i, i, − i, − i, − i ]= [8 + i, − − i, i ][8 + i, − − i, i ] + [8 + i, − − i ][8 + i, − − i ]= (17 − i )(17 − i ) + ( − − i )( − − i )= 17 + 5 + 6 + 9 Remark
21 (Number of representations by the form x + y + z + u ) . The number of representations of positive numbers by this form isgiven by Jacobi’s theorem [47, Thm. 9.5]. See also [18, Sec. 20.12]and [1, 3, 22, 41].5.
Some quadratic forms representing integers
Using the techniques of Section 4 we may build other forms repre-senting either all positive integers or all integers. Examples of formsrepresenting all positive integers are x − xy + y + z − zu + u and x + 3 y + z + 3 u , while the form x − y + z − u is an example ofa form representing all integers. Some of these results have already ap-peared in the literature; see, for instance, [1, Thm. 1.9], [2, Thm. 12], [6]and [24, Thm. 13]. Proposition 22.
Each positive integer has the form x − xy + y + z − zu + u with x, y, z, u integers.Proof. Consider the ring Z [ j ] of Eisenstein integers, with j = exp(2 iπ/ v − vw + w is the norm of v + wj . As in Section 4, Lemma 20 for the case R = Z [ j ]reduces the task to primes. Again, as in Section 4, every prime p iseither of the form zz or divides some zz + 1, with z ∈ Z [ j ]. See [9,Prop. 4.7]. ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 17
Assume the equation zz + 1 ≡ p ) admits a solution z over Z [ i ]. Then, reasoning as in Section 4, the division process provides adeterministic algorithm to find a representation p = xx + yy . Hereagain we reduce z modulo p and assume z z ≤ p /
4. Thus, we onlyhave to be careful if p s − = 2 to avoid the trap 2 · − j )(1 − j ) + 1,where p s − = p s = 2. This problem is avoided by choosing a convenientquotient q s − . (cid:3) Next we show an example with the aforementioned trap, that is,where the sequence p , . . . , p s is not decreasing. Take p = 47 and z =11 + 7 j , then 94 = 47 · j )(11 + 7 j ) + 1. Here we have p = 2.The equation 11 + 7 j = q p + z with the quotient q = 5 + 4 j wouldproduce z = 1 − j and p = 2, that is, 2 · − j )(1 − j )+1. However,with the quotient q = 5 + 3 j , we get z = 1 + j and p = 1, that is,2 · j )(1 + j ) + 1 and q = 1 + j . Hence, ( q , q ) = (5 + 3 j, j )and 47 = [5 + 3 j, j, j, j ]= [5 + 3 j, j ][5 + 3 j, j ] + [5 + 3 j ][5 + 3 j ]= (4 − j )(4 − j ) + (5 + 3 j )(5 + 3 j )= 4 − (4)( −
2) + ( − + 5 − · . Previous proofs of Proposition 22 appeared in [2, Thm. 12], [6], and[24, Thm. 13]. The proof in [24, Thm. 13] is perhaps the first elementaryproof.
Remark
23 (Number of representations by the form x − xy + y + z − zu + u ) . The number of representations is given by Liouville’s theorem [47,Thm. 17.3]. See also [2, Thm. 12], [6], and [24, Thm. 13].
Corollary 24.
Every positive integer has the form x + 3 y + z + 3 u .Proof. By Proposition 22 we only need to prove that x − xy + y hasthe form p + 3 q . Indeed,(1) If x is even, say x = 2 t , then x − xy + y = 4 t − ty + y =( y − t ) + 3 t (2) If y is even, say y = 2 t , then x − xy + y = ( x − t ) + 3 t (3) If x and y are both odd, then x − xy + y = (( x + y ) / +3(( y − x ) / (cid:3) A proof of Corollary 24 appeared in [1, Thm. 1.9].
Remark
25 (Number of representations by the form x +3 y + z +3 u ) . The number of representations was stated without proof by Liouville[31, 32] and it is proved in [1, Thm. 1.9].
Proposition 26.
Each integer has the form x − y + z − u . Proof.
This can be proved by reasoning as in Proposition 22. Thenecessary ring is Z [ √
3] endowed with its natural anti-automorphism. (cid:3)
In the following example we try to represent 19 and −
19, noticingthat 19 · − · + 1.19 · √ − √
3) + 1 q = 3 + √ · √ − √
3) + 1 q = 1 + 0 √ . Hence19 = [3 + √ , − √ − √ , √
3] + [3 + √ − √ √ − √
3) + (3 + √ − √ − · + 3 − · . Then, to represent −
19, we use − · √ − √
3) andthe product formula (Lemma 20) to get −
19 = ((4 + √ √
3) + (3 + √ √ √
3) + (3 + √ √ − (3 + √ − √ √ − (3 + √ − √ √ − √
3) + (4 + 3 √ − √ − · + 4 − · . Remark . If continuants over new rings are considered, the approachpresented in Sections 4 and 5 is likely to provide more quaternaryquadratic forms representing either all positive integers or all integers.
References [1] A. Alaca, S¸. Alaca, M. F. Lemire, and K. S. Williams,
Nineteen quater-nary quadratic forms , Acta Arith. (2007), no. 3, 277–310. MR 2365706(2008m:11084)[2] A. Alaca, S¸. Alaca, and K. S. Williams,
On the two-dimensional theta func-tions of the Borweins , Acta Arith. (2006), no. 2, 177–195. MR 2262245(2007h:11051)[3] G. E. Andrews, S. B. Ekhad, and D. Zeilberger,
A short proof of Jacobi’s for-mula for the number of representations of an integer as a sum of four squares ,Amer. Math. Monthly (1993), no. 3, 274–276. MR 1212835 (94b:11015)[4] C. W. Barnes,
The representation of primes of the form n + 1 as the sum oftwo squares , Enseignement Math. (2) (1972), 289–299 (1973). MR 0325503(48 Note on representing a prime as a sum of two squares , Math.Comp. (1972), 1011–1013.[6] R. Chapman, Representations of integers by the form x + xy + y + z + zt + t ,Int. J. Number Theory (2008), no. 5, 709–714. MR 2458836 (2009j:11061) ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 19 [7] M. D. Choi, T. Y. Lam, B. Reznick, and A. Rosenberg,
Sums of squares insome integral domains , J. Algebra (1980), no. 1, 234–256. MR 578805(81h:10028)[8] F. W. Clarke, W. N. Everitt, L. L. Littlejohn, and S. J. R. Vorster, H. J. S.Smith and the Fermat two squares theorem , Amer. Math. Monthly (1999),no. 7, 652–665, doi:10.2307/2589495.[9] D. A. Cox,
Primes of the form x + ny -fermat, class field theory and complexmultiplication , John Wiley & Sons Inc., New York, 1989.[10] H. Davenport, The higher arithmetic-An introduction to the theory of numbers ,8th ed., Cambridge University Press, Cambridge, 2008, Editing and additionalmaterial by J. H. Davenport.[11] H. Davenport, D. J. Lewis, and A. Schinzel,
Polynomials of certain specialtypes , Acta Arith. IX (1964), 107–116.[12] Jesse Ira Deutsch, Geometry of numbers proof of G¨otzky’s four-squares theo-rem , J. Number Theory (2002), no. 2, 417–431. MR 1932465 (2003j:11036)[13] L. E. Dickson, History of the theory of numbers, Vol. II , Chelsea PublishingCompany, New York, 1971.[14] C. L. Dodgson,
Condensation of determinants, being a new and brief methodfor computing their arithmetical values , Proc. R. Soc. Lond. (1866), pp.150–155.[15] M. Elia, Representation of primes as the sums of two squares in the goldensection quadratic field , J. Discrete Math. Sci. Cryptogr. (2006), no. 1, 25–37.[16] M. Elia and C. Monico, On the representation of primes in Q ( √ as sums ofsquares , JP J. Algebra Number Theory Appl. (2007), no. 1, 121–133.[17] R. L. Graham, D. E. Knuth, and O. Patashnik, Concrete Mathematics: Afoundation for computer science , 2nd ed., Addison-Wesley, New York, 1994.[18] G. H. Hardy and E. M. Wright,
An introduction to the theory of numbers , 6thed., Oxford University Press, Oxford, 2008, Revised by D. R. Heath-Brownand J. H. Silverman.[19] J. Hardy,
A note on the representability of binary quadratic forms with Gauss-ian integer coefficients as sums of squares of two linear forms , Acta Arith. (1968), 77–84.[20] K. Hardy, J. B. Muskat, and K. S. Williams, A deterministic algorithm forsolving n = f u + gv in coprime integers u and v , Math. Comp. (1990),no. 191, 327–343, doi:10.2307/2008809.[21] C. Hermite, Note au sujet de l’article precedent , J. Math. Pures Appl. (1848),15.[22] M. D. Hirschhorn, A simple proof of jacobi’s four-square theorem , Proc. Amer.Math. Soc. (1987), no. 3, 436–438.[23] J. S. Hsia,
On the representation of cyclotomic polynomials as sums of squares ,Acta Arith. (1973/74), 115–120.[24] J. G. Huard, Z. M. Ou, B. K. Spearman, and K. S. Williams, Elementaryevaluation of certain convolution sums involving divisor functions , Numbertheory for the millennium, II (Urbana, IL, 2000), A K Peters, Natick, MA,2002, pp. 229–274. MR 1956253 (2003j:11008)[25] N. Jacobson,
Basic Algebra I , 2nd. ed., W. H. Freeman and Co., New York,1985.[26] M. A. Jodeit, Jr.,
Uniqueness in the division algorithm , Amer. Math. Monthly (1967), 835–836.[27] W. Leahey, Sums of squares of polynomials with coefficients in a finite field ,Amer. Math. Monthly (1967), 816–819. [28] W. J. Leahey, A note on a theorem of I. Niven , Proc. Amer. Math. Soc. (1965), 1130–1131. MR 0181632 (31 Representability of binary quadratic formsover a B´ezout domain , Duke Math. J. (1973), 533–539. MR 0320041 (47 Forms representable by integral binaryquadratic forms , Acta Arith. (1974/75), 1–9. MR 0354550 (50 Sur la forme x + y + 3( z + t ), J. Math. Pures Appl. (1860),147152.[32] J. Liouville, Remarque nouvelle sur la forme x + y + 3( z + t ), J. Math.Pures Appl. (1863), 296.[33] L. J. Mordell, On the representation of a binary quadratic form as a sum ofsquares of linear forms , Math. Z. (1932), no. 1, 1–15.[34] L. J. Mordell, The Representation of a Gaussian Integer as a Sum of TwoSquares , Math. Mag. (1967), no. 4, 209. MR 1571701[35] I. Niven, Integers of quadratic fields as sums of squares , Trans. Amer. Math.Soc. (1940), 405–417.[36] G. Pall, Sums of two squares in a quadratic field , Duke Math. J. (1951),399–409. MR 0040337 (12,676g)[37] Y. Pourchet, Sur la repr´esentation en somme de carr´es des polynˆomes `a uneind´etermin´ee sur un corps de nombres alg´ebriques , Acta Arith. (1971), 89–104.[38] R. Schoof, Elliptic curves over finite fields and the computation of square rootsmod p , Math. Comp. (1985), no. 170, 483–494.[39] J. A. Serret, Sur un theoreme relatif aux nombres entieres , J. Math. PuresAppl. (1848), 12–14.[40] C. Small, A simple proof of the four-squares theorem , Amer. Math. Monthly (1982), no. 1, 59–61.[41] B. K. Spearman and K. S. Williams, The simplest arithmetic proof of Jacobi’sfour squares theorem , Far East J. Math. Sci. (FJMS) (2000), no. 3, 433–439.MR 1759101 (2001a:11063)[42] G. Zaimi ( http://mathoverflow.net/users/2384/ ), About integer polyno-mials which are sums of squares of rational polynomials , Mathoverflow, http://mathoverflow.net/questions/82046/ , accessed Dec 16 2011.[43] S. Wagon,
Editor’s corner: the Euclidean algorithm strikes again , Amer. Math.Monthly (1990), no. 2, 125–129, doi:10.2307/2323912.[44] J. H. M. Wedderburn, On continued fractions in non-commutative quantities ,Ann. of Math. (1913/14), no. 1-4, 101–105.[45] K. S. Williams, On finding the solutions of n = au + buv + cv in integers u and v , Util. Math. (1994), 3–19.[46] K. S. Williams, Some refinements of an algorithm of Brillhart , Number theory(Halifax, NS, 1994), CMS Conf. Proc., vol. 15, Amer. Math. Soc., Providence,RI, 1995, pp. 409–416.[47] K. S. Williams,
Number theory in the spirit of Liouville , London MathematicalSociety Student Texts, vol. 76, Cambridge University Press, Cambridge, 2011.[48] K. S. Williams,
On a theorem of Niven , Canad. Math. Bull. (1967), 573–578.MR 0224539 (37 Forms representable by an integral positive-definite binary qua-dratic form , Math. Scand. (1971), 73–86. MR 0319894 (47 Note on a theorem of Pall , Proc. Amer. Math. Soc. (1971),315–316. MR 0277496 (43 ONTINUANTS AND SOME DECOMPOSITIONS INTO SQUARES 21 [51] K. S. Williams,
Representation of a binary quadratic form as a sum of twosquares , Proc. Amer. Math. Soc. (1972), 368–370. MR 0325536 (48 Another proof of a theorem of Niven , Math. Mag. (1973),39. MR 0313222 (47 A one-sentence proof that every prime p ≡ is a sum oftwo squares , Amer. Math. Monthly (1990), no. 2, 144, doi:10.2307/2323918. E-mail address : [email protected] Centre for Informatics and Applied Optimisation, Federation Uni-versity Australia
E-mail address ::