Ch9-QuadraticEuclidean.mws

The Division Algorithm and Quadratic Extensions

İMike May, S.J., maymk@slu.edu, Saint Louis University

>    restart;

Most of the concepts that we explored with the Gaussian integers can also be done with the ring Z[ sqrt(d) ]  whenver   0 < d .  As with the Gaussian integers there is an automorphism phi  that takes a+b*sqrt(d)  to a-b*sqrt(d) .  The norm of   a+b*sqrt(d)   is abs(a^2-d*b^2) = abs((a+b*sqrt(d))*(a-b*sqrt(d))) .  

These extensions of the integers have been studied a lot.  However, most of the results are beyond the scope of this course.  For technical reasons, it is easiest to state results if we restrict ourselves to values of D that are not congruent to 1 mod 4.  Then Z[ sqrt(d) ] is a Euclidean Domain with the given norm if and only if d is in the set {2, 3, 6, 7, 11, 19, 55} .  It can be shown that the ring is not a UFD if d is one of {10, 15, 26, 30} .  These results can be found in standard books on algebraic number theory.

Generalizing tools from the Gaussian integers

We would like to construct the mathematical tools we used with the Gaussian integers.  In particular we would like to construct the tools for a division algorithm,

We first need to define phi , the equivalent of conjugation.

>    phi := x -> subs(sqrt(d)=-sqrt(d),x);

phi := proc (x) options operator, arrow; subs(sqrt(d) = -sqrt(d),x) end proc

>    phi(a + b*sqrt(d));

a-b*d^(1/2)

Next we want to define a norm:

>    normd := x -> abs(expand(x*phi(x)));

normd := proc (x) options operator, arrow; abs(expand(x*phi(x))) end proc

>    normd(a+b*sqrt(d));

abs(-a^2+b^2*d)

We would also like functions for recovering a and b, the rational and irrational parts of a ring element.

>    ratd := x -> (x + phi(x))/2;
irratd := x -> (x - phi(x))/(2*sqrt(d));

ratd := proc (x) options operator, arrow; 1/2*x+1/2*phi(x) end proc

irratd := proc (x) options operator, arrow; 1/2*(x-phi(x))/sqrt(d) end proc

>    ratd(a+b*sqrt(d));
irratd(a+b*sqrt(d));

a

b

Following the pattern used with the Gaussian integers, we want to establish a nearest function.

>    neard := x -> round(rationalize(ratd(x))) + round(rationalize(irratd(x)))*sqrt(d);

neard := proc (x) options operator, arrow; round(rationalize(ratd(x)))+round(rationalize(irratd(x)))*sqrt(d) end proc

>    neard((a+b*sqrt(d))/(x+y*sqrt(d)));

round((a*x-b*d*y)/(x^2-y^2*d))+round((-a*y+b*x)/(x^2-y^2*d))*d^(1/2)

This is enough to define quotients and remainders over these rings.

>    quod := (x,y) -> neard(x/y);
remd := (x,y) -> expand(x - y*neard(x/y));

quod := proc (x, y) options operator, arrow; neard(x/y) end proc

remd := proc (x, y) options operator, arrow; expand(x-y*neard(x/y)) end proc

>   

The easy cases, d=2 or 3

When d is 2 or 3, the above constructions let us mimic what has we did with the Gaussian integers.  Note that for the Euclidean algorithm to work the remainder needs to be smaller than the divisor.

Lets see that the definitions work.  To do that we need a specific value of d.  We will start with d = 2.

>    d := 2;

d := 2

We also need to define a u0 and r0 to work with.

>    a :=37 + 29 * sqrt(d);  b := 3 + 5 * sqrt(d);
'norm(a)' = normd(a);
'norm(b)' = normd(b);

a := 37+29*2^(1/2)

b := 3+5*2^(1/2)

norm(a) = 313

norm(b) = 41

Now we find the quatient and the remainder and check the size of the remainder

>    q0 := quod(a, b);  
r0 := remd(a, b);
`the norm of r0 ` = normd(r0);

q0 := 4+2*2^(1/2)

r0 := 5+3*2^(1/2)

`the norm of r0 ` = 7

Now we repeat the process until we get a remainder of zero

>    q1 := quod(b, r0);  
r1 := remd(b, r0);
`the norm of r1 ` = normd(r1);

q1 := -2+2*2^(1/2)

r1 := 1+2^(1/2)

`the norm of r1 ` = 1

>    q2 := quod(r0, r1);  
r2 := remd(r0, r1);
`the norm of r2 ` = normd(r2);

q2 := 1+2*2^(1/2)

r2 := 0

`the norm of r2 ` = 0

The last nonzero remainder is the GCD.

Exercises

1)  If d = 2, find the gcd of 85 and 3+17*sqrt(d) .

2)  If d = 3, find the gcd of 85 and 3+17*sqrt(d) .

A case where the the division algorithm fails, d=5

The reason the methods developed for the Gaussian integers work so well in the first two cases is that if d is 2 or 3, then the norm of   a+b*sqrt(d) < 1 , whenever the absolute value of both a and b is bounded by   1/2 .    (Our divisor and remainder method produces a remainder that is a+b*sqrt(d)   times the divisor where a+b*sqrt(d)   is the amount we rounded off to produce our quotient.)  This means that the norm of the remainder is less than the norm of the divisor.  The method breaks down when d = 5.  In that case the norm of   alpha = 1/2+1/2*sqrt(d)   is 1.  One is tempted to see if alpha  is closer to other latice points, but if a  and b  are odd integers, then the norm of (a+b*sqrt(5))/2  is always at least 1.

Part of the problem is that alpha  is a unit of Q[ sqrt(5) ], so   y   and    alpha*y    try to act like associates with no remainder.  It is worthwhile noting that in Z[ (1+sqrt(5))/2 ] the given norm is Euclidean.

>    d := 5; normd(1/2 + 1/2*sqrt(d));

d := 5

1

Exercises:

3)  Verify the the algorithm does not satisfy the division algorithm when d = 5, x = 7+sqrt(d) , y = 6+4*sqrt(d) .

A case when the division algorithm requires trickery, d=7

Somewhat contrary to intuition, the case of d = 7 is better than when d = 5.  We need to recall that the size of a+b*sqrt(d)    is    abs(a^2-d*b^2) .  This leads to the interesting observation that when,   0 <= a, b <= 1/2  , the origin may not be the closest point.

The method we have been using to establish the division algorithm is to divide x  by y  producing alpha = x/y  in Q[ sqrt(d) ], then round alpha  to beta , the nearest member of Z[ sqrt(d) ], and show that if the norm of alpha-beta   is less than 1, then the remainder is y*(alpha-beta) , and this has norm less than the norm of y.  

When d was 2 or 3, we got the ring element closest to a+b*sqrt(d)  by rounding a  and b .  When d = 7, we need to be more clever.  Notice that intuitively bigger ring elements can have smaller norms.

>    d := 7;
`norm (1/2 + 1/2 sqrt(7)) ` = normd(1/2 + 1/2*sqrt(d));
`norm (3/2 + 1/2 sqrt(7)) ` = normd(3/2 + 1/2*sqrt(d));

d := 7

`norm (1/2 + 1/2 sqrt(7)) ` = 3/2

`norm (3/2 + 1/2 sqrt(7)) ` = 1/2

This means that 1/2+1/2*sqrt(7)  is closer to -1 than to 0.

In general, we need to show that given any a+b*sqrt(7)  in Q[ sqrt(7) ], we can find   m+n*sqrt(7)  in Z[ sqrt(7) ] such that the norm of a-m+(b-n)*sqrt(7)  has norm less than 1.

We first note that it is sufficient by symmetry to consider only the cases when 0 <= a, b <= 1/2  .

We will show that all such points are within 1 of either (0,0), or (-1, 0).

First consider the points that are within 1 of the origin.  Those are the points in the region containing the origin and bounded by the hyperbolas   x^2-7*y^2 = 1  and x^2-7*y^2 = -1 .  In the region we are concerned with, that is the set of points below the curve y = sqrt((1+x^2)/7) .

>    plot({.5, sqrt((1 + x^2)/7)}, x = -.1..0.6, y = 0..0.6);

[Maple Plot]

As you can see, that gets most of the region we are concerned with.  We now look at the points within 1 of the point (-1, 0).  In terms of our norm, that is the set of points in the region containing (-1, 0) and bounded by the hyperbolas     (x+1)^2-7*y^2 = 1  and (x+1)^2-7*y^2 = -1 .   Equivalently, it is the set of points between the curves y = sqrt((1+(x+1)^2)/7)   and    y = sqrt((-1+(x+1)^2)/7) .

>    plot({sqrt((1 + (x+1)^2)/7), sqrt((-1 + (x+1)^2)/7)}, x = -.1..0.6, y = 0..0.6);

[Maple Plot]

Putting the curves together, we see that this takes care of all points except for a single point.

>    plot({sqrt((1 + x^2)/7),  sqrt((1 + (x+1)^2)/7), sqrt((-1 + (x+1)^2)/7)}, x = -.1..0.6, y = 0..0.6);

[Maple Plot]

The only point of concern is the one on the boundary in both cases.  Elementary algebra shows that this point is [1/2, sqrt(5)/(2*sqrt(7))] , but that is not a rational point, and does not have to be considered.

Thus our method of dividing in the associated field and rounding  works, we simply have to round the quotient in the nontrivial fasion described above.

Exercise:

4)  Use the division algorithm to find the gcd of 98+79*sqrt(7)  and 65+63*sqrt(7)  in the ring Z[ sqrt(7) ].