What is a Fractal?

A fractal is a mathematical structure with endless detail and self-similarity as you zoom in. They have swirled and crinkled structures that are so infinitely complex that they have a higher effective dimension than the shapes that create them.
Mathematically, a fractal is defined as a set where the Hausdorff dimension is greater than the topological dimension.[1]
The Hausdorff dimension is a way of measuring how effectively a shape fills space. It is often a fractional value, which inspired Benoit Mandelbrot to invent the name "fractal". To illustrate this concept, start with an equilateral triangle where the three sides have length 1. Each side is a line, which is one-dimensional by definition. Now extend the middle third of each side to make a smaller equilateral triangle. The perimeter is now longer, but still one-dimensional. Repeat that on the new edges, and then on their new edges, forever. The perimeter now has infinite length! This is the Koch snowflake fractal:
Iteration | Edge Number | Edge Length | Total Length |
0 | 3 | 1 | 3*1 |
1 | 3*4 | 1/3 | (3*4)*(1/3) |
2 | 3*4*4 | (1/3)*(1/3) | (3*4*4)*(1/3)*(1/3) |
3 | 3*4*4*4 | (1/3)*(1/3)*(1/3) | (3*4*4*4)*(1/3)*(1/3)*(1/3) |
n | 3*4n | (1/3)n | 3*(4/3)n |
n → ∞ | ∞ | 0 | ∞ |
The perimeter is so crinkled that any subsection, no matter how short, also has infinite length. This implies the perimeter somehow has more than one dimension, even though it's only made of lines. Since the shape is perfectly similar at all scales, the Hausdorff dimension is easily calculated by the similarity equation.
d = logs(N) where s is the scale factor, and N is the number of similar copies created by each iteration.[2]
In the Koch snowflake, an iteration quadruples the number of edges, so N = 4. The new edges are one third of the length, so s = 3. Therefore the Hausdorff dimension is log3(4) = 1.2618595...
Zoom into the snowflake below, and you'll see how every part is infinitely crinkled, no matter how small it is. The derivative does not exist anywhere. Unlike a smooth function, you can't squeeze any part of it between two lines by zooming it far enough. There will always be space between the lines, which is roughly what the Hausdorff dimension measures.
To compare, here is a smooth function. Despite looking jagged like a fractal, it's not. The derivative exists everywhere, so if you zoom in far enough anywhere, you will eventually see a line across the screen. The Hausdorff dimension is 1, which is the same as the topological dimension.
To make a fractal, the fractured effect must go infinitely deep. Usually this is done by an iterated function. For example, start with a square, and cut out a small square 1/3 the size from the middle. The surrounding area now has 8 small squares of this same size. Repeat the procedure on them, cutting out the middle square, and then do again it to their smaller squares, forever. This is the Sierpiński carpet. It has a Hausdorff dimension of log3(8) = 1.89278926...
↗ Click to open in the Mandelbrot viewer.
References:
[1] Measure, Topology, and Fractal Geometry, 2nd Ed.
Gerald Edgar (2008) p.119
[2] The Fractal Geometry of Nature
Benoit Mandelbrot (1982)
[3] The Hausdorff Dimension of the Boundary of the Mandelbrot Set and Julia Sets
Mitsuhiro Shishikura (1991) https://arxiv.org/pdf/math/9201282