Botanica Mathematica

a textile taxonomy of mathematical plant forms

Introduction to L-systems


The Botanica Mathematica project is about using simple mathematical rules to generate pieces of knitting or crochet. If the rule involves choosing what to do based on what you have already done, then you will be making an L-system. Madeleine has already written a post with a simple example, and in this post I want to elaborate on it some more.


On the left is Madeleine’s piece of knitting, and it was generated with two colours and two simple rules. First, if you are at a green stitch, you should knit a brown one. Second, if you are at a brown stitch you should knit a brown one AND create a new green stitch. To start the whole thing off, knit a single brown stitch.

The first thing you notice when you look at the knitting is that it flares out the more you knit. The number of stitches in each round is growing at an ever-faster rate. But there are many more interesting patterns hidden in the interplay between the two colours.

Let’s call our two colours B and G and let’s write down the pattern for the first few rows:

1) B
2) BG
3) (BG)B = BGB
4) (BG)B(BG) = BGBBG

Can you spot any patterns?

One of the first things I noticed was the number of stitches in each row. We get 1,2,3,5,8,13,… Fibonacci numbers! We can also look at the ratio of Bs to Gs in each successive row. The ratios we get are 1:0, 1:1, 2:1, 3:2, 5:3, 8:5,… Fibonacci numbers again! So that’s nice. It means that as the rows get longer and longer, the ratio of Bs to Gs will approach the golden ratio. To get the next Fibonacci number you add up the two previous numbers in the sequence. Why are Fibonacci numbers appearing here?

If you look at the sequence again, you’ll see that the pattern of colours in a row is actually the concatenation of the two previous rows. So, looking at the last row we made, we see that BGBBGBGBBGBBG = (BGBBGBGB)(BGBBG). That’s very neat, and quite unexpected from the two rules we had at the beginning.

Fibonacci plantFibonacci numbers appear in nature all the time. For example, take the stalk of a plant. It takes a little while to grow strong enough, but when it does it will split off into the main stalk plus a new little shoot. The shoot will take a while to grow strong enough, but when it does it will itself split off a new shoot. If a main shoot is called B and a new shoot is called G, then this is exactly the same pattern as in the knitting and it will generate a Fibonacci number of branches.

What happens if we don’t start with just a B, but with some other sequence of colours? The picture below is a piece of crochet I did which started with the stitches BGBBGG (except that I used red and purple instead of brown and green, respectively) joined in a circle.


The piece I got in the end has some lovely patterns, such as spirals of purple and branches of purple coming off from one another.  Just like the stalks of a plant keep branching off from one another! And actually, just like Madeleine’s knitting, even though we started our pieces with different stitches.

We would love to hear from you with examples of your own L-system knitting patterns. All you need is a rule for generating a new row of stitches based on the pattern of stitches in the previous row. What happens if you try more colours? What happens if you knit straight rather than in the round? Tell us your ideas and send us your photos!

4 thoughts on “Introduction to L-systems

  1. I got inspired by @King_Carmen and this page, and came up with this hack: (just hit Grow button). Btw, you’ll need a modern browser, like Chrome.

  2. Pingback: Edinburgh Events Annouced! | Botanica Mathematica

  3. Pingback: Fibonacci Tree | Botanica Mathematica

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s