Difference between revisions of "Multiplication and division of integers"
(Created page with "== Multiplication of Integers == :<math>N\times M</math> is the sum of ''N'' copies of ''M'' when ''N'' and ''M'' are positive whole numbers. This gives the number of things...") |
|||
Line 20: | Line 20: | ||
Divisibility rules can sometimes be used to quickly determine whether one integer divides exactly into another. | Divisibility rules can sometimes be used to quickly determine whether one integer divides exactly into another. | ||
+ | |||
+ | == Licensing == | ||
+ | Content obtained and/or adapted from: | ||
+ | * [https://en.wikipedia.org/wiki/Multiplication Multiplication, Wikipedia] under a CC BY-SA license | ||
+ | * [https://en.wikipedia.org/wiki/Division_(mathematics) Division (mathematics, Wikipedia] under a CC BY-Sa license |
Latest revision as of 15:56, 8 January 2022
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:
- Say that 26 cannot be divided by 11; division becomes a partial function.
- Give an approximate answer as a "real" number. This is the approach usually taken in numerical computation.
- 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.
- 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.
- 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:
- Multiplication, Wikipedia under a CC BY-SA license
- Division (mathematics, Wikipedia under a CC BY-Sa license