Multiplicative Inverse - Practical Applications

Practical Applications

The multiplicative inverse has innumerable applications in algorithms of computer science, particularly those related to number theory, since many such algorithms rely heavily on the theory of modular arithmetic. As a simple example, consider the exact division problem where you have a list of odd word-sized numbers each divisible by k and you wish to divide them all by k. One solution is as follows:

  1. Use the extended Euclidean algorithm to compute k−1, the modular multiplicative inverse of k mod 2w, where w is the number of bits in a word. This inverse will exist since the numbers are odd and the modulus has no odd factors.
  2. For each number in the list, multiply it by k−1 and take the least significant word of the result.

On many machines, particularly those without hardware support for division, division is a slower operation than multiplication, so this approach can yield a considerable speedup. The first step is relatively slow but only needs to be done once.

Read more about this topic:  Multiplicative Inverse

Famous quotes containing the word practical:

    It is always a practical difficulty with clubs to regulate the laws of election so as to exclude peremptorily every social nuisance. Nobody wishes bad manners. We must have loyalty and character.
    Ralph Waldo Emerson (1803–1882)