Modular Arithmetic

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

This visually illustrates various properties of modular arithmetic by creating an "operation table" modulo , where 0 is represented by black, 1 by white, and other values by intermediate colors. The allowed numbers can be restricted to be nonzero or the units modulo , and the operations are modular addition, subtraction, powers, and sums of squares.

Contributed by: Christopher Moretti (March 2011)
Open content licensed under CC BY-NC-SA



This visual display of modular arithmetic can be used to illustrate different principles of modular arithmetic (such as the existence of additive or multiplicative inverses modulo ). Because 0 is always represented by black and 1 by white, it makes these values easy to spot in the table. For example, to determine which numbers have multiplicative inverses mod 12, you simply need to move the modulus slider to 12, the operation to times, and then determine which rows of the table have the white "1" square. By using this Demonstration, you can see a wide range of values and different operations for modular arithmetic, which is quite useful for those beginning to study algebra/number theory.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.