Painting math on the wall

This is a little writeup of an art project I’ve done in the last week, and a couple neat details about the math ideas driving it.


I’ve been redoing my home office recently: I refinished the floor, and painted the walls. Both look yards better now, but while I was at it I decided to add some art to the walls.

I’m a fan of fractals, mathematical constructions that rely on relatively simple rulesets to generate structures that have various kinds of self-similarity at different scales, such that one can “zoom in” arbitrarily and continue to find recurring details. You’ve probably seen, for example, the visually striking Mandelbrot set. You also probably seen a Sierpinski triangle. They’re neat things, fractals, both in their mathy properties and in how they look when put down on paper.


I’m fond in particular of a family of closely-related fractals, the Cantor set, the Sierpinksi carpet, and the Menger sponge, which can be thought of as respectively the 1D, 2D, and 3D interpretations of the same fundamental idea: take something and cut out the middle third of it; and then take each of the bits left over and cut the middle third out of each of those; and then for each of those new bits, cut the middle third out; and so on.

Pictured above are sketches of each of those, which I drew up while brainstorming about wall designs. Ultimately I decided to start with a Menger sponge, because it’s the most eye-catching member of the family, and got pretty excited about the prospect.

But how to put it on the wall? There’s probably a lot of ways to go (not least of which would be rendering an image with an art program of some sort and printing up a big custom wall decal), but I did it the way I knew would work well enough for me, and that I could get started on immediately while I was hyped up about it.

So I grabbed a yardstick and a pencil and started drawing a large Menger sponge right on the wall.

Making the Menger sponge


Both to keep things simple and because I like the symmetry involved, I chose to do a perfect isometric view of the sponge; that means the whole structure ends up occupying a regular hexagon with each of the major visible faces of the cube occupying a diamond-shaped third of the design.

Because the theme of this kind of fractal is division by three, I settled on a size for my sponge that’d divide up nicely on a pretty basic yardstick: 27-inch sides, a power of 3. 27 works well because if I divide by three I’ve got 9-inch subsections; divide by three again and it’s 3-inch sub-sub-sections; again and it’s 1-inch sub-sub-sub-sections. And so the whole design is a hexagon with 27-inch sides, 54 inches wide at its broadest points; all the smallest details are equilateral triangles with 1-inch sides. Nice round numbers!

Armed with that scheme, I got to work drafting. I marked a center point on the wall, and measured 27 inches from there to the left to mark a left-side point and establish a base line between the two points. I then used my yardstick as a rudimentary compass, eyeballing a guess at a 60-degree angle up and left from my center point and marking a short line as an “arc” at the 27-inch mark. Then I did the same up and right from my left-side point, marking another arc at 27 inches out. Where those two arcs cross is a point that’s equidistant from both the lower points: the upper point of an equilateral triangle with three 27-inch sides.

I repeated that process five more times, generating six triangles, radiating out from the center point, adding up to a hexagon. Each of three pairs of adjacent triangles would make up the diamond-shaped faces of the design.

Then: subdivide. I marked out 9-inch intervals along each of the lines I’d established, and then used the yardstick as a straight-edge to draw a smaller 9-inch-side diamond in each of the three large diamonds. And then: mark out 3-inch intervals, and draw 8 3-inch diamonds surrounding each 8-inch diamond. And then 1-inch intervals, and 8 1-inch diamonds around each 3-incher.

That was all pretty straightforward; the only tricky bit to think through was working out the bits visible in the holes on any given face, the interior bits of the sponge. Fortunately, it’s all determinable, both mathematically and, in what works better for me in practice, through basic squint-and-hrmmmm spatial reasoning.

(And I’ve been a fan of Menger sponges for a long time, so I’ve spent a lot more time than the average person contemplating those details. I’ve done a couple of odd internet things with these ideas in the past. Back when Minecraft was still pretty new and I lost a couple of months of my life to it, I worked on among other things a Menger sponge floating above a mountain and, ultimately unfinished, a very, very large Sierpinski carpet. And earlier this year I made a silly little PICO-8 demo thing called Sierpinski Freakout that zooms recklessly in and out on a wildly blinking Sierpinski carpet.)

In the end I was able to render the whole thing from memory and a little contemplation, which was satisfying.

All in all, drafting it on the wall took about three hours. It went well, though there were a couple gotchas: the yardstick I was using is very slightly bowed, so my lines weren’t so much straight as they were nearly straight. I ended up having to fudge details occasionally later in the process as a result. And beyond that, the wall itself isn’t completely flat; this is an old house and flat planes and true perpendiculars are harder to come by than you might expect.


After that, it was time to paint, which I did with a couple of small paint brushes; the one above is what I started with and it worked well for doing large open-ish areas like the bulk of the main black sponge face, but once I was moving on to the smaller triangle details it was just too sloppy, and so I moved to a smaller, flat brush that was easier to build up a precise straight edge with.

The sponge is a three-color design, but part of my idea for this was to use the wall color itself — a nice orange I’d recently applied over the sort of blech terracotta that was there when we moved in to the house — as one of the colors. This has a few things going for it: the design has a sort of extruded-from-the-wall feeling; it makes for a neat exercise in negative space for the orange face of the sponge; and it requires 1/3 less painting that way. That last point turns out to have been a big winner.


And so I started with the black face, applying all the paint for both the main face itself and for all the interior details on the other two faces where black-facing portions of the structure would be visible. I was a little tempted to stop here, because the one-color version has a nice feeling to the way it strongly implies the structure without actually filling it out. And because I was coming to terms with how much work this was going to be: getting all that black on was probably 8 hours of fiddly and for the small details tediously repetitive painting work.

But, nah. Let’s do it.


I got the white face added and it was pretty goddam satisfying to see it all come together, that big chunk of hours later. But it was also clear on a close look that I was going to need to recoat the white and the black both: the initial coat, especially with the white over that vibrant orange, was too thin and while it was a little texturally interesting in places, it wasn’t consistent and wasn’t even attractively inconsistent. Above you can see some recoated white on the left, single coat on the right; the difference was even more striking in person.

So, another few hours, recoating white and black. Took far less time than the first coats since I didn’t need to worry about edges nearly as much.

And then touchups with both of those and with the base coat orange to fix little spills and flecks and the various smudge spots where while trying to wrap my brush hand awkwardly to get the correct flat angle on this or that triangle I managed to lean onto a scrap of wet paint and then stamp it down elsewhere.

There was a lot of that. I don’t have a terribly steady hand for painting, so propping my wrist or the side of my hand somewhere and doing the detail work with fingers and thumb was necessary for most of this. Figuring out the right order in which to do a series of triangles so that I could reliably plant my hand in the necessary multiplicity of positions for one triangle after another without sticking it in wet paint was a bit of a puzzle in its own right.

The painting happened in shifts over the course of this last weekend; I started Friday afternoon with the black, and finally finished the recoats and final touchup Sunday evening. All told with drafting and painting it was on the order of 20-24 hours of work. I caught up on a few podcasts and listened to a lot of music and spent a lot more time ignoring the internet than I’m usually able to.

But then, finally, it was done. For reals, for good, done. And it looks fantastic:


It’s big enough to be really striking from anywhere in the room, and at a few feet’s distance the lines and angles all look sharp despite my brushwork being a little sloppy even at my best. I’m pleased with how well the negative-space bit on the orange face works; originally I had thought I might need to add thin lines on the two open bits of the hexagon to clearly define the shape, but I think it works very, very well as is.

I also like how a little bit of deliberate changing of focus can disassemble it, becoming, instead of a 3D cube-like object, just a collection of colorful triangle and diamond patterns floating in space. Which of course it is, but the effect of a complicated cube-like object is so strong that the two ideas can compete more or less constantly for your attention.

The Cantor set


Following on that, I wanted to do a companion piece for the Sponge, and so I went back to my idea of a family of fractals and settled on doing a Cantor set on the same wall, on the far side of the closet door in the center.

This was simpler to lay out, and involved a great deal less painting, and so was doable in an afternoon and evening yesterday. I learned from the sponge and went and bought a new, very-straight-indeed metal yardstick from a new art supply store in the neighborhood, and started with the correct brush and an expectation that I’d be doing two coats.

I still ran into a couple challenges with this, though. A flat, straight yardstick doesn’t make a wall flat, so laying out lines still had a little bit of wiggle to it. And those not-quite-perpendiculars of a hundred year old house came into play as well; lining up the vertical axis of the set to track with the vertical of the adjacent closet door frame that itself leans a bit means the whole thing skews very slightly to the side. And those wee lines at the bottom line of the pattern required exactly the kind of delicate-touch freehand painting that I struggle with, and so are even sloppier on close inspection than the linework on the sponge.

My measurements were also a bit more fiddly this time; because I was subdividing more times for the Cantor set than for the Menger sponge, and I wanted to have the smallest measurement still be a nice round even fraction of an inch to simplify layout and avoid guesswork, I started from my smallest Cantor line at 0.125 inches (1/8 inch) and built up from there: the next larger rectangle was thus 0.375 inch (because that’s what got the middle cut out of it to yield a pair of 1/8 inch rectangles with a 1/8 inch gap), and then from there 1.125, 3.375, 10.125, and finally a single 30.375 inch rectangle. Not difficult numbers to measure out and mark — a yardstick is a yardstick — but a little trickier to (a) remember and (b) literally count off while holding a yardstick in place with one hand. And this nice new metal yardstick weighs a bit more than the warped one I used for the sponge.

But it looks nice, regardless, and fills the space well as a complement to the sponge; reusing the white and black combination makes for a nice visual consonance.


And I mentioned refinishing the floor: I converted it from a peeling collection of layers of paint (who paints a wood floor?!) to a dark-stained, glossy wood surface with lots of nice wood grain variation. And it’s shiny enough to get a good mirror reflection under the right conditions. Which means double your sponges!

Weird objects

I painted these fractals because I figured they’d look good on the wall, but there’s lots of fascinating things about them that don’t have anything to do with spiffing up your home office.

One big thing there: both the Cantor set and Menger sponge paintings are just partial snapshots of the actual fractal processes in question.

The sponge for example could have been subdivided further with another ring of eight .333-inch diamonds around each of my smallest 1-inch diamonds, and then eight .111-inch diamonds around each of those, and so on.

And I really mean “and so on”, in the most extreme sense; there’s no natural stop point to this process, if you’re not a human being trying to paint it on a wall. That’s that fractal self-similarity thing I was talking about; the sponge can in principle keep getting subdivided more and more, and you can keep “zooming in” to see more and more detail at increasingly small scales. Not just for a while: infinitely. You’d keep cutting out more and more tiny bits of it until, in the long run, it would have infinitesimal mass, being an infinitely fine lattice of missing pieces. An impossible sponge rather than a solid cube! And while it has no mass, it has, seemingly paradoxically, more and more surface area as you cut more and more bits out. Infinitely much, eventually.

The Cantor set is the same; you keep cutting a bit out of that rectangle (really just a one-dimensional line in the pure mathematical sense, but rectangles look a lot better on my wall), and then out of its sub-rectangles, and so on, and the amount of actual line/rectangle left in the long run approaches zero. First you’ve got 1 unit of line; then you cut out the middle bit and you’ve got 2/3 of your line, made of two 1/3 unit pieces. Then you cut the middle bit out of each of those 1/3 pieces and you have 4 pieces that are each 1/9. 1 becomes 2/3 becomes 4/9, and so on: for any given degree n of iteration into the Cantor set you have (2/3)n of your line left. (2/3)0 = 1; (2/3)1 = 2/3; (2/3)2 = 4/9; and so on. (2/3)infinity is a very small amount of line indeed: 0.

But in the meantime you’re cutting your line into 2n pieces: first 20 = 1 pieces, then 21 = 2 pieces, then 22 = 4, and so on. My wall painting gets as far as 25 = 32, but of course it keeps going. And as n gets large, this number gets very large; 2infinity is infinity. So you get, just as with the sponge, this strange idea of something that both grows and shrinks impossibly, with an infinite number of line segments which add up to exactly 0 length.

It’s neat shit.

Author: Josh Millard

I manage and help moderate the community website MetaFilter, where I go by "cortex"; in my spare time I get up to all sorts of creative nerdery on the internet and in Portland, Oregon.

4 thoughts on “Painting math on the wall”

  1. Toughest level of Q-Bert ever!

    Also, how long did it take for the Cantor to set?

  2. Josh,
    I really enjoyed this. You did a great job of getting my attention and of putting words around the process of your creation. Fractals always grab my attention but I’ve never explored them much. Definitely another one for my bucket list. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *