Leicester Maths All articles
Family Activities

Punch Cards and Pant Legs: A Leicester Knitting Code for Curious Families

Leicester Maths
Punch Cards and Pant Legs: A Leicester Knitting Code for Curious Families

Leicester has a long, inventive history of making things from loops of yarn. The city's hosiery trade turned knitting from a handcraft into a machine-powered industry, and along the way it turned patterns into instructions. That is a maths story as much as a textile one. A knitted row is a sequence of choices: this stitch or that stitch, this colour or that colour. Once you see it that way, the knitting machine starts to look like a very patient computer.

Loops, repeats and the maths of a row

Most knitted patterns are built from a small block that repeats. A cable might take six stitches, a Fair Isle motif might take eight, a simple rib might take two. If the pattern block is six stitches wide and the row is 180 stitches long, you get 180 ÷ 6 = 30 repeats. That is multiplication doing the heavy lifting before the yarn has even left the ball.

Repetition also brings in modular arithmetic. Imagine a two-colour pattern where every fourth stitch is red and the rest are cream. The colour of stitch number n depends on n modulo 4. If the remainder is 0, choose red; otherwise choose cream. A child who has met remainders in class has just met the rule behind a striped hat. The maths is not bolted on afterwards; it is the pattern's skeleton.

From punch cards to pixels

Older knitting machines and Jacquard looms used punch cards to control which needles moved. A hole meant yes, no hole meant no. Needle up or needle down. Yarn forward or yarn back. That is binary: two states, repeated in a long sequence. The card does not store a picture in the way a photograph does. It stores a set of decisions, and the machine turns those decisions into fabric.

This is the same idea that sits behind digital images. A black-and-white grid can be written as 1s and 0s: 1 for dark, 0 for light. A knitting pattern can be written the same way: 1 for colour A, 0 for colour B. The punch card and the pixel are cousins. Leicester's textile workers were working with coded patterns long before most of us had a screen in our pocket.

Family challenge: encode a two-colour pattern

This activity works at a kitchen table, in a classroom or in a museum workshop. You need squared paper, two coloured pencils and something to measure with.

  1. Design a motif on an 8 by 8 grid. Use only two colours. Keep it simple at first: a heart, a diamond, a letter, a tiny tiger.
  2. Turn the grid into binary. Choose one colour to be 1 and the other to be 0. Write each row as a string of eight digits. Read the rows aloud. You have just encoded an image as a sequence of on/off instructions.
  3. Decide on a finished width. Suppose your scarf is 120 stitches wide. If your motif is 8 stitches wide, work out how many full repeats fit: 120 ÷ 8 = 15. No leftovers. Now try a motif that is 7 stitches wide. 120 ÷ 7 = 17 remainder 1. You can fit 17 repeats and have one stitch left over. That leftover stitch is a design decision: a border, a seam allowance or waste.
  4. Investigate symmetry. Does your motif look the same when mirrored left to right? Does it have rotational symmetry? If it does, can you encode only half of it and use a rule to generate the other half? That is compression, in a very homemade form.

The waste question

Waste in textile maths is not just about discarded yarn. It is also about partial repeats, edge stitches and the difference between the width you planned and the width the pattern allows. A pattern that is 9 stitches wide will never fit neatly into a 100-stitch row without a remainder. You can change the row width, change the motif or accept a border. There is no single right answer, which is exactly why it makes a good problem.

Ask everyone to calculate the leftover stitches for three different motif widths and one fixed row width. Then ask which design they would actually make. The answer will involve maths, but also taste, patience and the price of wool. That is a healthy combination.

Why this belongs in Leicester

Leicester's hosiery heritage is often told as a story of machines and mills. It is also a story of codes: holes in cards, repeats in rows, rules for colour. Once you start noticing those rules, a knitted sleeve becomes a puzzle you can read. And once you can read it, you can design your own.

So next time you see a patterned jumper, look for the repeat. Count the stitches if you can. Then imagine the punch card, the binary row or the modular rule that could have made it. The machine did the knitting, but the maths wrote the plan.

All Articles

Related Articles

Counting Round the Clock Tower: Modular Arithmetic on a Leicester Street Corner

Counting Round the Clock Tower: Modular Arithmetic on a Leicester Street Corner

Before the Bulbs Come On: A Leicester Crowd-Maths Field Guide

Before the Bulbs Come On: A Leicester Crowd-Maths Field Guide

Lighting Up the Golden Mile: The Maths Hiding in Leicester's Diwali Celebrations

Lighting Up the Golden Mile: The Maths Hiding in Leicester's Diwali Celebrations