← Teacher guide

Algorithms for classifying shapes

Students follow, fix and test algorithms that classify triangles and quadrilaterals, and describe how each works (AC9M7SP04, nodes 1 and 2).

Angles and shapes · Algorithms · about 40 minutes · Open the student lesson

Classroom resources

Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Timing

Predict and Run 8 min · Investigate 10 min · Modify 10 min · Practise and Make 12 min

Before class

Do the Run board yourself first. Students need the triangle and quadrilateral classes (Classifying shapes lessons).

The one idea: each shape must reach its own name, so the most specific question comes first. A short algorithm can be wrong; testing on one shape of every class finds it (Pia's mistake).

The board follows the key one question at a time; it is the same tool students use for living things in science. Students design on paper: the Make task asks for an algorithm for triangles by angles, drawn as a flowchart or written as numbered steps.

Judging two algorithms for efficiency (fewest questions) and for edge cases (the kite) are wider ideas.

This links to Code: an algorithm written in steps is a program with if and else.

Running the lesson

  1. Predict: ask what the machine should say for the equilateral triangle.
  2. Run: ask which triangle the algorithm gets wrong, and why.
  3. Investigate: ask what test shapes Pia should have used.
  4. Modify: ask students to describe the quad algorithm in words.
  5. Make: ask a partner to run the algorithm on a shape the author hasn't tried.

The hard part (on purpose)

Ordering the questions. Ask students to say which shape each question separates before they put it in a position.

When students get stuck

What you will seeA question to askThe fix
A student asks the general question first.What would a square be called by this question?Ask the most specific question first.
A student tests on one shape.Which classes has your test not reached?Test one shape of every class.
A student has a path with no end.Where does a 'no' lead?Every yes and every no must lead on to another question or a name.

Answers to the checks

  1. an algorithm with one question: An algorithm asks only: 'Are two sides equal? Yes: isosceles. No: scalene.' A triangle has sides 4, 4 and 4. What does it say?
    Isosceles. Two sides are equal, so it says yes. It never tells the equilateral triangle apart from the others.
  2. follow the algorithm: Follow this two-question algorithm for each triangle in turn. How does it name the 4, 4, 4 triangle? Compare with your prediction.

    Asking 'all three equal?' first gives the equilateral triangle its own name. The one-question algorithm called it isosceles.
  3. Fix the algorithm: How can you fix the one-question triangle algorithm?
    Ask 'Are all three sides equal?' first, then 'Are two sides equal?'
    Test the most specific class first. An equilateral triangle then gets its own name before the wider question is asked.
  4. Find the mistake: Pia tests her algorithm on a rectangle. Click the line where she wrongly decides it works.
    line 5
    Line 5: the algorithm gives a rectangle the name of the wider family. It should ask 'four right angles?' (or 'is it a rectangle?') before it settles for parallelogram.
  5. Testing: How should you test a classification algorithm?
    Run it on at least one shape of every class and check each name
    One example of every class shows missing branches and wrong orders.
  6. Order the steps: Put the steps of a triangle algorithm in order.
    see the program below
    Measure first. Test equilateral before isosceles. Scalene is what is left, so it needs no question.
    Start with a triangle and measure its three sides.
    Ask: are all three sides equal? If yes, say equilateral and stop.
    Ask: are two sides equal? If yes, say isosceles and stop.
    Otherwise, say scalene.
    
  7. The triangles: Run the fixed algorithm on all three triangles. Does every one get the right name?

    With the specific question first, each triangle reaches its own name.
  8. The quadrilaterals: Run the quadrilateral algorithm on all five shapes.

    Every shape reaches its own name, and the algorithm asks at most three questions.
  9. A shape it was not made for: A kite (two pairs of equal neighbouring sides, no parallel sides) is put through the quadrilateral algorithm. What happens?
    It is called a trapezium, which is wrong: the algorithm has no kite branch
    It answers 'no' to the first questions and ends at trapezium. An algorithm only works for the cases it was designed for: add a branch for kites.
  10. Questions for scalene: In the fixed triangle algorithm, how many questions does a scalene triangle need before it is named?
    2
    Two questions: all three sides equal? No. Two sides equal? No. Scalene.
  11. Trace a rhombus: A rhombus (four equal sides, angles 60° and 120°) goes through the quadrilateral algorithm. Which answers does it give, in order?
    Yes (four equal sides), then No (not all right angles)
    Four equal sides: yes. All right angles: no. So it is a rhombus.
  12. The longest path: The quadrilateral algorithm asks at most how many questions before naming any of its five shapes?
    3
    The longest path is A, then C, then D.
  13. Review: triangles: Review: a triangle has angles 90°, 45° and 45°. How many of its sides are equal?
    2
    Two equal angles mean two equal sides: an isosceles right-angled triangle.
  14. design a classifier: Run the quadrilateral algorithm on all five shapes again, and say each answer aloud as you go.

    Every shape reaches its own name.

Solutions

One possible solution for each task. Other correct programs are fine.

design and test › Order the steps

Open task: any program that does what the step asks.

design and test › The triangles

Open task: any program that does what the step asks.

design and test › The quadrilaterals

Open task: any program that does what the step asks.

design and test › A shape it was not made for

Open task: any program that does what the step asks.

design a classifier

Open task: any program that does what the step asks.

Stretch and support

Stretch: Compare two correct algorithms for the same job: which asks fewer questions on average? Then write the triangle algorithm in Python with `if` and `else`.

Support: Give students the questions on cards and ask them to lay out the order before they use the board.

Coach prompt (optional)

For a student who has done the lesson and is still stuck. They paste it into an AI tool your school allows; it asks questions about this lesson's one idea and doesn't give answers. Students see it on the course recap page only through a link ending in ?coach=1: recap with coach prompts.

You are a patient maths coach for a Year 7 student in Australia. Help me understand the ideas in ONE lesson only, from the lesson "Algorithms for classifying shapes".

The ideas:
- Designing a classification algorithm: I can Students design a step-by-step algorithm (as a flowchart or decision tree) that classifies shapes according to their attributes.
- Describing and evaluating algorithms: I can Students describe in words how an algorithm works and evaluate its correctness by tracing through it with test cases.

What understanding looks like:
- Produces a flowchart or decision tree that correctly classifies the target shapes.
- Includes decision points with clear yes/no branches.
- Tests the algorithm on at least two examples and corrects any errors.
- Correctly traces a classification algorithm with a test input.
- Identifies at least one case where a given algorithm fails (if one exists).
- Explains in plain language how the algorithm works.

Mistakes students often make here:
- A student asks the general question first.
- A student tests on one shape.
- A student has a path with no end.

How to coach me (rules from the Waypoints Kit coach):
- Ask me one short question at a time (2 to 4 sentences) and wait for my answer. Never give me the answer before you have heard my thinking, and don't hide the answer inside your question.
- Start in Discover: ask me to explain the idea in my own words, or to predict what happens in a simple example. I can switch any time: "teach it back" (you play a beginner and I explain), "spot the flaw" (you show me an answer with one common mistake and I find it), or "check" (I explain, and you tell me what is solid and what to revisit).
- If I am stuck or say "just tell me", ask what I think first, then give a small hint or a simpler example. Explain only after I have had a real go.
- Stay in this idea: don't teach later ideas or add extra content. If I ask about something else, say it is for another lesson and bring me back.
- After you help, ask me one reflective question, such as how I know my answer is right or what I would check.
- Praise my effort and method, not my ability.
- You can be wrong: if I rely on something you said, remind me to check it against my notes or the lesson. If you don't know, say so.
- Use simple words.
- Stop when I can explain the idea in my own words and get one new example right. Then tell me to go back to the lesson "Algorithms for classifying shapes".

Exit ticket

Why must a classifier ask 'are all three sides equal?' before 'are two sides equal?'

An equilateral triangle has two equal sides too, so the wider question would give it the wrong name.

What each step is for

Where it leads

This completes AC9M7SP04.

Where it leads: algorithms in code (the Code pathways), flowcharts for other decisions, and decision trees in Probability.