AC9M8SP04 · YEAR 8 · SPACE

Geometric Algorithms

ACARA v9 CONTENT DESCRIPTION design, create and test algorithms involving a sequence of steps and decisions that identify congruency or similarity of shapes, and describe how the algorithm works

What an algorithm is

An algorithm is a finite, ordered sequence of clear steps and yes-or-no decisions that always ends with an output. Everyday life is full of them: a recipe takes ingredients as its input and gives a finished dish as its output, and a set of directions takes a starting place and a destination and tells you exactly which turns to make. What makes these procedures algorithms is that the steps are unambiguous and follow a fixed order, and that following them always stops with a result. The real value is repeatability. If two people follow the same steps on the same input, they get the same result, and that is why an algorithm can be handed to anyone, or to a machine, and trusted to behave the same way every time. In this unit we take the geometry tests for congruence and similarity that you already know and organise them into procedures of exactly this kind.

What an algorithm is
Clear steps and yes-or-no decisions that reach an output.
an algorithm is an ordered list of clear steps and yes-or-no decisions that always reaches an output.

An algorithm for congruence

To decide whether two triangles are congruent, we can write the work as a short procedure. First, match up the corresponding parts so we know which sides and angles to compare. Then test the matched data against each congruence condition in turn: try SSS, then SAS, then ASA, then RHS. If any one of those tests is satisfied, the procedure stops at once and outputs the word congruent. If none of them is satisfied after all four have been tried, the procedure outputs not congruent. The four tests are not new here; they come from the congruence work in the earlier unit. What is new is that we have organised them into a clear procedure with a definite order, a stopping rule, and a single output, so that the decision can be made the same way every time.

An algorithm for congruence
A numbered procedure built from the congruence tests.
a congruence algorithm checks the data against SSS, SAS, ASA and RHS in turn, and outputs congruent if any one fits.

The same algorithm as a flowchart

The same steps can be drawn as a flowchart. Rectangles stand for steps, such as the start and the two possible outputs, and diamonds stand for the yes-or-no decisions, one for each of SSS, SAS, ASA and RHS. Arrows join the shapes and show the flow: a yes arrow leaves a decision and leads straight to the congruent terminal, while a no arrow drops down to the next test. A flowchart makes the branching and the stopping points easy to see at a glance, because the eye can follow the arrows instead of reading a paragraph. It is one of the most common ways to communicate an algorithm, and it makes plain that falling through every no is what finally leads to the output not congruent.

The same algorithm as a flowchart
Each test is a decision diamond with yes and no arrows.
as a flowchart, each test is a decision diamond; a yes leads to congruent, and falling through every no leads to not congruent.

Testing the algorithm

An algorithm must be tested, not just written, and the way to test it is to trace example inputs through it step by step. Feed in two triangles with sides 5, 6, 7 and 5, 6, 7: at the first decision the SSS test gives yes, so the trace reaches the output congruent, which is exactly what we expect. Now feed in 5, 6, 7 and 5, 6, 8: the matched data fails SSS, then SAS, then ASA, then RHS, every test gives no, and the trace reaches the output not congruent. Trying both an ordinary matching case and a near miss that should fail builds confidence that the steps are right and that every input is sent to a sensible output. Good testing also looks for edge cases, the inputs that sit right on the boundary of a decision.

Testing the algorithm
Trace example inputs and check where they end up.
test the algorithm by tracing inputs: equal triples reach congruent, a mismatched pair reaches not congruent.

An algorithm for similarity

Similarity needs a parallel procedure. After matching the parts, the algorithm asks whether the corresponding angles are equal, which is the AAA condition; if they are, it outputs similar. If the angles are not known to be equal, it asks instead whether the corresponding sides are in the same ratio; if they are, it again outputs similar. If neither test holds, the output is not similar. The shape of this procedure matches the congruence one, but the pass condition is different, and that difference matters. Similarity allows a change of size, so two triangles can be similar while one is an enlargement of the other, whereas congruence requires the same size as well as the same shape. The two algorithms therefore differ in what counts as a pass.

An algorithm for similarity
Equal angles or sides in the same ratio output similar.
a similarity algorithm checks for equal angles or sides in equal ratio, and outputs similar if either holds.

Why this matters

Turning a set of tests into a clear algorithm is exactly how a computer is told to compare shapes, sort images, or check that the parts of a design fit together. Writing the steps and decisions precisely, with named inputs, an ordered list of steps, clear yes-or-no decisions, and a definite output, is the heart of computational thinking, and the same discipline reaches far beyond geometry into every part of mathematics and science. The most common slip is a step that is vague, so that two people read it differently, or a missing branch that leaves some input with no output at all. Tracing inputs through the procedure is what catches those faults. For now we keep to plain-language algorithms and flowcharts for the two-dimensional congruence and similarity decision; writing the same ideas as real code in a programming language, and measuring how fast they run, comes in later years.

Quick self-check
1. What is an algorithm?
2. In a congruence algorithm, which tests does it check the triangles against?
3. In a flowchart, what does a diamond shape usually represent?
4. Two triangles both have sides 5, 6 and 7. What does the congruence algorithm output?
5. What does a similarity algorithm accept that a congruence algorithm does not?