Multiplication and division of integers

From Department of Mathematics at UTSA
Jump to navigation Jump to search

Multiplication of Integers

is the sum of N copies of M when N and M are positive whole numbers. This gives the number of things in an array N wide and M high. Generalization to negative numbers can be done by
and
The same sign rules apply to rational and real numbers.

Division of Integers

Integers are not closed under division. Apart from division by zero being undefined, the quotient is not an integer unless the dividend is an integer multiple of the divisor. For example, 26 cannot be divided by 11 to give an integer. Such a case uses one of five approaches:

  1. Say that 26 cannot be divided by 11; division becomes a partial function.
  2. Give an approximate answer as a "real" number. This is the approach usually taken in numerical computation.
  3. Give the answer as a fraction representing a rational number, so the result of the division of 26 by 11 is (or as a mixed number, so ) Usually the resulting fraction should be simplified: the result of the division of 52 by 22 is also . This simplification may be done by factoring out the greatest common divisor.
  4. Give the answer as an integer quotient and a remainder, so To make the distinction with the previous case, this division, with two integers as result, is sometimes called Euclidean division, because it is the basis of the Euclidean algorithm.
  5. Give the integer quotient as the answer, so This is the floor function, also sometimes called integer division at an elementary level.

Dividing integers in a computer program requires special care. Some programming languages, treat integer division as in case 5 above, so the answer is an integer. Other languages, such as MATLAB and every computer algebra system return a rational number as the answer, as in case 3 above. These languages also provide functions to get the results of the other cases, either directly or from the result of case 3.

Names and symbols used for integer division include div, /, \, and %. Definitions vary regarding integer division when the dividend or the divisor is negative: rounding may be toward zero (so called T-division) or toward −∞ (F-division); rarer styles can occur.

Divisibility rules can sometimes be used to quickly determine whether one integer divides exactly into another.

Licensing

Content obtained and/or adapted from: