Farmyard Friends

Task 129 ... Years 2 - 10


Five animals have to be placed into five pens according to the restrictions of the problem. This language and logic puzzle entices students through the use of toy animals. Also, it doesn't seem too difficult because there isn't much writing on the card. However, it is exciting to discover that there is more than one solution and this opens the door to a rich iceberg of possibilities that can extend into the senior years of high school.


  • 5 animal cards


  • mathematical language related to space and order
  • spatial facts and relationships
  • problem solving strategies
  • combination theory
Farmyard Friends


A task is the tip of a learning iceberg. There is always more to a task than is recorded on the card.

Even quite young students usually have no problem finding one solution to this puzzle, but the challenge is in finding more. The words 'the end' and 'after' can be interpreted in various ways, eg:

  • the end - which end?
  • after - immediately after, or anywhere after?
and the various language interpretations are what leads to multiple solutions. The minimum set of solutions is:
  • cow, chicken, goat, pig, horse
  • goat, chicken, cow, pig, horse
  • horse, cow, chicken, goat, pig
  • horse, goat, chicken, cow, pig
This set of solutions results from a 'left to right' walk along the line of pens. But what happens if the walk is from 'right to left'. What, for example, does 'after' mean now. With this approach a second set of four solutions can be found.


  • Can you change the clues so that there is only one solution?
  • Put the animals in the pens your own way. Now make up a set of clues and try them out on another group.
  • If there were no clues at all, how many ways could the animals be arranged in the pens?
  • What happens if there is only one clue, eg: The cow is in the pen at the end.?
  • What happens if the only clue is a negative, eg: The horse is not next to the pig.?
  • What happens if there are only two clues, eg: The cow is in the pen at the end. and The goat is not next to the cow.?
  • Can you write a set of clues so the puzzle has exactly 4 solutions ...10 solutions ...29 solutions ...any number of solutions up to 120?
  • How do you interpret the problem if the pens are in a circle?
Note: This investigation has been included in Maths At Home. In this form it has fresh context and purpose and, in some cases, additional resources. Maths At Home activity plans encourage independent investigation through guided 'homework', or, for the teacher, can be an outline of a class investigation.

Whole Class Investigation

Tasks are an invitation for two students to work like a mathematician. Tasks can also be modified to become whole class investigations which model how a mathematician works.

Introduce the investigation using students to act as the five animals. You can just write the name of the animals on A4 pieces of paper, but an extra touch of interest comes from using enlarged clip art pictures. Also write out the clues large enough for all the students to see. The upper section of the whiteboard will do the job here. The investigation begins with the class telling the animals the order in which they should stand.

Once the solution is found encourage each student to record it in their journal and then surprise them with ... Guess what. There is another solution. Ask the students to quickly rip up paper and write the animal names (one set between two) and use these to find and record it.

Encourage students to ask:

  • How many solutions are there?
  • How do we know when we have found them all?
and expect plenty of discussion as the basic four, and then alternatives are found.

This Year 3 class at Trädgårdsstadsskolan, Sweden used large and small animal cards and colourful pens...
...and recorded their solutions on the whiteboard.

At Silvan Primary School, Australia, the investigation was used as part of a parent maths night.
One family's solution.

Use the questions in the iceberg section to extend the investigation.

For more ideas and discussion about this investigation, open a new browser tab (or page) and visit Maths300 Lesson 47, Farmyard Friends, which includes large and small cards for printing.

Is it in Maths With Attitude?

Maths With Attitude is a set of hands-on learning kits available from Years 3-10 which structure the use of tasks and whole class investigations into a week by week planner.

The Farmyard Friends task is an integral part of:

  • MWA Space & Logic Years 3 & 4

The Farmyard Friends lesson is an integral part of:

  • MWA Space & Logic Years 3 & 4
  • MWA Space & Logic Years 9 & 10

Green Line
Follow this link to Task Centre Home page.