HOME

TheInfoList




In
mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and their changes (cal ...
, the remainder is the amount "left over" after performing some computation. In
arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne', 'art' or 'cr ...
, the remainder is the integer "left over" after dividing one
integer An integer (from the Latin Latin (, or , ) is a classical language A classical language is a language A language is a structured system of communication Communication (from Latin ''communicare'', meaning "to share" or "to ...
by another to produce an integer
quotient In arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne', ...
(
integer division Division is one of the four basic operations of arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη# ...
). In
algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In its most ge ...

algebra
of polynomials, the remainder is the polynomial "left over" after dividing one polynomial by another. The ''
modulo operation In computing, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another (called the ''modular arithmetic, modulus'' of the operation). Given two positive numbers a ...
'' is the operation that produces such a remainder when given a dividend and divisor. Alternatively, a remainder is also what is left after
subtracting
subtracting
one number from another, although this is more precisely called the ''difference''. This usage can be found in some elementary textbooks; colloquially it is replaced by the expression "the rest" as in "Give me two dollars back and keep the rest." However, the term "remainder" is still used in this sense when a
function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern comp ...
is approximated by a
series expansion In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
, where the error expression ("the rest") is referred to as the
remainder term In mathematics, a series is, roughly speaking, a description of the operation of adding infinitely many quantities, one after the other, to a given starting quantity. The study of series is a major part of calculus and its generalization, mathem ...
.


Integer division

Given an
integer An integer (from the Latin Latin (, or , ) is a classical language A classical language is a language A language is a structured system of communication Communication (from Latin ''communicare'', meaning "to share" or "to ...
''a'' and a non-zero integer ''d'', it can be shown that there exist unique integers ''q'' and ''r'', such that and . The number ''q'' is called the ''
quotient In arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne', ...
'', while ''r'' is called the ''remainder''. (For a proof of this result, see
Euclidean division In arithmetic, Euclidean division – or division with remainder – is the process of division (mathematics), dividing one integer (the dividend) by another (the divisor), in a way that produces a quotient and a remainder smaller than the divisor ...
. For algorithms describing how to calculate the remainder, see
division algorithm A division algorithm is an algorithm which, given two integers N and D, computes their quotient and/or remainder, the result of Euclidean division. Some are applied by hand, while others are employed by digital circuit designs and software. Divisi ...
.) The remainder, as defined above, is called the ''least positive remainder'' or simply the ''remainder''. The integer ''a'' is either a multiple of ''d'', or lies in the interval between consecutive multiples of ''d'', namely, ''q⋅d'' and (''q'' + 1)''d'' (for positive ''q''). In some occasions, it is convenient to carry out the division so that ''a'' is as close to an integral multiple of ''d'' as possible, that is, we can write :''a'' = ''k⋅d'' + ''s'', with , ''s'', ≤ , ''d''/2, for some integer ''k''. In this case, ''s'' is called the ''least absolute remainder''. As with the quotient and remainder, ''k'' and ''s'' are uniquely determined, except in the case where ''d'' = 2''n'' and ''s'' = ± ''n''. For this exception, we have: : ''a'' = ''k⋅d'' + ''n'' = (''k'' + 1)''d'' − ''n''. A unique remainder can be obtained in this case by some convention—such as always taking the positive value of ''s''.


Examples

In the division of 43 by 5, we have: : 43 = 8 × 5 + 3, so 3 is the least positive remainder. We also have that: : 43 = 9 × 5 − 2, and −2 is the least absolute remainder. These definitions are also valid if ''d'' is negative, for example, in the division of 43 by −5, :43 = (−8) × (−5) + 3, and 3 is the least positive remainder, while, :43 = (−9) × (−5) + (−2) and −2 is the least absolute remainder. In the division of 42 by 5, we have: :42 = 8 × 5 + 2, and since 2 < 5/2, 2 is both the least positive remainder and the least absolute remainder. In these examples, the (negative) least absolute remainder is obtained from the least positive remainder by subtracting 5, which is ''d''. This holds in general. When dividing by ''d'', either both remainders are positive and therefore equal, or they have opposite signs. If the positive remainder is ''r''1, and the negative one is ''r''2, then :r1 = ''r''2 + ''d''.


For floating-point numbers

When ''a'' and ''d'' are
floating-point number In computing, floating-point arithmetic (FP) is arithmetic using formulaic representation of real numbers as an approximation to support a trade-off between range and precision. For this reason, floating-point computation is often used in system ...
s, with ''d'' non-zero, ''a'' can be divided by ''d'' without remainder, with the quotient being another floating-point number. If the quotient is constrained to being an integer, however, the concept of remainder is still necessary. It can be proved that there exists a unique integer quotient ''q'' and a unique floating-point remainder ''r'' such that ''a'' = ''qd'' + ''r'' with 0 ≤ ''r'' < , ''d'', . Extending the definition of remainder for floating-point numbers, as described above, is not of theoretical importance in mathematics; however, many
programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science) ...

programming language
s implement this definition (see
modulo operation In computing, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another (called the ''modular arithmetic, modulus'' of the operation). Given two positive numbers a ...
).


In programming languages

While there are no difficulties inherent in the definitions, there are implementation issues that arise when negative numbers are involved in calculating remainders. Different programming languages have adopted different conventions. For example: *
Pascal Pascal, Pascal's or PASCAL may refer to: People and fictional characters * Pascal (given name), including a list of people with the name * Pascal (surname), including a list of people and fictional characters with the name ** Blaise Pascal, French ...
chooses the result of the ''mod'' operation positive, but does not allow ''d'' to be negative or zero (so, is not always valid).Pascal ISO 7185:1990
6.7.2.2
*
C99 C99 (previously known as C9X) is an informal name for ISO/IEC 9899:1999, a past version of the C programming language C (, as in the letter ''c'') is a general-purpose, procedural computer programming language A programming language ...

C99
chooses the remainder with the same sign as the dividend ''a''. (Before C99, the C language allowed other choices.) *
Perl Perl is a family of two high-level High-level and low-level, as technical terms, are used to classify, describe and point to specific Objective (goal), goals of a systematic operation; and are applied in a wide range of contexts, such as, for ...
,
Python PYTHON was a Cold War contingency plan of the Government of the United Kingdom, British Government for the continuity of government in the event of Nuclear warfare, nuclear war. Background Following the report of the Strath Committee in 1955, the ...
(only modern versions) choose the remainder with the same sign as the divisor ''d''. * Haskell and Scheme offer two functions, ''remainder'' and ''modulo'' –
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language Lisp (historically LISP) is a family of programming language A programming language is a formal language In mathematics Mathematics (from Ancient Greek, Greek: ) incl ...
and
PL/I PL/I (Programming Language One, pronounced and sometimes written PL/1) is a procedural, imperative Imperative may refer to: *Imperative mood, a grammatical mood (or mode) expressing commands, direct requests, and prohibitions *Imperative prog ...
have ''mod'' and ''rem'', while
Fortran Fortran (; formerly FORTRAN) is a general-purpose, compiled language, compiled imperative programming, imperative programming language that is especially suited to numerical analysis, numeric computation and computational science, scientific com ...

Fortran
has ''mod'' and ''modulo''; in each case, the former agrees in sign with the dividend, and the latter with the divisor.


Polynomial division

Euclidean division of polynomials is very similar to
Euclidean division In arithmetic, Euclidean division – or division with remainder – is the process of division (mathematics), dividing one integer (the dividend) by another (the divisor), in a way that produces a quotient and a remainder smaller than the divisor ...
of integers and leads to polynomial remainders. Its existence is based on the following theorem: Given two univariate polynomials ''a''(''x'') and ''b''(''x'') (where ''b''(''x'') is a non-zero polynomial) defined over a field (in particular, the reals or
complex number In mathematics, a complex number is an element of a number system that contains the real numbers and a specific element denoted , called the imaginary unit, and satisfying the equation . Moreover, every complex number can be expressed in the for ...

complex number
s), there exist two polynomials ''q''(''x'') (the ''quotient'') and ''r''(''x'') (the ''remainder'') which satisfy: :a(x) = b(x)q(x) + r(x) where :\deg(r(x)) < \deg(b(x)), where "deg(...)" denotes the degree of the polynomial (the degree of the constant polynomial whose value is always 0 can be defined to be negative, so that this degree condition will always be valid when this is the remainder). Moreover, ''q''(''x'') and ''r''(''x'') are uniquely determined by these relations. This differs from the Euclidean division of integers in that, for the integers, the degree condition is replaced by the bounds on the remainder ''r'' (non-negative and less than the divisor, which insures that ''r'' is unique.) The similarity between Euclidean division for integers and that for polynomials motivates the search for the most general algebraic setting in which Euclidean division is valid. The rings for which such a theorem exists are called
Euclidean domain In mathematics, more specifically in ring theory, a Euclidean domain (also called a Euclidean ring) is an integral domain that can be endowed with a #Definition, Euclidean function which allows a suitable generalization of the Euclidean division of ...
s, but in this generality, uniqueness of the quotient and remainder is not guaranteed. Polynomial division leads to a result known as the
polynomial remainder theorem In algebra, the polynomial remainder theorem or little Bézout's theorem (named after Étienne Bézout) is an application of Euclidean division of polynomials. It states that the remainder of the division of a polynomial f(x) by a linear polynomia ...
: If a polynomial ''f''(''x'') is divided by ''x'' − ''k'', the remainder is the constant ''r'' = ''f''(''k'').


See also

*
Chinese remainder theorem In number theory, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer An integer (from the Latin wikt:integer#Latin, ''integer'' meaning "whole") is colloquially defined as a number ...
*
Divisibility rule A divisibility rule is a shorthand way of determining whether a given integer An integer (from the Latin wikt:integer#Latin, ''integer'' meaning "whole") is colloquially defined as a number that can be written without a Fraction (mathematics), ...
*
Egyptian multiplication and division In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
*
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 an effi ...
*
Long division In arithmetic Arithmetic (from the Ancient Greek, Greek wikt:en:ἀριθμός#Ancient Greek, ἀριθμός ''arithmos'', 'number' and wikt:en:τική#Ancient Greek, τική wikt:en:τέχνη#Ancient Greek, έχνη ''tiké échne', 'ar ...

Long division
*
Modular arithmetic #REDIRECT Modular arithmetic #REDIRECT Modular arithmetic#REDIRECT Modular arithmetic In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure ( ...
*
Polynomial long division In algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In ...
*
Synthetic division In algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In ...
*
Ruffini's rule In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers (arithmetic and number theory), formulas and related structures (algebra), shapes and spaces in which they are contained (geometry), and quantities and th ...
, a special case of synthetic division *
Taylor's theorem In calculus, Taylor's theorem gives an approximation of a ''k''-times differentiable function around a given point by a polynomial of degree ''k'', called the ''k''th-order Taylor polynomial. For a smooth function, the Taylor polynomial is the t ...


Notes


References

* * * *


Further reading

* * * * {{cite book , author=Zuckerman, Martin M , title=Arithmetic: A Straightforward Approach , publisher=Rowman & Littlefield Publishers, Inc , location=Lanham, Md , isbn=0-912675-07-1 Division (mathematics) Number theory