# A Sierpiński Carpet ratio

This math problem popped into my head and I wanted to share it with you:

We have the Sierpiński carpet, which is a fractal built like this:

1. Draw a square.
2. Divide it into 9 equal subsquares arranged in a 3-by-3 grid.
3. Remove the central subsquare.
4. Repeat from 2 for each subsquare.

You should get this as a result (I stopped after 4 iterations here):

Now, notice that I have put a red square on the carpet. It is drawn in such a way that each vertex touches the midpoints of the carpet's sides.

And now, the conundrum:

What's the ratio between the points of the carpet that are inside the red square, and the total number of points of the fractal?

• What do you mean by "points in the carpet"? Do you mean the area of everything coloured black? Commented Dec 5, 2023 at 19:12
• @GentlePurpleRain yes, but this area tends to 0 as the number of iterations increase, so you need to consider the ratio between the areas iteration by iteration. Commented Dec 5, 2023 at 21:19
• There's a mathematically rigorous version of this question - something like "what is the ratio of the d-dimensional Hausdorff measure of the part of the fractal outside the red square to the d-dimensional Hausdorff measure of the part inside the red square?" where d is the Hausdorff dimension of the Sierpinski carpet. Under this version, you don't need to consider convergence as the number of iterations increases, because the measure is nonzero for the infinitely iterated version of the fractal. Commented Dec 5, 2023 at 22:38
• @fblundun yes I know, thank you for pointing it out. I wanted to make it more like a puzzle though. That's why I posted it here. Commented Dec 6, 2023 at 7:35

A proof almost without words:

I've divided the red square into five regions: three which can be rearranged into whole subsquares, and two which are the halves of a red square one-eighth the original size.
$$A = \frac{3+A}{8} \iff A = \frac{3}{7}$$

• I like this a lot! Thank you! Commented Dec 6, 2023 at 7:37
• For others who struggled to see which regions Axiomatic is referring to: the three regions that are equivalent to whole subsquares are the big triangle on the left, big triangle on the right, and the rectangular region in the center. The top and bottom little triangle, when combined, becomes a 1/8th version of the whole image. Commented Dec 7, 2023 at 5:43

This is the result:

The ratio is $$3/7$$.

Here's my own reasoning:

We will use the unit square to generate the carpet. First, we calculate the number of squares that are removed from the unit square at the $$k$$-th iteration. Notice that once we have removed the first central square, we have other 8 squares left, so at the second iteration we will remove the central squares from the 8 subsquares. Each subsquare has been divided in 9 sub-subsquares and we have removed the central one, so at the third iteration we will remove $$8\cdot8=64$$ squares. In general we will remove $$8^{k-1}$$ squares at the $$k$$-th iteration. Let's call the squares removed at the $$k$$-th iteration $$k$$-squares from now on.

Notice that each $$k$$-square has a side length of $$1/3^k$$, so their area is $$9^{-k}$$. Therefore the area of the carpet at the $$k$$-th iteration is $$1-\frac{1}{9}\sum_{n=0}^{k-1} \left(\frac{8}{9}\right)^{n}$$

Without loss of generality, we can study only the lower-left quadrant of the carpet, where we want to find the number of squares removed from the carpet and outside of the red square, and then to get the total we will multiply this by four, since the quadrants are symmetric. Let's call the sequence of these numbers $$a_n$$. Consider the second iteration: then $$a_1=1$$. If we count those at the third iteration we get $$a_3=9$$. In general, we may notice from the image that $$a_n$$ is the number of removed squares at the $$k-1$$-th iteration (due to the fractal's autosimilarity to the children sub-carpets) minus the number of $$k-1$$-squares removed, which is $$a_{k-2}$$, plus two times $$a_{k-2}$$. These $$k-1$$-squares are marked with the blue color in the following image in the case $$k=3$$. So we get the following recurrence relation: $$a_n=8^{n-1}+a_{n-1}$$ where $$n=k-1$$.

The solution to this recurrence is $$a_n=\frac{8^n-1}{7}$$, and $$4a_n$$ is the total number of $$k-1$$-squares outside the red square. The area of the red square at the $$k$$-th iteration if we remove the areas of the squares in it will be $$0.5-\frac{1}{9}\sum_{n=0}^{k-1}\left(8^n-4\cdot\frac{8^n-1}{7}\right)9^{-n}$$

Now, the ratio we are looking for is just the ratio between the two areas at the $$k$$-th iteration, as $$k$$ goes to infinity. Let A be the area of the carpet, and B the area of the carpet restricted to the red square. The ratio will be $$r=B/A=$$ $$=\frac{0.5-\frac{1}{9}\sum_{n=0}^{k-1}\left(8^n-4\cdot\frac{8^n-1}{7}\right)9^{-n}}{1-\frac{1}{9}\sum_{n=0}^{k-1} \left(\frac{8}{9}\right)^{n}}$$. The sums are just truncated geometric series, so after writing them explicitly, and after some algebra we get $$r=3/7-\frac{1}{14\cdot8^{k+1}}$$ and as $$k\to\infty$$ the ratio is just $$r=\frac{3}{7}$$

Here is a much simpler way of getting the same answer:

Consider one of the diagonal lines making up the side of the red square; say the top right. Let a be the proportion of points removed by this line. Each of the non-central squares contains 1/8th of the points of the carpet; the line removes a/8 points from the middle top and middle right square, and (1-a)/8 points from the top right square. Thus a = (1-a)/8 + a/8 + a/8, which gives a = 1/7, and 3/7 points inside the square.

• Very good! That's much simpler! Commented Dec 6, 2023 at 7:38