HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, the remainder is the amount "left over" after performing some computation. 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. ...
, the remainder is the integer "left over" after 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 ...
by another to produce an integer
quotient In arithmetic, a quotient (from 'how many times', pronounced ) is a quantity produced by the division of two numbers. The quotient has widespread use throughout mathematics. It has two definitions: either the integer part of a division (in th ...
(
integer division Division is one of the four basic operations of arithmetic. The other operations are addition, subtraction, and multiplication. What is being divided is called the ''dividend'', which is divided by the ''divisor'', and the result is called the ...
). In
algebra Algebra is a branch of mathematics that deals with abstract systems, known as algebraic structures, and the manipulation of expressions within those systems. It is a generalization of arithmetic that introduces variables and algebraic ope ...
of polynomials, the remainder is the polynomial "left over" after dividing one polynomial by another. 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 ...
'' is the operation that produces such a remainder when given a dividend and divisor. Alternatively, a remainder is also what is left after subtracting one number from another, although this is more precisely called the ''
difference Difference commonly refers to: * Difference (philosophy), the set of properties by which items are distinguished * Difference (mathematics), the result of a subtraction Difference, The Difference, Differences or Differently may also refer to: Mu ...
''. 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 type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-orie ...
is approximated by a
series expansion In mathematics, a series expansion is a technique that expresses a Function (mathematics), function as an infinite sum, or Series (mathematics), series, of simpler functions. It is a method for calculating a Function (mathematics), function that ...
, where the error expression ("the rest") is referred to as the
remainder term In mathematics, a series is, roughly speaking, an addition of infinitely many terms, one after the other. The study of series is a major part of calculus and its generalization, mathematical analysis. Series are used in most areas of mathemati ...
.


Integer division

Given an
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 ...
''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, a quotient (from 'how many times', pronounced ) is a quantity produced by the division of two numbers. The quotient has widespread use throughout mathematics. It has two definitions: either the integer part of a division (in th ...
'', 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 dividing one integer (the dividend) by another (the divisor), in a way that produces an integer quotient and a natural number remainder strictly smaller than ...
''. For algorithms describing how to calculate the remainder, see ''
Division algorithm A division algorithm is an algorithm which, given two integers ''N'' and ''D'' (respectively the numerator and the denominator), computes their quotient and/or remainder, the result of Euclidean division. Some are applied by hand, while others ar ...
''.) The remainder, as defined above, is called the ''least positive remainder'' or simply the ''remainder''. 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'' = ''kd'' + ''s'', with ≤ 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 and . For this exception, we have: : ''a'' = ''kd'' + ''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 : ''r''1 = ''r''2 + ''d''.


For floating-point numbers

When ''a'' and ''d'' are
floating-point number In computing, floating-point arithmetic (FP) is arithmetic on subsets of real numbers formed by a ''significand'' (a signed sequence of a fixed number of digits in some base) multiplied by an integer power of that base. Numbers of this form ...
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 with . 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 system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
s implement this definition (see ''
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 ...
'').


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 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 C9X, formally ISO/IEC 9899:1999) is a past version of the C programming language open standard. It extends the previous version ( C90) with new features for the language and the standard library, and helps implementations mak ...
chooses the remainder with the same sign as the dividend ''a''. (Before C99, the C language allowed other choices.) *
Perl Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
,
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
(only modern versions) choose the remainder with the same sign as the divisor ''d''. *
Scheme Scheme or schemer may refer to: Arts and entertainment * ''The Scheme'', a BBC Scotland documentary TV series * The Scheme (band), an English pop band * ''The Scheme'', an action role-playing video game for the PC-8801, made by Quest Corporation * ...
offer two functions, ''remainder'' and ''modulo'' –
Ada Ada may refer to: Arts and entertainment * '' Ada or Ardor: A Family Chronicle'', a novel by Vladimir Nabokov Film and television * Ada, a character in 1991 movie '' Armour of God II: Operation Condor'' * '' Ada... A Way of Life'', a 2008 Bollywo ...
and
PL/I PL/I (Programming Language One, pronounced and sometimes written PL/1) is a procedural, imperative computer programming language initially developed by IBM. It is designed for scientific, engineering, business and system programming. It has b ...
have ''mod'' and ''rem'', while Fortran has ''mod'' and ''modulo''; in each case, the former agrees in sign with the dividend, and the latter with the divisor.
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
and
Haskell Haskell () is a general-purpose, statically typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research, and industrial applications, Haskell pioneered several programming language ...
also have ''mod'' and ''rem'', but ''mod'' uses the sign of the divisor and ''rem'' uses the sign of the dividend.


Polynomial division

Euclidean division of polynomials is very similar to
Euclidean division In arithmetic, Euclidean division – or division with remainder – is the process of dividing one integer (the dividend) by another (the divisor), in a way that produces an integer quotient and a natural number remainder strictly smaller than ...
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 extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the for ...
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 Euclidean function which allows a suitable generalization of Euclidean division of integers. Th ...
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, for every number r, any polynomial f(x) is the sum of f(r) and the p ...
: If a polynomial ''f''(''x'') is divided by , the remainder is the constant .


See also

*
Chinese remainder theorem In mathematics, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer ''n'' by several integers, then one can determine uniquely the remainder of the division of ''n'' by the product of thes ...
*
Divisibility rule A divisibility rule is a shorthand and useful way of determining whether a given integer is divisible by a fixed Divisor (number theory), divisor without performing the division, usually by examining its digits. Although there are divisibility test ...
*
Egyptian multiplication and division In mathematics, ancient Egyptian multiplication (also known as Egyptian multiplication, Ethiopian multiplication, Russian multiplication, or peasant multiplication), one of two multiplication methods used by scribes, is a systematic method for mul ...
*
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 ...
*
Long division In arithmetic, long division is a standard division algorithm suitable for dividing multi-digit Hindu-Arabic numerals (positional notation) that is simple enough to perform by hand. It breaks down a division problem into a series of easier step ...
*
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 ...
*
Polynomial long division In algebra, polynomial long division is an algorithm for dividing a polynomial by another polynomial of the same or lower degree, a generalized version of the familiar arithmetic technique called long division. It can be done easily by hand, bec ...
*
Synthetic division In algebra, synthetic division is a method for manually performing Euclidean division of polynomials, with less writing and fewer calculations than long division. It is mostly taught for division by linear monic polynomials (known as Ruffini ...
*
Ruffini's rule In mathematics, Ruffini's rule is a method for computation of the Euclidean division of a polynomial by a binomial of the form ''x – r''. It was described by Paolo Ruffini in 1809. The rule is a special case of synthetic division in which the ...
, 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 truncation a ...


Notes


References

* * * *


Further reading

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