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

\mathrm{volume}(M_n) = \left(\frac{20}{27} \right )^n


\mathrm{area}(M_n) = 2\left(\frac{20}{9} \right )^n + 4 \left(\frac{8}{9} \right )^n

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
            n = log(v)/log(20/27.)
            return int(ceil(n)) 
    def area_above(a):
        if a < 2:
            return 1
            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) )

Related posts

Leave a Reply

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