topic badge

12.04 Solve problems using an algorithm

Lesson

Solve problems with algorithms

Algorithms do things. Tada.

Here is another algorithm - this time a little more complex:

Algorithm StepsExample
\text{Think of any two numbers from $1$ to $9$.}\text{$3$ and $5$}
\text{Make two $2$-digit numbers by putting them in either order.}\text{$53$ and $35$}
\text{Subtract the smaller number from the larger number.}53-35=18
\text{Divide the result by $9$.}18\div 9=2
\text{Finally, add the smaller starting number.}2+3=5

In the example, we chose the numbers 3 and 5 to start with. In the last step of the algorithm, we added the smaller of these numbers, 3, and got a result which was the larger number, 5.

Does this always happen? Try it yourself with two different numbers.

Examples

Example 1

We are going to add these two numbers together, using the addition algorithm below:

37+46

  1. Add the units.

  2. Is the result at least 10?

    • If no - GO TO step 3.

    • If yes - regroup into tens and units, then GO TO step 3.

  3. Add the tens.

  4. Is the result at least 100?

    • If no - GO TO step 5.

    • If yes - regroup into hundreds and tens, then GO TO step 5.

  5. Write the final answer by adding the hundreds, tens and units.

a

Which two numbers will be added in step 1?

Worked Solution
Create a strategy

Follow step 1.

Apply the idea

Step 1 tells us to add the units which are the numbers 7 and 6.

b

Complete step 1: Add the units.

Worked Solution
Create a strategy

Add the units found in part (a).

Apply the idea
\displaystyle 7+6\displaystyle =\displaystyle 13Add the units
c

What do we need to do at step 2?

Worked Solution
Create a strategy

Use the answer from part (b).

Apply the idea

Since the result from part (b) is at least 10, \, 13 \gt 10, step 2 tells us to regroup into tens and units, and then GO TO step 3.

d

Regroup 13 into tens and units:

13 = ⬚+⬚

Worked Solution
Create a strategy

Write the number in a place value table.

Apply the idea

Here is 13 in a place value table:

TensUnits
13

We have 1 tens which equals 10, and 3 units which equals 3.

13 = 10+3

e

Now complete step 3: Add the tens.

Worked Solution
Create a strategy

Find the tens in each number.

Apply the idea

37 has 3 tens which equals 30. 46 has 4 tens which equals 40. 13 has 1 ten which equals 10.

\displaystyle 30+40+10\displaystyle =\displaystyle 80Add the tens
f

What do we need to do at step 4?

Worked Solution
Create a strategy

Use the answer from part (e).

Apply the idea

Since 80 \lt 100 we need to GO TO step 5.

g

Complete step 5: Write the final answer by adding the hundreds, tens and units.

Worked Solution
Create a strategy

Add the tens from part (e) and the units digit of the number found in part (b).

Apply the idea

From part (b) we have 13 which has a units digit of 3.

We found from part (e) that the sum of the tens is 80. This includes the 10 from 13.

\displaystyle \text{Final answer}\displaystyle =\displaystyle 80+3Add the tens and units
\displaystyle =\displaystyle 83Evaluate

Example 2

We are going to subtract these two numbers, using the subtraction algorithm below:

91-26

  1. Is the units digit of the first number less than the units digit of the second number?

    • If no - GO TO step 2.

    • If yes - regroup the tens from the first number to give a ten to the units, then GO TO step 2.

  2. Subtract the units of the second number from the units of the first number.

  3. Subtract the tens of the second number from the remaining tens of the first number.

  4. Write the final answer by adding the results of steps 2 and 3.

a

Fill in the blanks below:

The units digit of the first number is .

The units digit of the second number is .

Worked Solution
Create a strategy

Write the numbers in a place value table.

Apply the idea

Here are 91 and 26 in a place value table:

TensUnits
91
26

The units digit of the first number is 1.

The units digit of the second number is 6.

b

What do we need to do at step 1?

Worked Solution
Create a strategy

Use the answers from part (a).

Apply the idea

Since 1 \lt 6, we need to regroup the tens from the first number, 91, to give a ten to the units, then GO TO step 2.

c

Fill in the blanks below:

We can regroup the tens part of 91 as 90=⬚+10, in order to give 10 to the units part, which will become 1+10=⬚.

Worked Solution
Create a strategy

For the first blank, subtract 10 from the tens value of the first number.

For the second blank, evaluate the number sentence.

Apply the idea

The tens value of 91 is 90. So, 90-10=80.

We can regroup the tens part of 91 as 90=80+10, in order to give 10 to the units part, which will become 1+10=11.

d

Complete step 2: Subtract the units of the second number from the units of the first number.

Worked Solution
Create a strategy

The units of the first number is the result from part (c).

Apply the idea

The units of the first number is now 11 and the units of the second number is 6.

\displaystyle 11-6\displaystyle =\displaystyle 5Subtract the units
e

Complete step 3: Subtract the tens of the second number from the remaining tens of the first number.

Worked Solution
Create a strategy

The tens of the first number is the tens found from part (c).

Apply the idea

The tens of the first number is now 80 since we moved 10 to the units. The tens value of 26 is 20.

\displaystyle 80-20\displaystyle =\displaystyle 60Subtract the tens
f

Complete step 4: Write the final answer by adding the results of steps 2 and 3.

Worked Solution
Create a strategy

Add the tens found in part (e) to the units found in part (d).

Apply the idea
\displaystyle \text{Final answer}\displaystyle =\displaystyle 60+5Add the tens and units
\displaystyle =\displaystyle 65Evaluate
Idea summary

We can use algorithms to add or subtract numbers.

What is Mathspace

About Mathspace