MyLeoNes®

Mathematics Year 6: Decompose, spot patterns, debug

Mathematics, Year 6 (Portugal): Keep the essential, split into steps, reuse a pattern, write an algorithm — and hunt the bug with the awkward case.

Five habits of a good solver

“Marta has 3 brothers, a dog and 45 pencils. She gives 2/5 of the pencils away. How many?” Abstract: keep only the essential, 45 pencils and 2/5 (brothers and dog do not count). Decompose: split into simple steps, 45 ÷ 5 = 9 and 9 × 2 = 18. Spot patterns: another problem may have the same shape. The algorithm is the step-by-step recipe that works for any numbers. Debug: look for and correct the errors when something fails.

A pattern you can reuse

Six people greet each other, one handshake per pair. How many handshakes? With 2 people there is 1; with 3, 3; with 4, 6; with 5, 10. The increases are 2, 3, 4…, so for 6 people you add 1 + 2 + 3 + 4 + 5 = 15. That pattern serves other problems of the same kind: in a tournament where each of 7 teams plays every other once, there are 1 + 2 + … + 6 = 21 matches. Spotting the pattern and applying it to a similar problem saves you starting from scratch.

A case: can three sticks make a triangle?

Algorithm: 1) write the three lengths; 2) find the longest; 3) add the two shorter ones; 4) if the sum is greater than the longest, a triangle exists; if not, it does not. Case 3, 4 and 5: 3 + 4 = 7 > 5, yes. Case 2, 3 and 6: 2 + 3 = 5 < 6, no. Case 4, 4 and 8: 4 + 4 = 8, which is not greater than 8: the two short sticks lie flat along the long one, so there is no triangle. The procedure splits the problem into steps and can be written as a program, for instance in Scratch.

A shortcut that only fails in the awkward case

Rui simplified the algorithm: “add the first two lengths and compare with the third”. He tested 3, 4, 5 and 5, 6, 10, and it worked. Debugging means hunting for the case that can break it: 8, 3, 4. The shortcut does 8 + 3 = 11 > 4 and says “yes”, but 3 + 4 = 7 < 8, so there is no triangle. It only worked before because the longest came last. The fix: always add the two shorter ones. Debug by testing hard cases and finding the failing step, not by starting over.

Where you see it: spreadsheets and programs

In a spreadsheet you write a formula once and it repeats down every row: an algorithm with a pattern. For the matches of a tournament with n teams, n × (n − 1) ÷ 2 (each team plays the other n − 1, and each match is counted twice, so you halve it) gives, for 2 to 8 teams, 1, 3, 6, 10, 15, 21 and 28 matches, the same numbers as the handshake pattern. A game program does the same: it is split into small blocks, rules repeat, hard cases are tested and it is corrected where it fails. Same thinking, with or without a computer.

Test what you learned

  1. Marta has 3 brothers and a dog, and 45 pencils. She gives away 2/5 of the pencils. What is the essential information?

    • a) 3 brothers, 1 dog and 45 pencils
    • b) 3 brothers and 2/5
    • c) 45 pencils and 2/5
    • d) Only 2/5

    Correct answer: c) 45 pencils and 2/5 — Right: the total and the fraction are all you need. 45 ÷ 5 × 2 = 18. The rest is decoration.

  2. 7 teams each play every other team once. Using the handshake pattern (2 people: 1, 3: 3, 4: 6, 5: 10), how many matches are there?

    • a) 28
    • b) 42
    • c) 49
    • d) 21

    Correct answer: d) 21 — Right: 1 + 2 + 3 + 4 + 5 + 6 = 21, or 7 × 6 ÷ 2 = 21.

  3. The shortcut says: “add the first two sides and compare with the third; if the sum is bigger, a triangle exists”. Which test is best to find its bug?

    • a) 3, 4, 5
    • b) 8, 3, 4
    • c) 5, 6, 10
    • d) 6, 6, 6

    Correct answer: b) 8, 3, 4 — Right: it says yes (8 + 3 = 11 > 4) but 3 + 4 = 7 < 8, so there is no triangle. With the longest first, the shortcut breaks.

Keep exploring

Other languages

Loading MyLeoNes®…