 # What is decomposition? Decomposition in computer programming explained by TheSchoolRun's Billy Rebecchi, with details of how children are taught to decompose programs in the KS1 and KS2 classroom.

## What is decomposition?

Decomposition is a problem-solving technique that is essential to computer science (as well as almost all problem solving, though you may not realise it!).

The aim of decomposition is to reduce the complexity of a problem by breaking it down into a series of smaller, simpler problems that can be completed one at a time. When the solutions of all the smaller problems are put together, a solution for the larger problem is achieved.

### How children learn about decomposition in KS1

Decomposition is a higher-level technique that will not be introduced in detail throughout the younger years, and a definition certainly won’t be given to students until KS2.

However, in KS1 the idea of decomposition may be loosely introduced through problem-solving activities, often related to playing games and real-world examples.

To understand how it fits into the curriculum, look at the below image which represents a Guess Who board: In the game Guess Who, the aim is to try and find out which character the other player has picked by asking a series of questions to try and narrow down the possibilities to only one. Let’s play a round using the character named Christian: I have decided that Christian is my character, and now it is down to the other player to try and work out whom I have chosen. The first question could be “have you chosen a male character?” to which the answer would be “yes”. This has immediately narrowed down the remaining choices on the board: Having narrowed down the options the next question asked could be “has your character got black hair?” the answer to which would be “no”. The board now looks like this: Next we could find out whether our character has hair: Now let’s find out whether our character has blonde hair: And finally, do they wear glasses? As you can see, by asking a series of targeted questions we were able to establish that the chosen character must be Christian, as there was nobody else on the board that met our criteria.

Before our decomposition of this problem, we were faced with quite a daunting task – how do we work out who our opponent has chosen in a group of 16 people? However, by breaking the problem down into a series of smaller, easier-to-manage problems, we were able to find a solution with relative ease. This is the heart of decomposition: taking a complex and seemingly impossible problem and analysing how best to find a solution.

### How children learn about decomposition in KS2

In KS2 the key concepts of decomposition will be revisited, however there will be a much stronger link to mathematics and computer science whilst learning takes place.

A fantastic example of a decomposition activity at KS2 would be to look at mathematical functions and break them down into their individual components. Take the following equation: There are a lot of steps involved when solving this equation, so the best way to calculate an answer is to decompose it. Before we start our decomposition let’s have a quick reminder of the rules involved when solving maths equations. BODMAS (Brackets, Other / Indices, Division, Multiplication, Addition, Subtraction) tells us what order we need to solve operations in.

The first step to solving maths equations is to solve our brackets. Therefore, let’s complete the addition in our brackets and see what the equation looks like: The next step is to solve any indices (powers), however since there aren’t any present, let’s move straight on to our multiplication and division.

It doesn’t matter in which order we do multiplication and division. Since the top left of our equation is a multiplication, let's do this first: Next, let us complete our divisions: (30 / 2) - (12 / 3) is 15 -4. Tinally, let’s complete our additions and subtractions. We subtract 4 from 15 to get a final answer of 11 and our equation has been solved.

What seemed a daunting equation to calculate was decomposed into a series of smaller and simpler sums, allowing us to work out our final answer with general ease and making the larger equation much easier to solve. ## Decomposition in primary school: what your child learns year-by-year

Please note that the following guidelines for what is taught in each primary year is for guidance only and may not be representative of the way computing is taught at your child’s school.

Year 1 and Year 2
Students will learn about problem solving and how to break a problem down into a set of easier to achieve tasks. This will be closely tied to the learning of algorithms and some elements of mathematics.

Year 3 and Year 4
Students will be introduced to the concept of decomposition with a direct link to computer science. Problem-solving activities will be given that focus on individual problem solving skills and students may be required to solve problems using a programming language such as Scratch.

Year 5
Students will start to decompose more complex problems, with a direct link to mathematics and equation decomposition.

Year 6
Students will continue their learning of decomposition, with students being given more complex tasks to design and write their own code for.