Modular Multiplication

(a x b) mod m = ((a mod m) x (b mod m)) mod m 

(a x b x c) mod m = ((a mod m) x (b mod m) x (c mod m)) mod m 

The same property holds for more than three numbers.

Example

Find the remainder of 15 x 17 x 19 when divided by 7.

  • On dividing 15 by 7 we get 1 as remainder.

  • On dividing 17 by 7 we get 3 as remainder.

  • On dividing 19 by 7 we get 5 as remainder.

  • Remainder of the expression (15 x 17 x 19)/7 will be equal to (1 x 3 x 5)/7.

  • Combined remainder will be equal to remainder of 15/7 i.e. 1.

How is it useful? If we need to find remainder of multiplication of two large numbers, we can avoid doing the multiplication of large numbers, especially helpful in programming where multiplication of large numbers can cause overflow.

Last updated

Was this helpful?