• Aucun résultat trouvé

It is well known that the simple formula ap+41modpgives a square root ofawhenp≡3 mod 4

N/A
N/A
Protected

Academic year: 2022

Partager "It is well known that the simple formula ap+41modpgives a square root ofawhenp≡3 mod 4"

Copied!
12
0
0

Texte intégral

(1)

Short Polynomial Representations for Square Roots Modulo p

SIMON JOSEPH AGOU sjagou@aviion.univ-lemans.fr

D´epartement de Math´ematiques, Universit´e du Maine, Avenue Olivier Messiaen, F-72085 Le Mans C´edex, France

MARC DEL ´EGLISE deleglis@desargues.univ-lyon1.fr

Institut Girard Desargues, Math´ematiques, Bˆatiment J. Braconnier, Universit´e Claude Bernard (Lyon 1), F-69622 Villeurbanne C´edex, France

JEAN-LOUIS NICOLAS jlnicola@in2p3.fr

Institut Girard Desargues, Math´ematiques, Bˆatiment J. Braconnier, Universit´e Claude Bernard (Lyon 1), F-69622 Villeurbanne C´edex, France

Communicated by: S. Gao

Received February 15, 2001; Revised October 3, 2001; Accepted October 24, 2001

Abstract. Letpbe an odd prime number andaa square modulop. It is well known that the simple formula ap+41modpgives a square root ofawhenp3 mod 4. Let us writep1=2nswithsodd. A fast algorithm due to Shanks, withnsteps, allows us to compute a square root ofamodulop. It will be shown that there exists a polynomial of at most 2n−1terms giving a square root ofa. Moreover, if there exists a polynomial inarepresenting a square root ofamodulop, it will be proved that this polynomial would have at least 2n−1terms, except for a finite setPnof primespdepending onn.

R´esum´e.Soitpun nombre premier impair etaun carr´e modulop. La formule tr`es simpleap+14 modpfournit une valeur de la racine carr´ee dealorsquep3 mod 4. Plus g´en´eralement, si l’on ´ecritp1=2nsavecsimpair, un algorithme dˆu `a Shanks, comprenantn´etapes, permet de calculer la racine carr´ee deamodulop. Nous montrerons qu’il existe un polynˆome d’au plus 2n1termes et dont la valeur est une racine carr´ee deapour tout carr´ea. De plus, pournfix´e, nous d´emontrons que tout polynˆome enarepr´esentant la racine carr´ee deamodulopa au moins 2n1termes, except´e pour un ensemble finiPnde nombres premiersp1 (mod 2n).

Keywords: square root modp, Shanks algorithm, finite fields AMS Classification: 12E20, 68W40

1. Introduction

Any function f from a finite fieldK into itself is a polynomial the value of which can be obtained by Lagrange interpolation formula or by Chevalley’s trick (cf. [7], p. 272):

f(X)=

tK

f(t)(1−(Xt)q1)

Research partially supported by CNRS, Institut Girard Desargues, UPRES-A 5028 and R´egion Rhˆone-Alpes, contract 99 029744.

(2)

whereqis the number of elements ofK. In [9] and [10], the authors considered polynomials representing the discrete logarithm on a finite fieldGF(q). In the present paper, we wish to investigate the functionsquare root;we shall restrict ourselves to the fieldsFp=Z/pZ, withpan odd prime. It would be possible to study, in the same way, cubic roots and more generally,k-th roots, fork>2 (cf. [1]).

Letp =2 be a prime number. It is well known that there are p−12 quadratic residuesain Fp= {1,2, . . . ,p1}which can be obtained by the congruence involving the Legendre symbol

1= a

p

ap−12 (mod p). (1)

We shall denote by

ato be one of the square roots ofa. The two square roots of a square a =0 will be denoted by±

a.

We shall say that a polynomialP(X)Fp[X] represents the square root inFpif, for all quadratic residuesaFp, the relation(P(a))2=a (i.e., P(a)= ±

a) holds or, equiva- lently

tFp, (P(t2))2=t2. (2) It is easy to see thatFp can be replaced byFp in (2). This means that an additional restriction onP, namelyP(0)=0 is to be imposed. However this is not a serious restriction:

ifPsatisfies (2), the polynomial Pˆ(X)=P(X)+

Xp−12 1

P(0) (3)

also satisfies (2) and moreover ˆP(0)=0.

In Section 2, we shall prove the following theorem.

THEOREM 1. Let p be an odd prime number. Let us call Sp the set of vectors σ= 1, σ2, . . . , σp−1

2 )such thatσi∈ {−1,+1}for all i (so, there are2(p−1)/2vectorsσSp).

(i) For every vectorσSp, there exists one and only one polynomial PσFp[X]such that

for 1i p1

2 , Pσ(i2)=σii (4)

and

deg(Pσ) p3

2 · (5)

The value of Pσis given by

Pσ(X)= −2

(p−3)/2 k=0

(p−1)/2

j=1

σjj12k

Xkmodp. (6)

(ii) Let P(X)=(p3)/2

k=0 ckXk be a polynomial inFp[X]of degree at most(p3)/2 and representing the square root inFp. Then there exists a vectorσSpsuch that P=Pσ.

(3)

Moreover, for1i(p1)/2, σii

(p3)/2 k=0

(τ(i))22kck (mod p) (7)

whereτ(i)is the only integer j such that(i j)21 (mod p)and1 j(p−1)/2.

(iii) Any polynomialPˆ Fp[X]representing the square root inFpcan be written as P(Xˆ )=Pσ(X)+

Xp−12 1

H(X) (8)

whereσbelongs to Sp and H is some polynomial inFp(X). Conversely, any polynomial P defined by (8) where H is any polynomial inˆ Fp(X)represents the square root inFp.

The computation of polynomialsPσ for small primes shows that most of these polyno- mials do have many non zero coefficients. However, there exist a few exceptions. To study this phenomenon, we introduce the following:

Definition. The length of a polynomial P denoted by(P)is the number of non zero terms occuring in the polynomial. So, the monomials are the polynomials of length 1, the binomials the polynomials of length 2, and so on.

The following Lemma will be useful; for instance, from (8), (5), and Lemma 1, it follows that(Pˆ)(Pσ).

LEMMA1. Let m1be an integer, and K be a field. Then, for any polynomial AK[X], the inequality(A)(R)holds, where R is the remainder in the Euclidean division of A(X)by Xm1.

Proof of Lemma 1. First, we observe that the remainder in the division ofXkbyXm1 is Xk¯ where ¯kis the remainder in the division ofkbym. Therefore, ifA(X)=

iakiXki, we shall have R(X)=

iakiXki, and clearly,(R)(A)holds which completes the proof of Lemma 1.

The explicit calculation of the square root inFp plays nowadays an important role in cryptography (cf. [5] or [11]). Up to now, there does not seem to exist a good deterministic algorithm to compute a square root modulop(cf. [12]) but there is a very fast probabilistic algorithm which was established by Lehmer (cf. [6]) and whose present form is due to Shanks (cf. [3] and [2]).

When p3 (mod 4)this algorithm works as follows: ifais a square modulo p then ap+14 modp is a square root ofa modulo p. So, in this case, there is a monomial which does represent the square root inFp(see the application at the end of Section 2).

More generally, let us write

p1=2ns withsodd. (9)

The casen=1 corresponds to p3 (mod 4). For largern, Shanks’s algorithm encom- passesnsteps, and works as follows (cf. [2] or [11]). Letbbe a non residue modulop. The

(4)

following sequence of congruences is built aαibβi1 (mod p), i=1, . . . ,n

withαi=(p1)/2i,βieven,β1=0 andnis defined by (9). Wheneveri<n, the value of βi+1is obtained in the following way: the value of

εi=aαi/2bβi/2

is equal to±1. If εi= +1, then βi+1=βi/2. Ifεi= −1, thenβi+1=βi/2+(p−1)/2.

From the definition ofn,αnis odd, and the square roots ofaare±aαn+12 bβn/2.

It is possible to modify this algorithm to find a polynomial of length at most 2n1and representing the square root inFp. For instance, ifn=2 (then, it follows from (9) thatp5 (mod 8)), the above algorithm distinguishes two cases:ε1=ap41 = ±1. Ifε1= +1, the square root is equal toaα2+12 =ap+83, while, ifε1= −1, it is equal toaα2+12 bβ2/2=ap+83bp41. Both cases are covered in the formula:

a = ±1 2

ap+38

ap−14 +1

+ap+38 bp−14

ap−14 1

= ±

1+bp−14 2

a3p+18 +

1−bp−14 2

ap+38

(10) which is a binomial ona. Let us observe thatbp−14 is a primitive fourth root of unity. It can take two different values, so that, formula (10) yields 4 binomials representing the square root inFp.

We shall prove in Section 3.

THEOREM2. Let r 1and p be a prime such that

p2r+1 (mod 4r). (11)

Then there exists at least2r polynomials PFp[X] of degreedeg(P) p−32 , of length (P)r and representing the square root inFp.

Settingr=2n1in Theorem 2 gives Theorem 3.

THEOREM3. Let p be an odd prime number, and n the2-adic valuation of p1defined by (9). Then there exists at least22n−1polynomials PFp[X]of degreedeg(P) p23, of length(P)2n−1and representing the square root inFp.

In some sense, the following theorem is a converse of Theorem 3.

THEOREM4. Let n1. There exists a finite setPn of prime numbers such that, for all prime p, p/Pn and 2n|(p1), and all PFp[X]representing the square root inFp

(i.e., satisfying (2)),(P)2n−1holds.

One has:P1=P2=P3= ∅;P4= {17}.

(5)

P5 is much bigger; its elements will be given in Section 4 together with the proof of Theorem 4.

It is easy to show that the only monomials representing the square root inFp and of degree at most(p−3)/2 are±X(p+1)/4with p3 (mod 4). It is also possible to show that the only binomials representing the square root inFpand of degree at most(p3)/2 are the four binomials given by (10) when p5 (mod 8)(the proof is similar to that of Theorem 5 below, but much easier). In Section 5, we shall prove Theorem 5 which answers a similar question about trinomials.

THEOREM5. Let us assume that there exists a trinomial Q(x)Fp[x]representing the square root inFpsatisfying Q(x)=axα+bxβ+cxγ with

0α < β < γ < (p−1)/2 (12)

and abc =0; then p should be of the form12m+7(m1). Conversely, for such a prime p, there exist exactly six such trinomials given by the formulae

Q= ±13

2x(p+5)/12x(p+1)/4+2x(5p+1)/12

(13) or

Q= ±13 (1

−3)x(p+5)/12+x(p+1)/4+(1±

−3)x(5p+1)/12

(14) where

−3is any of the two square roots of−3modulo p; for instance

−3(−3)p+14 = (−3)3m+2 (mod p).

In [8] a somewhat similar question has been investigated.

Remark. We have not succeeded yet in extending Theorem 5 to polynomials with more than three terms. We guess that the 2rpolynomials of length at mostrwhich are announced in Theorem 2 as representing the square root inFp are the only ones, but our method of proving Theorem 5 becomes too technical forr4.

2. The PolynomialsPσ

Proof of Theorem 1, (i). Polynomials Pσ are interpolation polynomials at the pointsi2, 1i p21. Their existence and uniqueness are given by Lagrange’s Theorem.

To prove formula (6), it suffices to prove it for X=i2, 1i p−12 . By changing the order of the summation, we get

−2

(p−3)/2 k=0

(p−1)/2

j=1

σjj1−2k

i2k= −2

(p−1)/2 j=1

j (p−3)/2

k=0

(i/j)2k.

But the sum in k is a sum of terms in geometric progression. For j =i, it vanishes (by Fermat’s Theorem) while, for j=i, it is equal to(p−1)/2. The value of the above expression is thus−2iσi(p1)/2=iσi, in agreement with (4).

(6)

Proof of Theorem 1, (ii). AsPrepresents the square root inFp, then for alli, 1i p−12 , we should have P(i2)= ±i; therefore, from (i), as the degree of P is at most(p−3)/2, there existsσSpwithP=Pσ.

So, we havePσ(X)=P(X)=(p−3)/2

k=0 ckXk. Let us associate to Pσthe column vector

D=

d1

d2

...

dp1 2

=

c0

c1

...

cp3 2

.

Further, let us introduce the square matrixM=(mi,j), 1i,j p−12 defined by

mi,j= −2j3−2i modp. (15)

It follows from (6) that

D=

d1 d2 ...

dp−1 2

=

c0 c1 ...

cp−3 2

=M

σ1

σ2

σ...p−1

2

=M tσ. (16)

Now, let us setA= tMM=(ai,j). A simple calculation shows that ai,j=4

(p1)/2 k=1

(i j)3−2k mod p. (17)

With the definition ofτ(i), it follows from (17) that for j =τ(i), ai,j=0

while

ai,τ(i)=4 p−1

2

iτ(i)≡ −2iτ(i) (mod p).

So, for any column vectorV with components inFp, we have

AV= tMM

v1

v2

vp−1...

2

= −2iτ(i)

vτ(1)

vτ(2)

vτ...p−1

2

. (18)

Further, (16) and (18) yield

tMD= tMMtσ= −2iτ(i)

στ(1)

στ(2)

στ...p−1

2

(19)

(7)

which allows us to calculate στ(i)= −1

2iτ(i)

(p−1)/2 j=1

mj,idj= −1 2iτ(i)

(p−3)/2 k=0

mk+1,ick

Observing thatτ(τ(i))=i andiτ(i)= ±1, the above formula in conjunction with (15) becomes

σiiτ(i) 2

(p3)/2 k=0

mk+1,τ(i)ckiτ(i)

(p3)/2 k=0

τ(i)1−2kck (mod p).

which yields (7).

Application. As an application of (7), let us try to determine the vectorσcorresponding to the polynomialP(a)=ap+14 when p3 (mod 4). We have, from (7),

σiiτ(i)2−p+12 iτ(i)τ(i)p−12 (mod p)

and sinceiτ(i)= ±1 andp3 (mod 4), the Legendre symbol satisfies i

p

τ(i) p

= iτ(i)

p

=iτ(i) so that

σi= i

p

τ(i) p

τ(i)p−12 = i

p

·

Proof of Theorem 1, (iii). By the Euclidean division P(Xˆ )=

Xp−12 1

H(X)+R(X), deg(R) p3 2 ·

By Fermat’s Theorem, we have ˆP(i2)=R(i2)= ±i, and so, from (i), there existsσwith R=Pσ. Conversely, for any polynomialsHandPσ, polynomial ˆPdefined by (8) represents the square root inFp.

3. Existence of Short Polynomials

Proof of Theorem 2. First we observe that, sincep1 (mod 2r), there are 2r2r-th roots of unity inFp: ifgis a primitive root inFp, these roots of unity aregs,g2s,g3s, . . . ,g2r s=1, wheresis equal to(p−1)/(2r). Let us introduce now a familyQFp[X] of polynomials.

A polynomial Qbelongs toQif its degree is at mostr1, and if, whenx is ar-th root of unity (i.e.,x=g2j s with 1 jr), its valueQ(x)is the inverse of one of the square roots ofx (i.e., Q(x)= ±gj s). From the Lagrange interpolation Theorem, there are 2r polynomialsQQand they satisfy

forxFp such that xr=1, Q(x)2=1/x. (20)

(8)

Now, forQQ, let us consider the polynomial P(X)=Xp+2r−14r Q

Xp−12r .

From (11), the exponents are integers, and deg(P) p+2r1

4r +(r1)p−1

2r = p1

2 p2r1

4r . (21)

Ifp>2r+1, it follows from (21) that deg(P) p−32 . In the casep=2r+1, we replaceP by the remainder in the division ofPbyXp−12 1, which, from Lemma 1, does not increase the length. Moreover, iftbelongs toFp, anda=t2, thenap2r1 is ar-th root of unity since

ap−12r r

=ap−12 =tp−1=1 and, by (20),

(P(t2))2=(P(a))2=ap+2r−12r Q ap−12r 2

=ap+2r−12r ap−12r =a=t2

so that, by (2),Prepresents the square root inFp, and, obviously,(P)=(Q)r, which completes the proof of Theorem 2.

Remark. IfQbelongs to the familyQ, then trivially,−Qalso belongs to it. This family possesses another symmetry: if

Q(X)=q0+q1X+q2X2+ · · · +qr1Xr−1 belongs toQ, then the polynomial

Q(X˜ )=qr−1+qr−2X+ · · · +q1X+q0=Xr1Q 1

X

by (20) also belongs toQ.

4. Not Too Short Polynomials

Proof of Theorem 4. Let PFp[X] be a polynomial representing the square root inFp, i.e., satisfying (2). Letwbe a primitive 2n-th root of unity inFp(since 2n|(p−1), such a root does exist). From (2), we have

(P(w2i))2=w2i, 0i2n11 (22)

whence P(w2i)=εiwi withεi∈ {−1,1}. Let us define R(X)as the interpolation poly- nomial of the polynomialP on the pointsw2i, 0i2n−11. The classical Lagrange’s calculation gives

R(X)=

2n−11 i=0

X2n11 Xw2i

w2i

2n1εiwi. (23)

(9)

As both polynomialsPandRcoincide on the 2n−1-th roots of unity, there exists a polynomial Hsuch that

P(X)=R(X)+

X2n−11

H(X). (24)

From Lemma 1 withm=2n−1, we have(P)(R), and, in order to prove Theorem 4, it suffices to show

(R)2n−1. (25)

Further, let us calculate, from (23), the coefficients ofR. By expanding X2n−1−1=X2n−1−(w2i)2n−1=(X−w2i)

2n−11 h=0

Xhw2i(2n−1−1−h)

we get

R(X)= 1 2n−1

2n−1−1 h=0

2n−1−1 i=0

Xhεiwi(12h)= 1 2n−1

2n−1−1 h=0

ahXh (26)

with ah=

2n−1−1 i=0

εiwi(12h)=Aε

w(12h)

(27) whereεdenotes the vectorε=0, ε1, . . . , ε2n−11)andAεthe polynomial

Aε(X)=

2n−11 i=0

εiXi. (28)

Let2n(X)=X2n−1+1 be the cyclotomic polynomial of index 2n. It is well known that cyclotomic polynomials are irreducible inQ(X), and since the degree ofAεis, from (28), smaller than the degree of2n, the resultant Res(Aε, 2n), calculated inZ, is a non zero constantKε.If the coefficientahvanishes inFp,w(1−2h), which is a root of2n, is also, by (27), a root ofAεinFp. So, Res(Aε, 2n)calculated inFp should vanish and this means thatpdividesKε. So, we have to consider the product, or more precisely the least common multiple, of all these constantsKεfor all the 2n1possible values ofε:

n =l cm

Kε;ε=0, ε1, . . . , ε2n11)∈ {−1,+1}2n−1

=l cm

Res(Aε, 2n);ε=0, ε1, . . . , ε2n−1−1)∈ {−1,+1}2n−1 .

If pdoes not dividen, no coefficientah, 0h2n−11, can vanish inFp and, from (26), formula (25) holds. So, Theorem 4 is proved, by choosing forPn the set of prime factorspofnsatisfying p1 (mod 2n).

Références

Documents relatifs

In particular, we use the graph of a permutation to compute that number for a particular class of permutations in linear time and space, and derive a new tight upper bound on

The formula for the mean transmission rate is shown to boil down to the classical square root mean value formula for persistent flows when the average file size tends to

Given a Hilbert space H characterise those pairs of bounded normal operators A and B on H such the operator AB is normal as well.. If H is finite dimensional this problem was solved

In conclusion, each bounded connected component of the complement of the singular locus over a cylinder T i is glued with the unbounded component over the other cylinder through

Depending on the requested regularity, it goes from the Tietze extension theorem in normal topological spaces, where the required regularity is minimal (continuity), to results

We remind in section 2 the definition of the Connes-Moscovici Hopf alge- bra, as well as its properties and links with the Fa` a di Bruno Hopf algebra and

L’accès aux archives de la revue « Cahiers de topologie et géométrie différentielle catégoriques » implique l’accord avec les conditions générales d’utilisation

A SHORT PROOF OF FINITE MONODROMY FOR ANALYTICALLY IRREDUCIBLE PLANE CURVESE. Woods Noordhoff International