# Simple Fractal square

I am working on a math question about infinite series, and one of the question images is below. Each new white square has an area that is 1/4 of the previous square.

Always looking to learn elegant ways to create things using Mathematica, and in this case, probably recursion as well?

I know it's not complicated, but any help with the process would be appreciated.

Having a NICE diagram really helps with creating a better response. (questions about sums of areas of white, black, etc.)

coords = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
tf = Composition[TranslationTransform[{1/2, 0}], ScalingTransform[{1/2, 1/2}]]
n = 4;
rects = NestList[tf /@ # &, coords, n];
Graphics[{EdgeForm[Black], Rectangle[], White, Polygon[Most/@rects], Polygon@Last@rects}] Row @ Table[With[{rects = NestList[tf /@ # &, coords, n]},
Graphics[{ EdgeForm[Black], Rectangle[], White,
Polygon[Most /@ rects], Polygon @ Last @ rects}, ImageSize -> 200]], {n, 0, 5}] • I used this answer to create a "Manipulate", SUPER useful for creating some help the student needed with this question. Can't even compare with the original diagram, having this was perfect. – Tom De Vries Oct 25 '18 at 19:06
• @TomDeVries, really glad it was useful. Thank you for the accept. – kglr Oct 25 '18 at 19:07
n = 100;
T1 = DeveloperToPackedArray[{{-1., 0.}, {-0.5, 0.}, {-0.5, 0.5}}];
T2 = DeveloperToPackedArray[{{-0.5, 0.5}, {0., 0.5}, {0., 1.}}];
Graphics[{
Polygon[Table[0.5^k T1, {k, 0, n}]],
Polygon[Table[0.5^k T2, {k, 0, n}]]
}] • That is so concise, unbelievable! – Tom De Vries Oct 25 '18 at 19:05

Inspired by @HenrikSchumacher:

Graphics@NestList[Scale[#, 1/2, {0, 0}] &,
Polygon[{{{-2, 0}, {-1, 0}, {-1, 1}}, {{-1, 1}, {0, 1}, {0, 2}}}], 10] This can be also shortened to:

Graphics@NestList[Scale[#, 1/2, {0, 0}] &,
Polygon[{{-2, 0}, {-1, 0}, {-1, 1}, {0, 1}, {0, 2}}], 10]