# 9.1 Algorithmic Thinking

## 9.1 Algorithmic Thinking

Algorithmic thinking means solving a problem by describing a clear sequence of steps that always leads from input to output. Instead of relying on intuition, we make the method explicit so that anyone can follow it and obtain the same result.

### From answers to procedures

When you compute $27 + 48$, you do not guess. You follow a method. First add the ones: $7 + 8 = 15$, write $5$ and carry $1$. Then add the tens: $2 + 4 + 1 = 7$. The result is $75$.

What matters here is not only the answer, but the procedure. The same steps work for any pair of numbers. This repeatability is what makes it an algorithm.

### Turning definitions into actions

Mathematics often begins with definitions, but algorithmic thinking asks how to use them.

Take the idea of an even number. A number is even if it can be written as $2 \times k$ for some integer $k$. To check if $42$ is even, divide by $2$ and look at the remainder. Since the remainder is $0$, the number is even. For $43$, the remainder is $1$, so it is odd.

The definition gives meaning. The algorithm gives a method to test it.

### Working through a concrete example

Consider the list

$$
3,\ 7,\ 2,\ 9,\ 5.
$$

We want to find the largest number. One simple method is to scan the list from left to right while remembering the largest value seen so far.

Start with $3$ as the current largest. Compare it with $7$ and update to $7$. Compare $7$ with $2$ and keep $7$. Compare $7$ with $9$ and update to $9$. Compare $9$ with $5$ and keep $9$. At the end, the answer is $9$.

This method does not depend on the size of the list. It works in exactly the same way for any number of elements.

### Clarity and termination

A good algorithm must be precise. It should clearly state what the input is, what steps to follow, and when the process stops.

For example, “keep checking numbers” is not enough. We must say which numbers to check and when to stop. In the list example, we stop after the last element. Without a stopping rule, a process may never end.

### Representation affects the method

The way we write mathematical objects influences the algorithm we use.

A number can be written in decimal or binary. A polynomial can be written as a list of coefficients or as a formula. A graph can be stored as a list of edges or as a table of connections. Each representation makes some operations easier and others harder.

Algorithmic thinking includes choosing a representation that fits the task.

### Algorithms and proof

There is a close connection between algorithms and proofs. A proof may show that something exists, but an algorithm shows how to find it.

For example, it is one thing to know that two numbers have a greatest common divisor. It is more useful to have a method that computes it step by step. In this sense, algorithms make mathematics constructive.

### A practical habit

The central habit is to replace vague instructions with exact steps. Instead of saying “solve this,” we ask:

What do we start with
What operation comes next
How do we know when we are done

By answering these questions, we turn ideas into procedures. This makes mathematical reasoning clearer, more reliable, and easier to apply in practice.

