# Euclidean Division

The Euclidean division or whole division is an operation which, with two natural entireties called dividing dividend and , associates two entireties called quotient and remains . Initially defined in the whole natural nonnull, it spreads with the whole relative and the Polynôme S, for example.

This division is at the base of the modular Arithmétique and gives place to the creation of the congruences on the entireties.

## Definitions

### Euclidean division in the positive whole

$\ forall \left(has, b\right) \ in \ mathbb \left\{NR\right\} \ times \ mathbb \left\{NR\right\} ^*, \ exists! \left(Q, R\right) \ in \ mathbb \left\{NR\right\} \ times \ mathbb \left\{NR\right\}, a=b.q+r \ quad and \ quad R < b$

With two entireties has and B , with B not no one, Euclidean division associates a single quotient Q and a single remainder R , all two entireties, checking:

• $a = b.q+r \,$
• $r < B \;$

The assertion of the existence and the unicity of the remainder and the quotient is called Théorème of Euclidean division for the positive entireties .

### Euclidean division in the relative whole

$\ forall \left(has, b\right) \ in \ mathbb \left\{Z\right\} \ times \ mathbb \left\{Z\right\} ^*, \ exists Q, R \ in \ mathbb \left\{Z\right\}/a=b.q+r \ quad and \ quad |R| < |B|$

With two entireties has and B , with B not no one, Euclidean division associates a quotient Q and a remainder R , all two entireties, checking:

• $a = b.q+r \,$
• $|R| < |B|\;$

The assertion of the existence of the remainder and the quotient is called Théorème of Euclidean division for the entireties .

If it were possible to define a division such as the unicity of the quotient and of the remainder is guaranteed, it would be nevertheless incompatible with the major general case in the Euclidean rings.

### Euclidean division in the whole of the polynomials

Euclidean division according to the decreasing powers exists if the ring is defined on a body: $\ forall \left(has, B\right) \ in \ mathbb \left\{K\right\} \ times \ mathbb \left\{K\right\} ^*, \ quad \ exists! Q, R \ in \ mathbb \left\{K\right\}, A=B.Q+R \ quad with \ quad \ operatorname \left\{deg\right\} \left(R\right) < \ operatorname \left\{deg\right\} \left(B\right)$

With two polynomials has and B with coefficients in a body K with B not no one, Euclidean division associates a single quotient Q and a single remainder R , all two polynomials, checking:

• $A=B.Q+R \,$
• $\ operatorname \left\{deg\right\} \left(R\right) < \ operatorname \left\{deg\right\} \left(B\right)$
Unicity is guaranteed here, on the other hand it is necessary that K is a body. If not division is still sometimes possible, if for example the coefficient of the Monôme dominating of B is equal to 1.

### Euclidean division in a ring

In certain types of just unit commutative rings, one can define an Euclidean division by

has = bq + R with R = 0 or v (R) < v (b) v being an application of has - { 0 } in $\ mathbb Euclidean N$ called stathme . This application checks the following property: if has and B is two elements of has such as B divides has , then v (b) $\ scriptstyle \left\{\ Leq\right\}$ v (A).
These rings are called Euclidean rings.

## Algorithms of calculation

One is interested in calculation of Euclidean division of two entireties, knowing as a preliminary the operations of addition, subtraction, multiplication, and comparison, between integers. It is easy to bring back the problem to two positive entireties, and one restricts oneself with this case.

The algorithms described below calculate the quotient of Euclidean division; it is quite clear that the remainder from of deduced. Attention, the opposite would not be true.

First method, natural but naive, request far too many calculations for great numbers. One presents then two current methods, of similar complexity: the first is appropriate for calculations in bases 2 , and thus for data-processing programming; the second method, primarily equivalent, is an adaptation for the base of usual numeration, the decimal base, and is thus appropriate for calculations for the hand. It is the algorithm taught at the school.

### Naive method

To carry out the Euclidean division of has by B , one builds a strictly decreasing continuation $\left(a_i\right)$ defined by a relation of recurrence of step 1: $a_0=a$, then $a_ \left\{i+1\right\} =a_i-b=a- \left(i+1\right) \ times b$. There thus exists a smaller entirety I such as , which is still written

The number of steps of this algorithm is thus $I= \ frac \left\{has\right\} \left\{B\right\}$; each stage requires a subtraction and a comparison; the complexity of calculation grows linearly with has , i.e. exponentially with the size of has - if one agrees to measure the size of an entirety by the number of figures which its binary development requires (or decimal if it is preferred, that modifies the things only one constant), this size is about the logarithm of the entirety.

### Current, binary method

A simple improvement consists in making a dichotomic research , on the quotient: instead of traversing like previously all the entireties since $0$ while waiting for to fall on the good quotient, one will start by quickly finding an entirety which one will be sure that it is larger than the sought quotient; in the finished list of remaining possible quotients, one will make a binary search.

The first calculation is done simply by considering the geometrical continuation $2^n$. As long as $2^n \ times B \ a$, one increments N of 1 with each stage. That is to say $N$ smallest entirety such as $2^N \ times B >a \,$. The number of stages to find this entirety is about $log_2 \ left \left(\ frac \left\{has\right\} \left\{B\right\} \ right\right)$. Each one of these stages requires only one multiplication by two (even easier than an addition, for a binary writing), and a comparison.

For the second calculation, one builds two continuations $\left(\ alpha_n\right)$ and $\left(\ beta_n\right)$; one will store undervaluing sought quotient, the other of raising strict. One thus poses $\ alpha_0=2^ \left\{N-1\right\}$ and $\ beta_0=2^N$, then by recurrence:

if $\ frac \left\{\ alpha_n+ \ beta_n\right\} \left\{2\right\} \ times B \ a$, then one can refine undervaluing it, and one thus poses $\ alpha_ \left\{n+1\right\} = \ frac \left\{\ alpha_n+ \ beta_n\right\} \left\{2\right\}$ and $\ beta_ \left\{n+1\right\} = \ beta_n \,$
on the other hand, if $\ frac \left\{\ alpha_n+ \ beta_n\right\} \left\{2\right\} \ times B > a$, one can refine raising it, and one poses $\ beta_ \left\{n+1\right\} = \ frac \left\{\ alpha_n+ \ beta_n\right\} \left\{2\right\}$, and $\ alpha_\left\{n+1\right\} = \ alpha_n \,$.

One easily shows by recurrence that with each stage N of this second calculation, $\ alpha_n$ and $\ beta_n$ are two entireties, both multiples of $2^ \left\{N-1-n\right\}$ and of which the difference is worth $2^ \left\{N-1-n\right\}$; this remark in particular makes it possible to show that the continuations are well defined until $n=N-1$, and that $\ alpha_ \left\{N-1\right\}$ and $\ beta_ \left\{N-1\right\}$ differs only from 1 ; since they are respectively one undervaluing broad and one raising strict quotient, $\ alpha_ \left\{N-1\right\}$est the sought quotient.

The maximum number of stages for this calculation is about $log_2 \ left \left(\ frac \left\{has\right\} \left\{B\right\} \ right\right)$ (one of the dichotomies could give the good quotient before the NR - 1 ème stage, it is the case of equality of the comparison, in which case one can stop the front algorithm), which each one requires only one addition, a division by two (easy in binary writing, it is not obviously an Euclidean division not hidden), a multiplication (which can be avoided, by managing more variables), and a comparison.

By concaténant the results of two calculations, one sees that this algorithm has a complexity which grows logarithmiquement with $\ frac \left\{has\right\} \left\{B\right\}$, and thus linearly with the size of has . The improvement is thus very clear.

### Current, decimal method

That is to say two natural entireties has and $b \ neq 0$ which one wants to carry out division. One starts by finding the smallest power of 10 such as $b \ times 10^ \left\{N_1+1\right\} \ geq a$; according to the theorem of Euclidean division, there exists then a single entirety $0 \ Leq q_1<10$ such as: $q_1 \ times 10^ \left\{N_1\right\} \ times B \ Leq a< \left(q_1+1\right) \ times 10^ \left\{N_1\right\} \ times b$. One thus brings back oneself to make the division of $a-q_1 \ times 10^ \left\{N_1\right\} \ times b$ by $b$; the preceding inequality shows that the first power of 10 such as $10^ \left\{N_2\right\} \ times b$ will exceed $a-q_1 \ times 10^ \left\{N_1\right\} \ times b$ will be strictly smaller than $10^ \left\{N_1+1\right\}$; it is noted $10^ \left\{N_2+1\right\}$. One builds a succession of natural entireties thus $\left(N_i\right)$ strictly decreasing; it is worth thus 0 with a certain row; one builds the continuation of entireties $0 \ Leq q_i< 10$ associated same façonqu' one built $q_1$. The sought quotient will be $\ sum_i q_i10^ \left\{N_i\right\}$: indeed the inequality which gives $q_r$ for the first occurrence of $N_r=0$ will be: $0 \ Leq a-b \ times \ sum_i q_i10^ \left\{N_i\right\} <10^ \left\{N_r\right\} \ times b=b$, which is well the definition of the quotient.

It is noticed that this method is divided like the preceding one into two stages: initially a search for a power rather large, which again asks for a number of calculation logarithmic curve in has , i.e. linear in the size of has ; then a calculation of all the coefficients $q_i$ associated with the various powers of 10 lower than the rather large power obtained. For each calculation of $q_i$, the algorithm asks for in fact a calculation of Euclidean division intermediate; but the quotient is to be sought only among the entireties of 0 with 9 ; it is thus done quickly by using tables.

This method is that used in primary education lorqu' it acts Poser a division.