# Area and volume of Menger sponge

The Menger sponge is the fractal you get by starting with a cube, dividing each face into a 3 by 3 grid (like a Rubik’s cube) and removing the middle square of each face and everything behind it. That’s M1, the Menger sponge at the 1st stage of its construction. The next stage repeats this process on all the little cubes that make up what’s left. That’s M2. Repeat the process over and over, and in the limit you get Menger’s sponge, a fractal with zero volume and infinite area!

This business of zero volume and infinite area may sound unreal, but the steps along the way to the limit are very tangible. Here’s a video by Aaron Benzel that let’s you fly through M3, and watch what happens if you split M3 apart.

You can compute the volume and area at each stage to show that

and

From these equations you can see that you can make the volume as small and you’d like, and the area as large as you like, by taking n big enough. And in case that sounds a little hand-wavey, we can get more concrete. Here’s a little code to find exactly how big a value of n is big enough.

    from math import log, ceil

def menger_volume(n):
return (20/27.)**n

def menger_area(n):
return 2*(20/9.)**n + 4*(8/9.)**n

def volume_below(v):
if v >=1:
return 1
else:
n = log(v)/log(20/27.)
return int(ceil(n))

def area_above(a):
if a < 2:
return 1
else:
n = (log(a) - log(2))/log(20/9.)
return int(ceil(n))

n = volume_below(0.001)
print( n, menger_volume(n) )

n =  area_above(1000)
print( n, menger_area(n) )


## 2 thoughts on “Area and volume of Menger sponge”

1. Heinz Schumann

Itâ€˜s easy to find the expression for the volume.
How did you develop the expression for the surface?

2. Jon Holloway

I found this while trying to visualise another dimension. In one dimension you can have two neighbours, 2 dimensions 4 neighbours, 3 can have 6 (if they are square). I was trying to visualise a dimension where everything in the whole universe had a neighbour that was in contact with a singularity, the singularity would need to have an infinite area but to explain quantum effects of entanglement it would need to have zero volume. I am speaking entirely without mathematical backup but I hope this inspires someone.