User:Pantnkrator/sandbox

= Blankinship Algorithm = Is an algoritm for compute the Greatest common divisor of a set of numbers. Was first published by W. A. Blankiinship.

The GCD of a set of numbers can be representated as:

$$ d = a_1x_1+a_2x_2+ \dots + a_nx_n $$

What is called Bezout Identity, this numbers ( $$x_i$$) can be obtained with the Extended Euclidean Algorithm, but Blankinship present a algorithm wich, although eqivalent to the Euclidean, is much easier to visualize, is easily programmed either on paper or on a computer, and, in addition, produces the $$x$$'s

The original representation of Blankinship Algorithm uses a matrix, with the first column the set of numbers to compute the GCD and the Identity Matrix

$$\begin{pmatrix} a_1 & 1 & 0 & \dots & 0\\ a_2 & 0 & 1 & \dots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots \\ a_n & 0 & 0 & \dots & 1\\ \end{pmatrix}$$

Although that is the representation of the autor, is usual use the transposed matrix, will proced with the case of compute the GCD of two numbers but it can be extended a set of numbers.

$$\begin{pmatrix} a_1 & a_2\\ 1 & 0 \\ 0 & 1 \\ \end{pmatrix}$$

Starting with this can get the following algorithm

$$\begin{pmatrix} a_1 & a_2\\ 1 & 0 \\ 0 & 1 \\ \end{pmatrix} \times \begin{pmatrix} 0 & 1\\ 1 & -q \\ \end{pmatrix} $$

With $$q=a_1/a_2$$

This produces the following matrix as result:

$$\begin{pmatrix} a_2 & a_1-q\cdot a_2\\ 0 & 1 \\ 1 & -q \\ \end{pmatrix} $$

Then repeat this process until we have the GCD in the first row. The process described above is equivalent to apply the Euclidean Algorithm. Whit this we can formulate the matrix algorithm:

Pseudocode
Input: $$a,b \in \mathbf{Z}$$

Output: $$S_{11}, x_1=S_{2,1}, x_2=S_{3,1}$$ 1 $$S = \begin{pmatrix} a & b\\ 1 & 0 \\ 0 & 1 \\  \end{pmatrix} $$ 2 while $$S_{12} \not = 0 $$do 3     $$Q = \begin{pmatrix} 0 & 1\\ 1 & -(S_{11}/S_{12}) \\ \end{pmatrix} $$ 4     $$S = S\cdot Q $$ 5 end while