Computational thinking and mathematical reasoning

Nov 27, 2016

Miles Berry and Andrew Csizmadia

Andrew Csizmadia and I presented on Computing: the silent C in STEM at a CIDREE expert group of STEM curriculum developers in Utrecht last week. Here’s an extract of our paper, exploring the connections between computational thinking and mathematical reasoning.

From primary school onwards, children’s arithmetic has two quite distinct stages: thinking about the question, and then working out the answer. A sum as simple as 23 + 39 demands that the child be able to decode these symbols in some meaningful way and determine which algorithm to bring to bear in order to calculate the answer: then, and only then, can the child go on to working out the answer. When faced with a word problem, for example, how much change will I receive from a 5 pound note if I buy three apples each costing 40 pence, the same two stages apply, this time demanding a degree of abstraction as the child moves from the particular context to its mathematical representation, in this case 5 – 3 x 0.40.

More generally, we might see that most, indeed perhaps all, mathematics mirrors these two stages – thinking about problems and then manipulating symbols according to rules (i.e. a more sophisticated version of working things out). The formalist view of mathematics is that mathematics consists of the consequences of certain string manipulation rules: for example Euclidean geometry can be thought of as those statements which can be formed by manipulating geometric axioms according to the laws of inference. However, even within this formalist paradigm, practical, useful mathematics demands some thinking about which particular manipulations of strings will take us towards the solution of the problem facing us.

This view of mathematics as symbol manipulation lies at the foundation of computing. Up until the 1940s, computer was a job title – given to those paid to do arithmetic on paper or mechanical calculators according to the rules and procedures given them by their managers. Turing expressed this symbol manipulation view of mathematics in his seminal paper, ‘On computable numbers, with an application to the Entscheidungsproblem’, defining computable numbers as those which could be written down by a machine and generalising this to computable functions and computable predicates: it is on this work (and the parallel work of Alonzo Church) that computer science is founded, and thus the strong connections between mathematics and computer science, from primary school level up should not surprise us.

In the decades since Turing’s and Church’s work, mathematics, as with so many other fields, has been transformed by digital computing. The symbol-manipulation (or working out) phase of the mathematics done in science, finance, social sciences, the arts and every other domain (other than education) is done now by digital computers, rather than by people, as Conrad Wolfram explains in his TED talk. Indeed much of the symbol manipulation of even pure mathematics is now often done by digital computers rather than mathematicians, or their research assistants, themselves (see, e.g., Appel and Haken’s computer-assisted proof of the Four-Colour Theorem.)

The first phase of mathematics – thinking about the problem or the system – remains largely unchanged. Creative and imaginative problem solving lies at the heart of mathematics. Polya suggested four principles for problem solving: understand the problem, devise a plan, carry out the plan and look back, plus a number of associated heuristics.

Polya: how to solve it

Wolfram argues convincingly that this is what mathematics education should now focus on, given that actual computation is now done by machines, and suggests his own four-stage helix for problem solving: define questions, translate to maths, computer answers and interpret. There are parallels here with the development process in software engineering: specification, design, implementation and testing.

Computer Based Math

It would be wrong to think of school mathematics as being confined to manual computation. Problem solving and mathematical reasoning is an essential part of mathematics education. For example, the English National Curriculum aims to ensure that all pupils:

reason mathematically by following a line of enquiry, conjecturing relationships and generalisations, and developing an argument, justification or proof using mathematical language; and

can solve problems by applying their mathematics to a variety of routine and non-routine problems with increasing sophistication, including breaking down problems into a series of simpler steps and persevering in seeking solutions.

Given the strong connections between mathematics and computer science, it would be surprising if the sort of mathematical reasoning involved in understanding problems and planning their solution was not mirrored by similar thinking in specifying systems and designing solutions in the field of computing. Just as mathematics might be seen as thinking followed by symbol manipulation, so programming can be seen as algorithms plus code. Before programmers begin work on coding solutions, they need to have fully understood the problem and have a clear plan (an algorithm) of how to solve it.

The term ‘computational thinking’ has been coined to describe

the thought processes involved in formulating problems and their solutions so that the solutions are represented in a form that can be effectively carried out by an information-processing agent. (Wing, 2010)

Whilst there is not yet a universal consensus over the exact ingredients of computational thinking, its importance in computing education is widely accepted. It is seen as a ‘golden thread’ running through the English National Curriculum for Computing, which begins:

A high-quality computing education equips pupils to use computational thinking and creativity to understand and change the world. Computing has deep links with mathematics, science and design and technology, and provides insights into both natural and artificial systems.

Building on Brennan and Resinick’s work in which computational thinking is explored as concepts, practices and perspectives, Computing At School’s ‘Barefoot Computing’ continuing professional development programme for primary teachers identified six concepts and five approaches for computational thinking (qv Computing At School’s QuickStart Computing handbook). The concepts provide a unified approach to problem solving in both mathematics and computing, with a number of the example activities produced for Barefoot Computing linking these to topics in the English mathematics curriculum.

The computational thinker
  • Logical reasoning
    • In computing pupils use laws of inference to predict what programs will do from their source code, to detect and correct errors in algorithms and programs and to analyse the efficiency and correctness of algorithms; pupils learn about Boolean logic and its applications to circuits, programs and search. Program execution by CPUs relies on logic gates.
    • Mathematics is underpinned by set theory and logic. Mathematical reasoning is fundamentally logical reasoning. In maths, pupils will be expected to ‘show their working’ and to provide a justification for their answer. They form a basic understanding of sets and their relationship, which is later formalised through Venn diagrams and the notation of set theory. They are introduced to simple proof techniques in Euclidean geometry, and will use reductio ad abusurdum and induction at A level.
  • Algorithms
    • From an early age, pupils learn about algorithms as sets of rules or sequences of steps for real life situations such as making a jam sandwich or tidying their classroom. They learn how these algorithms are implemented as code on digital devices. They learn that there are multiple algorithms for the same problem. They create their own algorithmic solutions to computational problems and are taught some classic algorithms for search and sort, finding greatest common divisors and testing for primality. They study greedy and divide-and-conquer algorithms in a range of contexts, including graph theory. They compare the efficiency of algorithms, in time learning to use big-O notation.
    • Pupils are typically taught standard algorithms for problems in arithmetic and subsequently algebra. This might be as simple as ‘count out the first number of sweets; count out the second number of sweets; now count how many sweets you have’ for integer addition, but will go on to include standard written algorithms for long multiplication and division, as well as methods for solving linear, simultaneous, quadratic and simple differential equations. Pupils are taught standard algorithms in other contexts, including testing for primality. They learn formulae for finding perimeters, areas and volumes, and for solving quadratic equations. Some pupils may discover their own algorithmic approaches to solving some classes of problems.
  • Decomposition
    • Pupils learn to break down complex problems into smaller ones, tackling each of these in turn. Pupils learn how divide-and-conquer algorithms are applied recursively, efficiently reducing the number of steps needed to solve a problem (e.g. Quicksort). Pupils make use of decomposition in their programming, using procedures, functions or classes to allow the different components of complex software to be developed and tested independently. At the hardware level, pupils come to recognise how digital devices are made of multiple, complex components, each typically made from multiple, complex subsystems.
    • Decomposition is also a powerful problem solving technique in mathematics, with pupils applying this in different contexts during their time at school. At an elementary level, pupils recognise how numbers are decomposed into parts using place value, and subsequently prime factors. Simple arithmetic algorithms rely on ready familiarity with decomposition using place value. Pupils learn how the area or volume of complex shapes can be found through decomposition. Subsequently, pupils learn how vectors can be decomposed into orthogonal components and how matrices (and thus systems of linear equations) can be decomposed in a number of ways.
  • Patterns and generalisation
    • In computing, pupils come to recognise common ways to solve similar problems (for example, drawing equilateral triangles, squares and regular pentagons with a turtle), subsequently developing a general solution to a class of similar problems (in this case, drawing a regular polygon). Pupils learn to use libraries of functions developed by others rather than re-creating this code for themselves. They learn how other programmer’s solutions to problems may be modified to solve similar problems. As pupils’ software projects become more complex, they may make use of design patterns in their work, such as ‘model-view-controller’, which can be applied in a wide range of contexts from computer games to text editors.
    • Young children come to recognise patterns at an early stage in mathematics education, colouring in shapes according to a rule or deciding what will come next in a sequence. They generalise their own rules of conservation of number, shape and mass from observation. Later they are introduced to patterns in number, including the times tables as well as common sequences such as square, triangular numbers and the Fibonacci sequence. They conduct mathematical investigations, first describing the rules they discover and then expressing these in algebra, as recurrence relations and then as formulae. Pupils learn generalised algorithms or techniques – thus pupils learn the algorithm for long multiplication rather than memorising times tables to 100×100 or beyond and standard results for derivatives rather than computing each from first principles.
  • Abstraction
    • For Jeanette Wing abstraction lies at the heart of computational thinking, and its particular form in computer science serves to distinguish computational thinking from other approaches to problem solving. Computer systems, both hardware and software, are so complex that computer scientists and software engineers have found it essential to establish ways to manage this complexity, by hiding or setting to one side multiple layers of detail. Pupils might first meet abstraction explicitly in the form of ‘computational abstractions which model the state and behaviour of real world systems’ – for example the motion of a Snooker ball or the spread of an epidemic. They’ll also recognise abstraction in functions, classes, libraries and APIs they use in their code: where the details of implementation are left hidden, and at times inaccessible, behind well documented specifications. They’ll also recognise abstraction in their mental models of computation (or ‘notional machines’ where the layers of user interface, compiler / interpreter, operating system and the processor’s presentation layer sit between their actions and the copper and silicon of the hardware.
    • Abstraction is important in mathematics education too, with the curriculum taking pupils from the concrete to the abstract along a path that would be familiar still to Piaget. At an early age, pupils form an abstract notion of, for example, three-ness from the concrete three bears, three sweets, three books etc. They form an abstract notion of triangle or cube from the experience of particular triangles and cubes. In problem solving, pupils identify the important information in the phrasing of a question, setting to one side the less relevant or irrelevant detail. Algebra might be seen as an abstraction of number, with algebra, geometry, probability and calculus the mathematician’s approach to modelling the state and behaviour of real world systems.
  • Evaluation
    • In computing, it’s necessary for pupils to check whether the functions, classes and programs they write produce the results they should. It’s also important that digital artefacts (including, but not limited to, programs) serve their intended purpose and are appropriate for their intended audience, and embody principles of good design. Pupils will also consider the efficiency, and indeed elegance of their code.
    • In mathematics, pupils are taught to check their solutions, for example that numbers are broadly of the correct order of magnitude and make sense in the context of the original problem. They are also taught to check their working, that each step of their solution has been carried out correctly. Later on, they’ll learn to look for logical flaws in proofs and perhaps even grasp something of the aesthetics of ‘elegant’ proofs.

It seems that we could gain much through the language, and perhaps even the approach, of computational thinking within the domain of school mathematics.

The concepts of computational thinking can be learnt and applied in ‘unplugged’ approaches, within and beyond computing, without the use of digital technology (as the above comparison with mathematics education illustrates, see also, e.g. CS Unplugged). Wing’s ‘information processing agent’ certainly includes digital computers, but need not be limited to such devices.

That said, many would argue that ‘computational thinking’ can be developed particularly (perhaps most) effectively when linked explicitly to the ‘computational doing’ of computer programming:

Programming plays the same role in computer science that investigations do in maths or science. Programming animates the subject and brings computer science to life; it is creative, and engaging. It illustrates otherwise-abstract concepts in completely concrete terms. It is also an incredibly useful skill. (Peyton Jones 2014)

Papert wrote how that he

began to see how children who had learned to program computers could use very concrete computer models to think about thinking and to learn about learning and in doing so, enhance their powers as psychologists and as epistemologists.

The experience of most primary and secondary computing teachers seems to be that computational thinking is best taught when linked with directly with computer programming. It’s possible to argue, as Wolfram does that, if computer programs and computer programming were used more extensively in mathematics education, then this would allow teachers and pupils to focus much more attention on developing mathematical reasoning (or perhaps ‘computational thinking’) rather than mere calculation skills.

Our sides are below: