Building up to Coding

Age 5 to 11
Article by Jenni Back, Jennie Pennant and Lynne McClure

Published February 2012.

Our stage 1 and stage 2 problems for this month's edition focus on laying the foundations for the skills and ways of thinking that are involved in the processes of creating codes, coding and de-coding. 

We have been prompted to do this by the centenary of Alan Turing the famous World War II code breaker, but we also know that codes form an important part of our modern life and indeed most of us use some form of coded message at some point every day: 

  • the card that lets you into your school or classroom will have encoded data built into it
  • we use combinations of numbers to switch on and turn off entry alarms and to access our computers
  • every time we make a payment by credit card encrypted data whizzes through the ether.

More mathematicians are employed in the business of code making and breaking than in any other mathematical application. Prime number theory, which was explored by mathematicians for many, many years for esoteric reasons, found its most significant application in data encryption. So we feel that it is vital to give young learners a taste of what coding is like.


What's behind the problems?

The series of problems we offer you this month take you and your learners through some of the processes and key ideas that underlie making and solving codes.

To start off we look at pattern recognition and ask the children to observe what is going on when a shape is added to another shape in What's Happening? The children are asked to recognize the steps involved as triangles are added to the sides of the pentagon - where does the next triangle go and why? In the process the image is developed progressively.

Working with codes involves testing hypotheses and working out when you can be certain that you have enough information to crack the code and What Was in the Box? offers an opportunity to explore this. You may try out a theory about how the code may be cracked and then find it doesn't work so you need to adjust your hypothesis and try again. This problem encourages children to do just that. The children explore what happens to the number as it goes through the box and make a hypothesis about what happens. They can then check their hypothesis with the other numbers to see whether it is true. The idea can be extended so that children create their own boxes for their friends to crack the code. How much do they need to know before they can find the rule? This is the essence of the problem's connection with code breaking.

Another key idea in making and using codes is the use of tables of information and What's in a Name? uses a table that assigns a value to each letter of a child's name. The pattern of the numbers can be used to identify the name if we know the rule for setting up the table. Each name can also be assigned a total value by adding up these numbers. There is a lot of exploration here that is possible and children can explore at what points the numbers can successfully be decoded and the point at which their distinct origin is lost.

Our problem Unlocking the Case offers children a real context in which they might need to crack a code to undo a combination lock, based on the power of sequences. The clue relates to a sequence of special numbers and there may be a range of solutions that are possible.
There are lots of other lost code scenarios that you might like to consider as well: the number on the bike combination lock, the entry code to get into a building, the entry number for a safe. All of these will make sense to young children. Often a clue is kept in a special place for this number and the children can explore what the code might mean so that they can unlock the padlock or case or get into the house. The children might extend the activity by exploring other sequences and considering ways of coding them or they might create their own codes and get one another to crack them.

It's a Scrabble uses the familiar game of Scrabble as a context for introducing the idea that the frequencies in which letters occur in a language can form the basis for identifying the code that has been used in coding a message. This problem also explores some languages other than English and the incidence of letters in them so there are plenty of possibilities for extension here as well as cross curricular and cross cultural links.
Later problems that we offer at stages 3 - 5 build on this frequency analysis, data handling aspect of code making and breaking to a more sophisticated level. Some of these might be accessible to those in stage 2 who find this branch of mathematics inspiring. In particular, you might like to look at our article on the history of Morse, in which a code is assigned to each letter according to its frequency. It is intriguing to read how Morse worked out the appropriate frequencies and the idea is very accessible to students working at this level.

Our final problem in the set, Some Secret Codes, offers children the opportunity to use a simple substitution code for coding and decoding messages. So here they have an experience of doing and undoing, coding and decoding which links in with one of the really big ideas in mathematics about operations and their inverses. The messages that we offer are all excerpts from nursery rhymes so they may offer some opportunities for the children to predict the whole message and this could lead them in to examining the way in which computers and phones might predict text as you type. The substitution code offered here is a simple one that replaces each letter in the alphabet with one a few letters ahead linking back again at the end so 'a' becomes 'd'  and 'z' becomes 'c'. This kind of code is known as a Caesar shift as it was used by Roman emperors to code instructions to their generals.  In fact the arena of military operations is the one in which most coding strategies have arisen and this offers yet another opportunity for cross curricular work and links with history.

We hope you enjoy this month's problems and see how they can build the children's understanding of these code making and breaking skills for more sophisticated activities later on. If you would like to explore this further yourself to see how these skills contribute then have a go at the Secondary Cipher Challenge, or the  Cipher Challenge Toolkit and investigate four different strategies for decoding a message.