Every morning across Tamil Nadu, someone sweeps the doorstep, sets out a grid of rice-flour dots, and loops a line around them. The hardest kind, the sikku kolam, is one unbroken line. Here you can make them yourself: put mirrors between the dots, watch the lines merge, or let a search find a single-stroke kolam and draw it for you.
Tap a gap between two dots to cycle it: open (the line crosses itself) → gold mirror between the dots → blue mirror from dot to dot → open. With a symmetry on, your change is copied to every matching gap. When more than one line is left, each one gets its own colour.
A kolam is a drawing made at the threshold of a home, mostly in Tamil Nadu and across South India, and in Tamil communities in Sri Lanka, Singapore and Malaysia. It is usually drawn at dawn, in rice flour or white stone powder, on ground that has just been swept and sprinkled with water. People walk over it, the wind and rain take it, and a new one is drawn the next day. The rice flour is also food for ants and birds, which Marcia Ascher describes as starting the day with a small act of kindness.
Many kolams start from a grid of dots called pulli. In the sikku (knot) or neli style, a line weaves around the dots without touching them and comes back to where it started. The ideal, as Paulus Gerdes writes about Tamil designs, is a single closed line, with names like pavitram (ring) and Brahma-mudi (Brahma's knot). Drawing a large one without lifting your hand, or getting up, was a point of pride, especially in the month of Margazhi (mid-December to mid-January), when kolams can run right across the street.
Gerdes noticed that these single-line designs, and the sona sand drawings of the Chokwe people in Angola, can be built with one simple machine. Put each dot in the middle of a square cell. Imagine the border of the grid is a mirror and fire a ray of light at 45° from the midpoint of a cell edge. It zigzags between the dots, crossing itself at edge midpoints. Then place extra two-sided mirrors on some internal edges, either between two dots or joining two dots. When the ray hits one, it bounces instead of crossing. Follow it until it gets back to where it started, and you have one closed line. If parts of the grid are still empty, start another ray. Slavik Jablan called these mirror curves and catalogued them.
With no internal mirrors, an a×b grid gives gcd(a, b) separate lines, so 3×4 is already one line and 7×7 is seven. (This page's engine passes that check for every grid we tried.) Adding or removing one mirror changes the number of lines by at most one: it can join two lines, split one, or reroute a line without changing the count. The search behind the button is a plain hill-climb. It flips a random mirror (and its symmetric copies), keeps the flip if the number of lines doesn't go up, sometimes accepts a worse one so it doesn't get stuck, and starts over if it stalls. On a 7×7 grid with 4-fold symmetry it usually finds a single line in a few dozen flips.
The same drawings also caught the attention of computer scientists. In 1974, Gift Siromoney, Rani Siromoney and Kamala Krithivasan described kolam families as two-dimensional "picture languages" generated by array grammars.
Traditional sikku kolams are almost always symmetric, so we asked a question we could compute: if you place mirrors at random but keep a symmetry, how often do you get exactly one line? Each symmetric group of gaps gets a gold mirror with probability ½. For small grids we counted every possible placement exactly. For larger ones we drew 20,000 to 1,000,000 random samples. Here's what came out:
Share of random mirror placements on an n×n grid that form a single line (log scale). Solid dots are exact counts, hollow dots are samples. On even grids the 2-fold and 4-fold values are exactly zero, so they can't appear on a log scale.
| n×n | No symmetry | 2-fold | 4-fold | 4-fold + mirror | Avg. lines (4-fold) |
|---|---|---|---|---|---|
| 2×2 | 25.0% (4/16) | 0 exact | 0 exact | 0 exact | 3.0 |
| 3×3 | 5.86% (240/4,096) | 18.8% (12/64) | 25.0% (2/8) | 0 exact | 4.0 |
| 4×4 | 1.18% (236 in 20,000) | 0 exact | 0 exact | 0 exact | 6.3 |
| 5×5 | 0.187% (748 in 400,000) | 3.05% (32,000/1,048,576) | 7.81% (80/1,024) | 0 exact | 7.8 |
| 6×6 | 0.024% (244 in 1,000,000) | 0 in 20,000 | 0 exact | 0 exact | 10.5 |
| 7×7 | 0.0028% (28 in 1,000,000) | 0.345% (1,379 in 400,000) | 2.22% (46,592/2,097,152) | 0 exact | 12.6 |
| 8×8 | 0 in 20,000 | 0 in 20,000 | 0 in 20,000 | 0 exact | 15.8 |
| 9×9 | 0.0050% (1 in 20,000) | 0.021% (84 in 400,000) | 0.526% (2,106 in 400,000) | 0 exact | 18.3 |
| 10×10 | 0 in 20,000 | 0 in 20,000 | 0 in 20,000 | 0 in 20,000 | 22.0 |
| 11×11 | 0 in 20,000 | 0 in 20,000 | 0.109% (437 in 400,000) | 0 in 20,000 | 25.2 |
| 12×12 | 0 in 20,000 | 0 in 20,000 | 0 in 20,000 | 0 in 20,000 | 29.5 |
| 13×13 | – | – | 0.019% (38 in 200,000) | – | – |
Take an n×n grid with n even and suppose the mirrors are symmetric under a half turn. The centre of the grid is then a cell corner, not a dot. If the whole drawing were one closed line, the half turn would map that line onto itself. It can't flip the line's direction, because nothing on the line sits exactly at the centre. So it has to shift the line by half its length, which means half the line takes you from a point to its opposite, a turn of 180° around the centre plus whole turns. Two halves make an odd number of full turns around the centre. Now count the turns another way. Draw a ray from the centre along a diagonal to the corner. It passes through n/2 dots and crosses the line exactly twice at each, so it crosses n times in all, which is even. Crossing an even number of times means an even number of turns. That's a contradiction. For odd n the centre is a dot and the same count comes out odd, so nothing stops it there. A 4-fold symmetry contains the half turn, so the same argument rules it out too. The same count works for rectangles: if both sides are even, a half-turn-symmetric kolam can't be one line. If one side is odd, the centre lands on the line itself and the argument no longer applies (the search finds one-line 9×6 kolams easily).
If the mirrors are also symmetric across a diagonal, reflecting across it maps the line to itself backwards. A reflection like that can hold at most two pieces of a single closed line in place. But the diagonal passes through n dots and the line crosses it twice at each, which gives 2n pieces that would have to stay put. For n ≥ 2 that's too many. So on this kind of square grid, a kolam with full mirror symmetry is always several lines. The one-line ones can spin, but they can't have a mirror image. Both arguments still hold if you also allow the blue dot-to-dot mirrors, and our samples with all three gap states agree.
These are short arguments we worked out and checked against the exact counts. They are probably known to people who study mirror curves, and we're not claiming them as new mathematics. The point is that the impossibility is real, not bad luck in the search, which is why the button won't even try on even symmetric grids.
Code: everything runs in your browser, in one small vanilla JS file (kolam.js). The experiment reuses the same engine under Node.