# 5. Connections to fractals

# The Golden **b **and IFS fractals

A fractal is a type of shape that contains repeating patterns at every scale.

Many important fractals are made of smaller copies of themselves. These fractals are called Iterated Function System (IFS) fractals.

Here are some examples of IFS fractals:

A large **b** made from two smaller **b**‘s

As we have seen, the Golden **b** can be made from smaller copies of itself. That’s because the Golden **b** is also an IFS fractal.

Here is a Golden **b **made from two smaller tiles. The combined **b** is defined by the corners A, B, C, D, E, and the smaller purple** b **has corners at a,b,c,d and e.

Can you see what actions would be needed to map the **b** with corners ABCDE to the purple** b** with corners at abcde? It may involve shrinking, flipping or rotating the large **b**. The arrows in the diagram give you a clue.

This is hard to do in your head, so try using a large and small Golden **b** tile to work out the actions.

# Let’s get more mathematical!

There are three simple steps to transform the big b into the purple b.

These types of actions – resizing, rotating and flipping – can be described mathematically using matrices:

`((alpha,0),(0,alpha))` is saying: shrink by `alpha` in both the vertical and the horizontal direction.

`((0,-1),(1,0))` is saying: rotate by `90` degrees in an anti-clockwise direction

`((alpha),(0))` is saying: move right a distance of `alpha`.

The handy thing about matrices is you can multiply them together to make a new matrix that includes multiple actions.

For example, `((0,-1),(1,0))((alpha,0),(0,alpha))=((0,-alpha),(alpha,0))` is a matrix which says: ‘shrink by `alpha` and then rotate by `90` degrees’.

So the three operations that map the combined **b** to the purple **b** can be combined into one equation:

`f`purple`((x),(y)) = ((0,-alpha),(alpha,0))((x),(y))+((alpha),(0))`

Another way of saying this is that `f`purple`((x),(y))` is defined by the six numbers `0,-alpha,alpha,0,alpha,0`.

# Transform the big **b** to the blue** b**.

Transforming the combined **b** (ABCDE) to the small blue tile is a little bit trickier.

The first step is to shink ABCDE by a factor `α^2` to get a tile of the correct size. Now, can you rotate it to match the small blue tile? (Try it yourself with actual** b** tiles.)

This transformation is tricky because you actually need to ‘flip’ the **b** before moving it to the required position.

First ABCDE is shrunk by a factor of `α^2`, then the tile is ‘flipped’ across the horizontal axis and shifted up to the required position.

The whole transformation to map the big **b** to the blue **b** can be written like this:

`f`blue`((x),(y)) = ((alpha^2,0),(0,-alpha^2))((x),(y))+((0),(1))`

so `f`blue`((x),(y))` is defined by the six numbers `alpha^2,0,0,-alpha^2,0,1`.

# Make a Golden b with just 12 numbers

`f`purple`((x),(y))` and `f`blue`((x),(y))` are examples of affine transformations. An affine transformation in two dimensions can be fully described by just six numbers. The first four numbers define a matrix that controls the shrinking/stretching, rotating and flipping. The last two numbers define a vector for the final shift horizontally and/or vertically.

Below is a tool where you can enter the numbers that define mappings to see the resultant IFS fractal.

Now enter the numbers for the two maps for the Golden **b** into the boxes labelled `a` to `f`, remembering that `alpha=0.786…` and `alpha^2=0.618…`:

`f`blue`((x),(y)) = alpha^2,0,0,-alpha^2,0,1`

`f`purple`((x),(y)) = ((0,-alpha),(alpha,0))((x),(y))+((alpha),(0))`

Enter `0.5` as the p-value for both maps. Enter zero for all values for the remaining two maps and click the **Make fern** button.

# What are the p-values?

You may have noticed that the Golden **b** you created above looks a bit ‘patchy’. That’s because the p-values control the probability that each map is chosen. But since the purple tile is bigger, we want it to be chosen more often than the blue tile.

How much more often? In proportion to the areas of the two tiles.

If the big **b** has area `1`, then the purple **b** must have area `alpha^2` and the blue **b** has area `alpha^4`. We saw previously that `alpha^2 + alpha^4=1`, which is good because the p-values for all maps must add to `1`.

Try entering `alpha^2` and `alpha^4` for the p-values and generating the Golden **b** again. Does it look any different?

## Want to teach transformations?

Get a Golden **b** Puzzle and start exploring.