Algebra: Pens and patterns
View Sequence overviewGrowing patterns can be described with step-by-step and relational rules.
Rules can involve more than one input, such as the number of rows and the number of columns.
Rules can be used to compare and optimise different designs.
Whole class
Pens and patterns Slides
Each group
Toothpicks or similar for constructing pens
Modelling clay or blu tack to join toothpicks
Each student
Pig pens Student sheet
Task
Briefly review the findings from the previous task:
Last lesson, we found that a single row of connected sheep pens used fewer panels than separate pens, because neighbouring pens shared sides. For a row of sheep pens, the number of panels could be found by multiplying the number of pens by three, then adding one more panel.
Explain that the organisers have now solved one part of the exhibition hall by using a single row of connected sheep pens. However, they also need to plan an area for the pigs.
Tell students that the pig pens will take up a different section of the hall. Judges only need to access one side of each pen, so the organisers are considering arranging the pens in two connected rows.
Show Slide 12 and pose the problem as a question: If we arrange the same number of square pens in two connected rows instead of one long row, will it change the number of panels needed?

Ask students to make an initial prediction:
- Will two connected rows use more panels, fewer panels or the same number of panels as one long row?
- Why do you think that?
- What would we need to compare to find out?
- Do you think the rule we used last lesson will still apply when we have two connected rows?
Explain that students will investigate whether connecting rows of pens changes the number of panels needed, and whether they can find an efficient way to count the panels without building every arrangement one panel at a time.
Split students into groups and distribute toothpicks and joining material.
Invite groups to build two-row arrangements of connected square pens and investigate how the number of panels changes as the arrangement grows. Encourage them to begin with small two-row arrangements, then test at least one larger arrangement that would be difficult to count one panel at a time.
Have students record their thinking in a way that makes sense to them. This might include a drawing, table, diagram, number sentence or written explanation.
Ask students to compare their two-row arrangements with the single-row rule from the previous task.
As students investigate arrangements, circulate and ask questions such as:
- How many pens are in your arrangement?
- How many panels does it use?
- Where are panels being shared?
- What changes when another column is added?
- Can you count a larger arrangement without building the whole thing?
- How does this compare with one long row?
Look for students who are:
- counting every panel one by one.
- comparing two rows with one long row.
- noticing that pens are added in columns of two.
- noticing that each new column adds five panels.
- describing the pattern as “start at seven and add five each time”.
- counting five panels for each column, plus two extra panels.
- starting with separate pens and subtracting shared panels.
These strategies can be used in the next discussion to develop a rule for two connected rows of pens.
At this stage, do not suggest a rule to students or confirm their answers. The purpose is for students to test their predictions, notice structure, and begin developing their own counting methods.
Ask groups to leave one two-row arrangement visible on their table and be ready to explain how they counted the panels.
Bring the class together and ask selected groups to share how they counted the number of panels in their two-row arrangements.
Record agreed values on the board, such as:
| Number of columns | 1 | 2 | 3 | 4 | 5 |
| Number of pens | 2 | 4 | 6 | 8 | 10 |
| Number of panels | 7 | 12 | 17 | 22 | 27 |
Discuss:
- For the same number of pens, does a two-row arrangement use fewer panels than one long row?
- What did you notice?
- Why are the number of pens increasing by two each time?
- What changes each time another column of two pens is added?
- How many new panels are needed each time?
- Where can you see the five new panels in the model?
Draw out the step-by-step rule and record it in words:
Start at seven panels, then add five panels each time another column of two pens is added.
Then ask:
- Would this be efficient for 20 pens?
- What about 100 pens?
- Is there a way to count the panels directly?
Guide students towards developing a direct rule by linking the number of panels to the number of columns.
Use the sentence starters:
- The number of panels can be found by...
- This works because...
If students are struggling to see the structure, show the 2 × 3 arrangement on Slide 12 and ask:
- How many columns are there?
- How many pens are in each column?
- What panels belong to each column?
- If we count five panels for each column, what has not been counted yet?
- Where are the two extra panels?
Look for or draw out these strategies:
- Add another column
- Students may notice that the first column uses seven panels and each new column adds five panels.
- Worded rule: Start at seven and add five each time.
- Columns plus extras
- Students may count five panels for each column, then add two extra panels at the end.
- Worded rule: Multiply the number of columns by five, then add two.
- Pens first, then columns
- Students may begin with the number of pens, then realise that two rows means there are half as many columns.
- Worded rule: Halve the number of pens, multiply by five, then add two.
- Separate pens, then shared sides
- Students may start with four panels per pen, then subtract the shared panels.
- This strategy is useful to acknowledge, but do not spend too long on it unless it helps the class see why connected pens use fewer panels.
Bring the discussion back to the “columns plus extras” strategy. This gives a rule is easy to apply for larger numbers and connects clearly to the structure.
Record the agreed rule in words:
The number of panels can be found by multiplying the number of columns by five, then adding two more panels.
Ask students to check this rule with known values from the table:
- For three columns: $5 \times 3 + 2 = 17$.
- For five columns: $5 \times 5 + 2 = 27$.
Then connect the rule back to the number of pens: Because there are two rows, the number of columns is half the number of pens.
As a class, agree on a final rule that everyone can use:
The number of panels can be found by halving the number of pens, multiplying by five, then adding two more panels.
Ask:
- What had to be true about the number of pens we tested?
- Why did halving the number of pens make sense in these arrangements?
- Would this rule still work if there was an odd number of pens?
Draw out that this rule applies to two complete rows of pens, where the number of pens can be split evenly between the two rows. It will not apply to arrangements with an odd number of pens or incomplete rows.
Finish by asking:
- Where can we see the “multiply by five” in the arrangement?
- Where can we see the “add two”?
Students will build on this rule in the next part of the task to work out the number of panels for larger arrangements.
Explain that the organisers are concerned they may not have enough space for all of the pigs. They suggest an arrangement where pens can be arranged in rectangular arrays, and internal gates are provided so that the pigs can be safely reached when needed.
This means the organisers are now focusing on a different question:
If the pens are arranged in a rectangular array, how can we work out the number of panels needed?
Show Slide 13 (pausing the animation before the hints) and explain that a rectangular array has rows and columns, so this problem is different from the row patterns investigated earlier. There are now two inputs to consider:
- the number of rows.
- the number of columns.
Allow time for groups to build several rectangular arrays of connected square pens and investigate how the number of panels changes.
Encourage students to build their arrays in a consistent way so they can compare how the panel count changes. They might keep the number of rows the same and change the number of columns, or keep the number of columns the same and change the number of rows.
Have students record their thinking in a way that makes sense to them. This might include a drawing, table, diagram, number sentence or written explanation.
The two hints on Slide 13 can be introduced at any stage to support student progress.
As students investigate arrangements, circulate and ask questions such as:
- How many rows are in your array?
- How many columns are in your array?
- How many pens are there altogether?
- How many panels are needed?
- Where are panels being shared?
- What changes when another column is added?
- What changes when another row is added?
- How are you organising your results?
- Are you changing one thing at a time?
Look for students who are:
- counting every panel one by one.
- recording arrangements using rows and columns.
- noticing that rows × columns gives the number of pens.
- keeping one input fixed while changing the other.
- counting horizontal panels and vertical panels separately.
- trying to adapt the two-row rule to other arrays.
- beginning to describe a method that could work for any rectangular array.
Do not develop a rule at this stage. The purpose is for students to test different arrays, notice that both rows and columns matter, and begin organising their counting methods.
Ask groups to leave one or two rectangular arrays visible on their table and be ready to explain how they counted the panels.
Anticipating student thinking

Anticipating student thinking involves envisioning likely student strategies (and difficulties) and planning how you will respond.
Plan for the different ways students will try to generalise the pattern (and the places they are likely to get stuck), so you can respond with prompts that move thinking forward without giving away a rule.
Possible strategies
- Fix one variable (rows or columns) and vary the other to spot the numerical pattern.
- Build a “one row” rule, then scale up by building the next row.
- Count different elements of the structure separately—outside perimeter panels vs internal shared panels.
Possible difficulties
- Treating it like a one-input sequence and ignoring the second variable.
- Mixing up what changes when a row is added vs when a column is added.
- Double-counting shared panels or missing internal joins.
- Losing the ability to recognise any patterns from a poorly organised table of results.
Prompts that move thinking forward
- What stays the same if rows stay fixed and columns change?
- What changes if columns stay fixed and rows change?
- Can you explain which part of your rule comes from the perimeter and which comes from shared walls?
- Test your rule on a new size (e.g. 3 × 5). Does it still work? What did you assume?
In summary, build a plan for a likely pathway, but stay open: listen closely to students’ strategies as they emerge, then use prompts to help them refine and extend their method toward a general rule.
Anticipating student thinking involves envisioning likely student strategies (and difficulties) and planning how you will respond.
Plan for the different ways students will try to generalise the pattern (and the places they are likely to get stuck), so you can respond with prompts that move thinking forward without giving away a rule.
Possible strategies
- Fix one variable (rows or columns) and vary the other to spot the numerical pattern.
- Build a “one row” rule, then scale up by building the next row.
- Count different elements of the structure separately—outside perimeter panels vs internal shared panels.
Possible difficulties
- Treating it like a one-input sequence and ignoring the second variable.
- Mixing up what changes when a row is added vs when a column is added.
- Double-counting shared panels or missing internal joins.
- Losing the ability to recognise any patterns from a poorly organised table of results.
Prompts that move thinking forward
- What stays the same if rows stay fixed and columns change?
- What changes if columns stay fixed and rows change?
- Can you explain which part of your rule comes from the perimeter and which comes from shared walls?
- Test your rule on a new size (e.g. 3 × 5). Does it still work? What did you assume?
In summary, build a plan for a likely pathway, but stay open: listen closely to students’ strategies as they emerge, then use prompts to help them refine and extend their method toward a general rule.
Bring the class together to develop a shared rule.
Discuss:
- What arrays did you test?
- How did you organise your results?
- What changed when the number of rows changed?
- What changed when the number of columns changed?
- Did anyone find a method that worked for more than one array?
Choose two or three strategies that show different ways of organising the count. These might include counting every panel, counting horizontal and vertical panels separately, starting with separate pens and removing shared panels, or using the number of pens, rows and columns.
Record student methods on the board for comparison.
Use one common array, such as a 2 × 3 or 3 × 4 arrangement, to test and compare the methods.
Ask:
- Do all of these methods give the same number of panels?
- Are they counting the same structure in different ways?
- Which method is easiest to use and explain?
Slides 14 and 15 are available if required to demonstrate how a rule could be created. Students may have created this rule, or it can be shown and added to the rules the students have generated.
Look for or draw out these methods:
- Counting every panel
- Useful for small arrays, but inefficient for larger arrays.
- Horizontal and vertical panels
- Students count panels running across, then panels running down, and add them together.
- Separate pens, then shared panels
- Students begin with four panels for every pen, then subtract the shared sides.
- Pens, rows and columns
- Students may see each pen as contributing two panels in an L-shape. This accounts for two sides of every pen. The remaining open sides are then closed by adding one extra panel for each row and one extra panel for each column (see Slides 14 and 15).
- This gives the rule: double the number of pens, then add the number of rows and the number of columns.
As a class, agree on a rule that can be used for any number of rows and columns, to be used for the next challenge. The following rule (explained in more detail on Slides 14 and 15) may emerge from the discussion, or it can be introduced as an efficient method to test:
Number of panels = number of rows × number of columns × 2 + number of rows + number of columns
Have students test the rule on one of the arrays they built to check that it matches their panel count.
If time is short, this section can be omitted or used as an introductory activity for Task 3. It gives students an opportunity to apply their new rule and provides a lead-in to the next lesson, where they will be challenged to optimise the layout of the show.
Explain that the total number of pigs at the show have been determined and the organisers now need to decide the most efficient design for 24 pig pens. Students will first consider rectangular arrangements, then investigate whether a non-rectangular arrangement could use the same number of panels or fewer.
Show Slide 16 with the design challenge for 24 square pens and give each student a copy of Pig pens Student sheet.
Allow students time to find as many rectangular arrangements of 24 pens as they can. For each arrangement, students should record:
- the number of rows.
- the number of columns.
- the number of panels required.
For non-rectangular arrangements, students may need to sketch, build or reason about shared panels rather than applying the rectangular array rule directly.
There are eight rectangular arrangements if rows and columns are treated as different, but only four unique rectangular shapes because rows and columns can be interchanged (3 × 8 = 8 × 3). The minimum number of panels will be 58.
| Number of rows | Number of columns | Number of panels needed |
| 1 | 24 | 73 |
| 2 | 12 | 62 |
| 3 | 8 | 59 |
| 4 | 6 | 58 |
| 6 | 4 | 58 |
| 8 | 3 | 59 |
| 12 | 2 | 62 |
| 24 | 1 | 73 |
If time allows, continue the investigation with a 27-pen challenge. Possible arrangements include:
- a 3 × 9 rectangle, which uses 66 panels.
- a 5 × 5 square with two extra pens added.
- a 6 × 5 rectangle with three pens removed.
The second and third arrangements above can create the same non-rectangular shape using 65 panels, which is fewer than the most efficient rectangular arrangement for 27 pens.
As an extension, challenge students to find other total numbers of pens where the most efficient rectangular arrangement does not use the fewest panels overall.
Bring the students back as a whole class to discuss their findings.
Discuss:
- What rectangular arrangements are possible for 24 pens?
- Why do 4 × 6 and 6 × 4 arrangements use the same number of panels?
- Which rectangular arrangement uses the fewest panels?
- What do you notice as the number of rows and columns become closer together?
- Could a non-rectangular arrangement use the same number of panels or fewer?
- Does our agreed rule still apply if the arrangement is not a rectangle?
Students should notice that the total number of panels generally reduces as the two factors become closer together (for example, 6 × 4 uses fewer panels than 3 × 8). This can lead to the non-rectangular part of the challenge. For example, students may explore a 5 × 5 square with one pen removed. This arrangement uses 58 panels, the same number as the most efficient rectangular arrangement (6 × 4). However, because it is not a rectangle, the rectangular array rule cannot be applied directly; students need to reason from the structure of the design.
You might like to have each group discuss what they learned and share one response with the class.
Draw out that:
- the same number of pens can be arranged in different ways.
- different arrangements can use different numbers of panels.
- growing patterns can be described with step-by-step rules and relational rules.
- some rules need more than one input, such as the number of rows and the number of columns.
- efficient arrangements often happen when the number of rows and columns are closer together, but non-rectangular arrangements may also need to be considered.
Finish by asking:
How did using a rule help us compare different designs more efficiently?
Explain that this thinking will support the next task, where students will optimise the layout of the show.