Algebra: Pens and patterns
View Sequence overviewRules can be applied and interpreted to solve problems involving multiple conditions and constraints.
Complex problems can be systematically broken down into smaller cases to test, refine, and justify a solution.
Whole class
Pens and patterns Slides
Each group
A3 paper
Calculator
Access to computers
Pens and patterns Spreadsheet
Build
Show Slide 19 with the summary of the rules:
- The show will have a total of 400 sheep and pigs.
- There can be any combination of sheep and pigs but there must be at least 80 of each animal.
- Each sheep pen can hold two sheep. Each pig pen can hold three pigs.
Then introduce the idea that each panel costs money to buy:
- Sheep pen panels cost $10 for each panel used. Sheep pens must be a single row of connected squares.
- Pig pen panels cost $20 for each panel used. Pig pens can be arranged in any form.
Set the challenge to create a design that gives the cheapest possible price.
Allow students time to come up with one or two designs and costs. Discuss how much time it takes to calculate the costs of each design. Introduce the Pens and patterns Spreadsheet and demonstrate how to use it with a sample calculation.
Sample calculation: 100 sheep in a row of 50 pens and 300 pigs in 100 pens arranged in a 5 × 20 array will give a total cost of $6 010.
Rather than entering the 1s and 0s for each cell individually, it may be quicker to use the spreadsheet fill handle. Select a row or column of 1s, then drag from the bottom-right corner of the selected cells to extend the pattern across or down.
For example, to add more columns, select the right-hand column of 1s and drag across. To add more rows, select the bottom row of 1s and drag down.
Students can then be provided with A3 paper to sketch their designs and show their calculations. Calculators should be available for this task.
Conclude the task by having each group share their best design, the total cost of the panels, and their reasoning.
82 sheep in 41 pens require 124 panels. Cost = $1 240.
318 pigs in 106 pens arranged in a 10 × 10 array with an attached 1 × 6 array requires 233 panels. Cost = $4 660
Total cost = $5 900
Students are likely to have noticed that maximising the number of pigs and minimising the number of sheep was the most efficient strategy. A follow-up investigation could be to find how much the price per panel would have to change for it to become cheaper to have the maximum number of pigs rather than sheep. Students could also investigate how having a set minimum for each animal impacts this decision.
If students want to use the spreadsheet and change the cost, they will need to unprotect the worksheet to edit these values. This can be done from the top banner menu: Review → Unprotect Sheet.
Using digital tools

It is important to teach students not only how to use digital tools such as spreadsheets, but also when their use is appropriate. When students are collecting values, structuring a table, generating outputs from inputs or comparing cases, spreadsheets support accuracy and clarity while keeping the focus on the mathematics.
Used well, spreadsheets also make key aspects of computational thinking visible. Students identify important variables, decide what needs to be calculated, and express relationships as repeatable steps. They learn the difference between copying values step by step and creating a relational formula that links inputs to outputs and can be filled down consistently. Just as importantly, they learn to validate and debug as they check results against known cases and refine rules when outputs do not make sense.
In this task, the spreadsheet automates the repeated calculations once students have identified the relevant inputs, such as the number of pens, rows, columns and panel costs. It does not decide which layout is best or explain why a rule works. Students still need to choose a design, interpret the outputs, compare alternatives and justify their recommendation. In this way, the spreadsheet reduces repetitive calculation while keeping the mathematical thinking focused on structure, relationships and decision-making.
Spreadsheets also allow students to move quickly between representations, compare scenarios and explore “what if?” questions, supporting deeper reasoning rather than more repetition.
It is important to teach students not only how to use digital tools such as spreadsheets, but also when their use is appropriate. When students are collecting values, structuring a table, generating outputs from inputs or comparing cases, spreadsheets support accuracy and clarity while keeping the focus on the mathematics.
Used well, spreadsheets also make key aspects of computational thinking visible. Students identify important variables, decide what needs to be calculated, and express relationships as repeatable steps. They learn the difference between copying values step by step and creating a relational formula that links inputs to outputs and can be filled down consistently. Just as importantly, they learn to validate and debug as they check results against known cases and refine rules when outputs do not make sense.
In this task, the spreadsheet automates the repeated calculations once students have identified the relevant inputs, such as the number of pens, rows, columns and panel costs. It does not decide which layout is best or explain why a rule works. Students still need to choose a design, interpret the outputs, compare alternatives and justify their recommendation. In this way, the spreadsheet reduces repetitive calculation while keeping the mathematical thinking focused on structure, relationships and decision-making.
Spreadsheets also allow students to move quickly between representations, compare scenarios and explore “what if?” questions, supporting deeper reasoning rather than more repetition.