> For the complete documentation index, see [llms.txt](https://calnix.gitbook.io/zk-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://calnix.gitbook.io/zk-notes/abstract-math/modular-arithmetic/modular-multiplication.md).

# 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**&#x20;

Find the remainder of 15 x 17 x 19 when divided by 7.&#x20;

* On dividing 15 by 7 we get 1 as remainder.&#x20;
* On dividing 17 by 7 we get 3 as remainder.&#x20;
* On dividing 19 by 7 we get 5 as remainder.&#x20;
* Remainder of the expression (15 x 17 x 19)/7 will be equal to (1 x 3 x 5)/7.&#x20;
* Combined remainder will be equal to remainder of **15/7 i.e. 1.**&#x20;

{% hint style="info" %}
**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.&#x20;
{% endhint %}

<figure><img src="https://1983523492-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0nwEx8a60yETwfNYnenT%2Fuploads%2FH1nXJr1BuLJEqEIEKyHL%2Fimage.png?alt=media&amp;token=6119116c-7e3a-4d7a-8f39-821f20f4c37e" alt=""><figcaption></figcaption></figure>
