
In
arithmetic
Arithmetic is an elementary branch of mathematics that deals with numerical operations like addition, subtraction, multiplication, and division. In a wider sense, it also includes exponentiation, extraction of roots, and taking logarithms.
...
, Euclidean division – or division with remainder – is the process of
dividing one
integer
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
(the dividend) by another (the divisor), in a way that produces an integer
quotient and a natural number
remainder
In mathematics, the remainder is the amount "left over" after performing some computation. In arithmetic, the remainder is the integer "left over" after dividing one integer by another to produce an integer quotient ( integer division). In a ...
strictly smaller than the
absolute value
In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if x is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), ...
of the divisor. A fundamental property is that the quotient and the remainder exist and are unique, under some conditions. Because of this uniqueness, ''Euclidean division'' is often considered without referring to any method of computation, and without explicitly computing the quotient and the remainder. The methods of computation are called
integer division algorithms, the best known of which being
long division.
Euclidean division, and algorithms to compute it, are fundamental for many questions concerning integers, such as the
Euclidean algorithm
In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is a ...
for finding the
greatest common divisor
In mathematics, the greatest common divisor (GCD), also known as greatest common factor (GCF), of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For two integers , , the greatest co ...
of two integers,
and
modular arithmetic
In mathematics, modular arithmetic is a system of arithmetic operations for integers, other than the usual ones from elementary arithmetic, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to mo ...
, for which only remainders are considered. The operation consisting of computing only the remainder is called the ''
modulo operation
In computing and mathematics, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another, the latter being called the ''modular arithmetic, modulus'' of the operatio ...
'', and is used often in both mathematics and computer science.
Division theorem
Euclidean division is based on the following result, which is sometimes called Euclid's division lemma.
Given two integers and , with , there exist
unique integers and such that
:
and
:,
where denotes the
absolute value
In mathematics, the absolute value or modulus of a real number x, is the non-negative value without regard to its sign. Namely, , x, =x if x is a positive number, and , x, =-x if x is negative (in which case negating x makes -x positive), ...
of .
In the above theorem, each of the four integers has a name of its own: is called the , is called the , is called the and is called the .
The computation of the quotient and the remainder from the dividend and the divisor is called , or in case of ambiguity, . The theorem is frequently referred to as the (although it is a theorem and not an algorithm), because its proof as given below lends itself to a simple division algorithm for computing and (see the section
Proof for more).
Division is not defined in the case where ; see
division by zero
In mathematics, division by zero, division (mathematics), division where the divisor (denominator) is 0, zero, is a unique and problematic special case. Using fraction notation, the general example can be written as \tfrac a0, where a is the di ...
.
For the remainder and the
modulo operation
In computing and mathematics, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another, the latter being called the ''modular arithmetic, modulus'' of the operatio ...
, there are conventions other than , see .
Generalization
Although originally restricted to integers, Euclidean division and the division theorem can be generalized to
univariate polynomials over a
field and to Euclidean domains.
In the case of
univariate polynomials, the main difference is that the inequalities
are replaced with
:
or
where
denotes the
polynomial degree.
In the generalization to Euclidean domains, the inequality becomes
:
or
where
denote a specific function from the domain to the natural numbers called a "Euclidean function".
The uniqueness of the quotient and the remainder remains true for polynomials, but it is false in general.
History
Although "Euclidean division" is named after
Euclid
Euclid (; ; BC) was an ancient Greek mathematician active as a geometer and logician. Considered the "father of geometry", he is chiefly known for the '' Elements'' treatise, which established the foundations of geometry that largely domina ...
, it seems that he did not know the existence and uniqueness theorem, and that the only computation method that he knew was the
division by repeated subtraction.
Before the invention of
Hindu–Arabic numeral system
The Hindu–Arabic numeral system (also known as the Indo-Arabic numeral system, Hindu numeral system, and Arabic numeral system) is a positional notation, positional Decimal, base-ten numeral system for representing integers; its extension t ...
, which was introduced in Europe during the 13th century by
Fibonacci
Leonardo Bonacci ( – ), commonly known as Fibonacci, was an Italians, Italian mathematician from the Republic of Pisa, considered to be "the most talented Western mathematician of the Middle Ages".
The name he is commonly called, ''Fibonacci ...
, division was extremely difficult, and only the best mathematicians were able to do it . Presently, most
division algorithms, including
long division, are based on this numeral system or its variants, such as
binary numerals. A notable exception is
Newton–Raphson division, which is independent from any
numeral system
A numeral system is a writing system for expressing numbers; that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner.
The same sequence of symbols may represent differe ...
.
The term "Euclidean division" was introduced during the 20th century as a shorthand for "division of
Euclidean rings". It has been rapidly adopted by mathematicians for distinguishing this division from the other kinds of
division of numbers.
Intuitive example
Suppose that a pie has 9 slices and they are to be divided evenly among 4 people. Using Euclidean division, 9 divided by 4 is 2 with remainder 1. In other words, each person receives 2 slices of pie, and there is 1 slice left over.
This can be confirmed using multiplication, the inverse of division: if each of the 4 people received 2 slices, then 4 × 2 = 8 slices were given out in total. Adding the 1 slice remaining, the result is 9 slices. In summary: 9 = 4 × 2 + 1.
In general, if the number of slices is denoted
and the number of people is denoted ''
'', then one can divide the pie evenly among the people such that each person receives ''
'' slices (the quotient), with some number of slices
being the leftover (the remainder). In which case, the equation
holds.
If 9 slices were divided among 3 people instead of 4, then each would receive 3 and no slice would be left over, which means that the remainder would be zero, leading to the conclusion that 3 ''evenly divides'' 9, or that 3 ''
divides'' 9.
Euclidean division can also be extended to negative dividend (or negative divisor) using the same formula; for example −9 = 4 × (−3) + 3, which means that −9 divided by 4 is −3 with remainder 3.
Examples
*If ''a'' = 7 and ''b'' = 3, then ''q'' = 2 and ''r'' = 1, since 7 = 3 × 2 + 1.
*If ''a'' = 7 and ''b'' = −3, then ''q'' = −2 and ''r'' = 1, since 7 = −3 × (−2) + 1.
*If ''a'' = −7 and ''b'' = 3, then ''q'' = −3 and ''r'' = 2, since −7 = 3 × (−3) + 2.
*If ''a'' = −7 and ''b'' = −3, then ''q'' = 3 and ''r'' = 2, since −7 = −3 × 3 + 2.
Proof
The following proof of the division theorem relies on the fact that a decreasing sequence of non-negative integers stops eventually. It is separated into two parts: one for existence and another for uniqueness of ''
'' and ''
''. Other proofs use the
well-ordering principle (i.e., the assertion that every
non-empty set of
non-negative integers has a smallest element) to make the reasoning simpler, but have the disadvantage of not providing directly an algorithm for solving the division (see for more).
Existence
For proving the existence of Euclidean division, one can suppose
since, if
the equality
can be rewritten
So, if the latter equality is a Euclidean division with
the former is also a Euclidean division.
Given
and
there are integers
and
such that
for example,
and
if
and otherwise
and
Let
and
be such a pair of numbers for which
is nonnegative and minimal. If
we have Euclidean division. Thus, we have to prove that, if
then
is not minimal. Indeed, if
one has
with
and
is not minimal
This proves the existence in all cases. This provides also an
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
for computing the quotient and the remainder, by starting from
(if
) and adding
to it until
However, this algorithm is not efficient, since its number of steps is of the order of
Uniqueness
The pair of integers and such that is unique, in the sense that there can be no other pair of integers that satisfy the same condition in the Euclidean division theorem. In other words, if we have another division of by , say with , then we must have that
:.
To prove this statement, we first start with the assumptions that
:
:
:
:
Subtracting the two equations yields
:.
So is a divisor of . As
:
by the above inequalities, one gets
:,
and
:.
Since , we get that and , which proves the uniqueness part of the Euclidean division theorem.
Effectiveness
In general, an existence proof does not provide an algorithm for computing the existing quotient and remainder, but the above proof does immediately provide an algorithm (see
Division algorithm#Division by repeated subtraction), even though it is not a very efficient one as it requires as many steps as the size of the quotient. This is related to the fact that it uses only additions, subtractions and comparisons of integers, without involving multiplication, nor any particular representation of the integers such as decimal notation.
In terms of decimal notation,
long division provides a much more efficient algorithm for solving Euclidean divisions. Its generalization to
binary and
hexadecimal
Hexadecimal (also known as base-16 or simply hex) is a Numeral system#Positional systems in detail, positional numeral system that represents numbers using a radix (base) of sixteen. Unlike the decimal system representing numbers using ten symbo ...
notation provides further flexibility and possibility for computer implementation. However, for large inputs, algorithms that reduce division to multiplication, such as
Newton–Raphson, are usually preferred, because they only need a time which is proportional to the time of the multiplication needed to verify the result—independently of the multiplication algorithm which is used (for more, see
Division algorithm#Fast division methods).
Variants
The Euclidean division admits a number of variants, some of which are listed below.
Other intervals for the remainder
In Euclidean division with as divisor, the remainder is supposed to belong to the
interval of length . Any other interval of the same length may be used. More precisely, given integers
,
,
with
, there exist unique integers
and
with
such that
.
In particular, if
then
. This division is called the ''centered division'', and its remainder
is called the ''centered remainder'' or the least absolute remainder''.
This is used for approximating
real number
In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
s: Euclidean division defines
truncation, and centered division defines
rounding
Rounding or rounding off is the process of adjusting a number to an approximate, more convenient value, often with a shorter or simpler representation. For example, replacing $ with $, the fraction 312/937 with 1/3, or the expression √2 with ...
.
Montgomery division
Given integers
,
and
with
and
let
be the
modular multiplicative inverse
In mathematics, particularly in the area of arithmetic, a modular multiplicative inverse of an integer is an integer such that the product is congruent to 1 with respect to the modulus .. In the standard notation of modular arithmetic this cong ...
of
(i.e.,