Example of Modulo Art in Math

Grace Aug 20, 2026

Mathematics, in its abstract and intricate dance of numbers, has given birth to some stunning crossovers with the arts. One such captivating fusion is Modulo Art, a visual representation of modular arithmetic that's as aesthetically pleasing as it is mathematically profound.

21 Math Art Projects for Kids
21 Math Art Projects for Kids

Modulo Art, also known as Modular Art or Pixel Art using Modular Arithmetic, is a form of digital art that transforms modular arithmetic—a fundamental concept in number theory—into visually appealing patterns. By mapping the remainders when numbers are divided by a fixed number (modulo operation) into distinct colors, artists create mesmerizing geometric designs and shapes.

MODULO ART
MODULO ART

The Math Behind the Magic

At the heart of Modulo Art lies the simple yet powerful concept of modular arithmetic. It's a way of doing math that wraps around, allowing numbers to 'loop' back to a starting point. For instance, modulo 12, 20 is the same as 4, since 20 - 12 = 8 and 12 - 8 = 4.

an image of a coloring book page with different designs on the pages and numbers in each section
an image of a coloring book page with different designs on the pages and numbers in each section

In Modulo Art, we usually work with modulo n, where n is the number of colors used. Each remainder (0, 1, 2..., n-1) is assigned a unique color. A grid of numbers is then transformed into a visual masterpiece by plotting each number's color based on its remainder.

Modulo N Grids

a piece of paper with blue and white designs on it
a piece of paper with blue and white designs on it

A simple 2D grid of numbers under modulo n operation can lead to fascinating results. Here's a 10x10 grid using modulo 5:

0123401234
1234012340

In this grid, the numbers aren't just stacked vertically and horizontally; they spiral outwards, creating a striking pattern that echoes traditional art motifs.

four different types of origami are shown in the diagram above, and below
four different types of origami are shown in the diagram above, and below

Using Functions and Sequences

Modulo Art becomes even more intriguing when mathematical functions like sine or cosine, or sequences like Fibonacci, are applied to modify the numbers in the grid. Each function produces unique and intricate visuals, offering artists endless possibilities to experiment and explore.

For example, consider the simple sine function with modulo 5 operation: sin(x) mod 5. The resulting pattern is a series of beautiful wave-like formations, each peak and trough carefully defined by the trigonometric function:

an image of a blue background with yellow and white squares in the shape of a spiral
an image of a blue background with yellow and white squares in the shape of a spiral

From Numbers to Art: Tools of the Trade

Many digital tools allow artists to create Modulo Art with ease. Platforms like Processing, p5.js, and Processing.js provide an ideal environment for experimenting with modular arithmetic and generating mesmerizing artworks.

Google Image Result for https://live.staticflickr.com/7307/9736046883_45a32a6e88_b.jpg
Google Image Result for https://live.staticflickr.com/7307/9736046883_45a32a6e88_b.jpg
four colorful pieces of paper are arranged on the wall
four colorful pieces of paper are arranged on the wall
three ways to add art to your math class
three ways to add art to your math class
a piece of art hanging on the wall
a piece of art hanging on the wall
an abstract purple and white background with triangles
an abstract purple and white background with triangles
an image of a quilt pattern with different colors and patterns on it's side
an image of a quilt pattern with different colors and patterns on it's side
Modulo Art Design Pattern Rotation
Modulo Art Design Pattern Rotation
a drawing of an arrow that has been drawn in blue and yellow
a drawing of an arrow that has been drawn in blue and yellow
Amazing Math Art Projects for Kids
Amazing Math Art Projects for Kids

Some artists also use spreadsheet software like Excel or Google Sheets, leveraging the built-in functions for mathematical operations and color mapping to create Modulo Art.

Processing and p5.js

Processing and its web-based version, p5.js, are popular among Modulo Art creators. They allow for straightforward integration of mathematical functions, color manipulation, and even interactivity. Here's a simple sketch using p5.js to create a modulo operation:

```javascript void setup(){ size(500, 500); } void draw(){ loadPixels(); for(int x = 0; x < width; x++){ for(int y = 0; y < height; y++){ pixels[(x + y * width) * 4] = (x + y) % 4; pixels[(x + y * width) * 4 + 1] = 0; pixels[(x + y * width) * 4 + 2] = 0; pixels[(x + y * width) * 4 + 3] = 255; } } updatePixels(); } ```

This simple sketch creates a stunning 500x500 pixel grid using modulus 4 operation, painting each remainder with a unique shade of gray.

Spreadsheets: A Surprising Tool

Spreadsheets might not be the first tool that comes to mind when thinking about digital art, but their built-in functions make them surprisingly versatile for creating Modulo Art.

By entering formulas to calculate remainders and using conditional formatting to apply colors based on these remainders, spreadsheet users can create captivating Modulo Art designs. Tools like Google Sheets even allow exporting the final grid as an image for easy sharing.

Modulo Art, born from the intersection of mathematics and digital art, continues to inspire artists and enthusiasts worldwide. Its inherent beauty lies in the harmony between complex mathematical principles and their visualization. As we strategically place colors to recreate algorithmic patterns, we're not just creating art; we're translating the language of numbers into a visually captivating experience.