previous up next contents
Previous: 1 Introduction Up: From Euclid to Padé Next: 3 Polynomials   Contents

Subsections


2 Algorithms to compute the Bezout's coefficients

2.1 Euclidean versus principal

The Euclidean algorithm is involved in a well-know dilemma in mathematics: "existence" theorems are fine, but you better have a "constructive" one. In other words, a theorem that state for the existence of some object, without giving any means to construct it, is "better than nothing" but rather disappointing.

You can define a principal ring maths by the property that any ideal maths, i.e. any set verifying maths together with maths, is the set of the multiples of some maths. In such a case, for any given maths, it exists a maths such that maths, and that relation can be seen as a defining maths, the so-called maths of maths and maths (in fact maths is defined modulo the equivalence maths, i.e. maths).

But to exhibit such a principal ring is another task if you have not an explicit algorithm to compute maths. In fact, the ``top 50'' principal rings are ``Euclidean'', except for maths... in which a ``quasi-Euclidean'' algorithm allows nevertheless to work. Historically, Euclid used his algorithm to compute the maths of two numbers, for factoring purpose, and to reduce ratios in their lowest terms. Therefore the existence of maths such that maths was not pointed out at Euclid's time.

The idea that maths are the key result of the algorithm, and maths ``only'' a by-product, is a recent one (Bezout, Gauss). This distinction appears again while programming the algorithm itself. You can go to maths and come back to maths or you can go directly to the Bezout's coefficients.


2.2 Euclidean algorithm, then back

A first idea to compute maths is as follows. Starting from maths and maths, the following steps are iterated. The integer quotient of maths by maths is computed, i.e. maths and the corresponding remainder maths. When maths, the first phase is over, and maths. At that point, we have maths, where maths and maths. Let us denote by maths the number of steps during this phase.

We now put maths and go back to maths by the following steps. Assuming maths for some maths, we can reuse the maths relation, and obtain maths. Therefore maths where maths and maths. A good idea to remember the maths is to put them in a stack, i.e. in a data structure where objects that are processed in a "last come, first served" order.

Using maths to create an empty stack, maths to store an element into the stack and maths to recover a previously stored object, we obtain Algorithm 1.


maths

The explicit use of a data stack can be avoided with a recursive writing, leading to Algorithm 2. The program source becomes shorter, but the algorithm remains the same, and an implicit call to the system stack is done to store the successive quotients between their utilization in the first phase to build the next remainder maths and their reutilization in the second phase to build the next pair maths.


maths

2.3 Straightforward Bezout's algorithm

A more efficient algorithm is Algorithm 3. Often quoted as ``extended Euclidean algorithm'', this algorithm is something rather different, and will be better referenced as Bezout's algorithm. It is to be noticed that this algorithm is often proved by induction over the number maths of steps required for the ``true Euclidean'' algorithm i.e., by the two stage reasoning : to maths and back to maths.


maths

Before to examine the correction of Algorithm 3, it is worthwhile to mention the superiority of this algorithm over 1 or 2. All of them are maths in time, but the former is maths in space, while the others require a maths space to store the maths.

The idea is to consider the very signature of Algorithm 2 as having a worthwhile mathematical meaning, and not only as a ``messy trick in the sublevels''. Defining mathsas maths and accordingly maths as maths, the equation maths can be seen as describing a linear transform maths in maths, whose matrix is given by maths.

After maths steps, the algorithm ends with maths where maths. Naming the elements of maths by maths we obviously have maths together with maths. Therefore the Euclidean algorithm can be described as storing the maths until maths is reached and thereafter computing maths from left to right, while the Bezout's algorithm can be described as computing maths iteratively, from right to left, without having to store the maths. And the same trick can be used as in Gauss-Jordan elimination: the original column is augmented with a matrix initialized to the matrix unity. When the column is reduced, the right part of the enlarged matrix contains the result of the undertaken action, viz. their product.

And a first result follows: maths is the irreducible expression of maths. This can be seen from maths. Therefore maths, and the Bezout's theorem itself ensure that maths are coprime.

2.4 Matricial writing

For teaching purpose, the algorithm can be explicitely written with matrices, and the whole process can be summarized by Algorithm 4. We have adopted a ``Maple-like'' syntax, and its flexibility. To be more precise, maths is a Maple-table, that is emptied by maths. Such an object grows as required, without constraints on the indices range, while it's elements are matrices.


maths

Starting with maths and maths, we obtain Figure 1, that states that:

maths

Therefore maths, while maths.

FIG.  1: Bezout's algorithm for integers.
maths

2.5 Centered algorithm

This algorithm can be accelerated by using ``centered remainders'' i.e. by requiring that maths in maths instead of maths. In a symbolic computing environment, this is easily done. You define your own maths, and call it, say, maths as in Algorithm 5. Thereafter you says subs(iquo = iquo2, mat_bezout) and the job is done, leading to Figure 2.

FIG.  2: Centered Bezout's algorithms.
maths


maths

It can be shown that the worst case for the ordinary Euclidean is attained when maths are consecutive in the Fibonacci sequence. In such a case, we have maths, involving the golden number maths. The worst case for the centered algorithm is attained for successive elements of the sequence maths where maths and maths. In such a case maths, involving maths.

It will be shown in Section 4 that the set of the maths obtained during the centered algorithm is a subset of the set obtained during the ordinary one: accelerating, but on the same road.


previous up next contents
Previous: 1 Introduction Up: From Euclid to Padé Next: 3 Polynomials   Contents


douillet@ensait.fr
2005-02-09