The Geometry of the Alhambra
Symmetry, Tessellations & Group Theory

The Geometry of the Alhambra

An apprentice tile-maker discovers that there are exactly 17 ways to repeat a pattern.

Symmetry, Tessellations & Group Theory12-Month Curriculum 10h

The Story

The Apprentice

In 1370, in Granada, a girl named Zahra swept tiles for a living. Every morning she arrived before dawn at the workshop of Master Yusuf, the finest tile-maker in the Nasrid kingdom, and every morning her job was the same: sweep the dust, grind the pigments, carry the water, and — if she was lucky — watch the master work.

Master Yusuf made tiles for the Alhambra, the great palace on the hill. Its walls were covered in geometric patterns so intricate they seemed to breathe — stars that turned into flowers, flowers that turned into stars, shapes that repeated forever in every direction without a single gap or overlap.

At night, when the workshop was empty, Zahra would kneel on the floor and arrange broken tile pieces into designs. Triangles, squares, hexagons — she could make them fit together perfectly. But when she tried pentagons, they always left gaps.

"Why don't pentagons work?" she asked Master Yusuf one morning.

The old man smiled. "That is the first real question you have asked me."

The Secret of 360

Master Yusuf drew a point on paper. "For tiles to fit with no gaps, the angles at every corner must add to exactly 360 degrees."

He placed three hexagons around the point. Each corner is 120°. Three corners: 360°. "Perfect fit."

Four squares. Each corner is 90°. Four corners: 360°. "Perfect fit."

Six triangles. Each corner is 60°. Six corners: 360°. "Perfect fit."

Then he drew a pentagon. Each corner is 108°. Three pentagons: 324°. Not enough. Four: 432°. Too much. "There is no whole number of pentagons that adds to 360. This is mathematics, not effort."

The Four Magic Moves

Over the following weeks, Master Yusuf taught Zahra the four operations every pattern was built from.

Translation — sliding a tile in a straight line without turning it.

Rotation — spinning a tile around a fixed point.

Reflection — flipping a tile as in a mirror.

Glide reflection — slide forward, then flip. Like footprints in sand — left, right, left, right.

"Every repeating pattern in the Alhambra uses some combination of these four moves. There are no others."

Zahra practised until she could look at any wall and name the moves: "Translation along the horizontal. Rotation by 90° at that star. Reflection across that vertical line." The walls that had seemed magical now seemed like sentences in a language she was learning to read.

Exactly Seventeen

One evening, cataloguing patterns, Zahra noticed the number of truly different types seemed to stop growing. She kept finding the same types in different costumes.

"How many different pattern types are there?" she asked.

"Seventeen. Exactly seventeen. Not sixteen, not eighteen. There are exactly seventeen fundamentally different ways to repeat a pattern on a flat surface."

"How can you be sure?"

"Because the mathematics proves it. The angles, the rotations, the reflections — there are only so many ways they can combine."

Zahra spent the next month walking through every hall of the Alhambra, cataloguing tiles. And Master Yusuf was right. She found all seventeen types — every possible way to fill a plane with a repeating pattern.

"The builders discovered all seventeen centuries before mathematicians could prove it," said Master Yusuf. "They found them by intuition, by experiment, by beauty. The proof came later."

The Crystals Beneath

Years later, a scholar visited Zahra's workshop. He studied how atoms arrange themselves in crystals. He showed Zahra drawings of atomic arrangements, and she laughed.

"These are my wallpaper patterns," she said.

The scholar nodded. "The same seventeen symmetry groups that govern your tiles also govern crystals. The mathematics of beauty and the mathematics of nature are the same."

Zahra looked at her tiles, then at the crystal drawings. The same geometry — on palace walls and in the heart of a diamond.

The end.

Try It Yourself

Choose your level. Everyone starts with the story — the code gets deeper as you go.

Story Progress

0%

Ready to Start Coding?

Here is a taste of what Level 1 looks like for this lesson:

Level 1: Explorer — Python
import matplotlib.pyplot as plt
import matplotlib.patches as patches

fig, ax = plt.subplots(figsize=(8, 8))
colors = ['#E8A87C', '#D5573B', '#41B3A3', '#C38D9E']

for row in range(8):
    for col in range(8):
        color = colors[(row + col) % 4]
        sq = patches.Rectangle((col, row), 1, 1,
             facecolor=color, edgecolor='white', lw=2)
        ax.add_patch(sq)

ax.set_xlim(0, 8); ax.set_ylim(0, 8)
ax.set_aspect('equal')
ax.set_title('p4 Wallpaper Group — 4-fold rotation')
ax.axis('off')
plt.show()  # Try changing the color rule!

This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build a Tessellation Pattern Generator.

By Level 4, enrolled students build: Build a Tessellation Pattern Generator

Free

Level 0: Listener

Stories, science concepts, diagrams, quizzes. No coding.

You are here

Enrolled

Levels 1-4

Python, NumPy, Matplotlib, real projects, mentorship.

Sign Up Free

Stay Updated

Join Waitlist

Get notified when enrollment opens for your area.

Notify Me

Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.