CODING + MATHEMATICS

Lessons learned from research classrooms

by George Gadanidis, Western University

0. Introduction

Computer programming offers the potential for changing how and what mathematics students learn, as well as who can learn it and when.

In this collection of short video clips, I share 9 lessons we have learned about integrating mathematics and computer programming, and about mathematics teaching and learning in general. 

  1. Give students code that works 
  2. Make it a puzzle
  3. Use a low floor and a high ceiling
  4. All students deserve big ideas of mathematics
  5. Coding offers cognitive simplicities
  6. Coding needs deeper mathematics
  7. You don’t have to be a coding expert
  8. Less can be more
  9. Tell a good math story

This learning is the result of spending many mornings and afternoons collaborating and co-teaching in grades 1-10 classrooms.


1. Give students code that worKS

The traditional approach for teaching computer programming is for students to first learn about the various code components. 

In contrast, we typically start by giving students code that works, such as the code shown here.

See https://scratch.mit.edu/projects/665007043/editor

Students click on the code and they start understanding it incidentally, as they notice what it it does.

As one teacher noted:

“My biggest leaning was about incidental learning. Coding facilitates that. I also learned that when you have incidental learning I think the learning is deeper.”

An analogy would be teaching a child to ride a bicycle.

How do children learn to ride a bicycle?

We don’t start by taking the bicycle apart, and one-by-one teaching the child about each of the parts.

We put the child on the bike, and give a little push.

The bicycle has parts that move – it is alive – and it is best understood by experiencing it in action.

This code is also alive. So is the mathematics that it models. 


2. Make it a puzzle

We turn code that models mathematics concepts and relationships into a puzzle for students to solve. 

See https://scratch.mit.edu/projects/474587945/editor

We might say:

  • I found this code that does something interesting mathematically.
  • Click on it to see it in action. 
  • Edit the code and notice what changes.
  • Discuss in your group:
    • What does the code do?
    • How does it do it?
  • Then, edit the code to match each of the following results.
  • What other interesting results might you get?

The Canadian anthropologist Marcel Danesi (2020) says that:

  • Puzzles have been around since the dawn of history and have guided the evolution of large sections of that history, including discoveries in mathematics. 
  • Humans are naturally attracted to the playful learning that puzzles provide.

______________

  • Danesi, M. (2020). An anthropology of puzzles: the role of puzzles in the origins and evolution of mind and culture. London: Routledge, Taylor & Francis Group

3. Use a low floor and a high ceiling

For example, when introducing the topic of inequalities in grades 5 and 6, use masking tape to form a number line on the classroom floor.

Where on the number line are numbers greater than 3? 

Then create a second number line on the floor, perpendicular to the first one.

How many coordinates do we need to identify locations on the floor?

Where on the floor is the first coordinate greater than 3?

Use string to create a third number line, starting where the first two number lines meet, then extending vertically to the ceiling.

How many coordinates do we need to identify locations in the classroom?

Where in the classroom is the first coordinate greater than 3?

This activity offers a low floor, by anchoring student understanding to the physical environment around them.

Low floor mathematics requires minimal prerequisite knowledge.

This activity also offers a high ceiling, by engaging students with multiple meanings and representations of x > 3, in 1 dimension, 2 dimensions, and 3 dimensions. 

x > 100 in 1D, 2D & 3D

Such representations provide opportunities to investigate more complex mathematics concepts and relationships.

The different meanings of x > 3 engage student interest and imagination, and motivate them to attend deeply and to understand them.


4. All students deserve BIG IDEAS OF mathematics 

Our schools are democratic institutions. They provide access to education for all students.

However, as educators, we sometimes worry that big ideas of mathematics may confuse students. 

We also worry that students who typically struggle mathematically may not be ready to engage with bigger ideas.

This occasional lack of faith in children’s abilities is, in part, due to some popular, but incorrect, education theories.

Why do we underestimate children?

Jean Piaget, for example, brought to us the theory of stages of cognitive development. He said that young children are concrete thinkers and they develop their capacity to abstract later, maybe around age 12.

Seymour Papert, who worked with Jean Piaget, disagreed. He said the stages Piaget identified are not in children’s minds. Rather, these stages are symptoms of how we educate children.

Piaget (1972/2008) himself cautioned about how generally his stages of development may apply.

Fernandez-Armesto (1997) laments that “Generations of school children, deprived of challenging tasks because Piaget said they were incapable of them, bear the evidence of his impact” (p. 18).

Kieran Egan notes that young children naturally abstract to develop language, and come to understand words, such as dog.

Dogs are big, small, different colours, and with different dispositions. Children create an abstraction of the essential characteristics of dogs, and distinguish them from other animals that look like them.

Children effortlessly abstract at a young age. They are much more capable, and much more attracted to big ideas of mathematics, than we sometimes assume.

As one teacher noted:

I found that sometimes the tasks we might feel initially [to be] difficult, the kids got just like that. It has made me less fearful to go beyond the curriculum. In Grade 4 you’re only supposed to learn this. Well, what’s stopping us from showing them a little bit beyond that?

Another teacher said:

I wish you were here to see the kids that never do well on assessments. I’ve never seen that part of him. Words coming out were impressive.

A low floor and a high ceiling approach is one way to offer access to big ideas of mathematics for all students.

And, as we’ll soon see, coding offers cognitive simplicities that can change who can access what mathematics.

_______________

  • Egan, K. (2002). Getting it wrong from the beginning : our progressivist inheritance from Herbert Spencer, John Dewey, and Jean Piaget. New Haven :Yale University Press.
  • Fernandez-Armesto, F. (1997). Truth: A history and a guide for the perplexed. London: Bantam.
  • Papert, S. (1980). Mindstorms—Children, Computers and Powerful Ideas. New York: Basic Books, Inc.
  • Piaget, J. (2008). Intellectual evolution from adolescence to adulthood. Human Development, 51, 40-47. (Original work published 1972)

5. Coding offers cognitive simplicities 

Our society has grown in complexity. Today computational tools are used to model phenomena and processes, to make scientific progress and to succeed economically.

Most fields have a computational side: computational biology, computational mathematics, computational finance, computational medicine, to name a few examples.

Lorena Barba (2016) says computational modelling is “a source of power to do something and figure things out, in a dance between the computer and our thoughts.”

For instance, code that does something mathematical, like the code that plots inequalities, does it dynamically. 

See https://scratch.mit.edu/projects/665007043/editor

We can easily change one of the parameters, click on the code, and immediately see the effect. It would be very time-consuming to do this on paper.

This allows students to engage playfully and creatively with mathematical concepts and relationships and to develop conceptual understanding. 

Andy diSessa (2000, 2018) defines the phenomenon where coding simplifies and automates a process needed for mathematical investigation, as a cognitive simplicity.

Cognitive simplicities bring mathematics to life in new ways.

They change what and how mathematics is done, and who can do it and when.

As one teacher noted: It’s really neat because it extends their thinking, but in a natural way.

AN EXAMPLE

Let’s consider the Pythagorean Theorem, a2 + b2 = c2, as example.

Actually, we should call this the Sumerian Theorem, as the Sumerians knew of this property many centuries before Pythagoras.

The Sumerians were able to find very large integer triples, such as (119, 120, 169) and (4961, 6480, 8161), as depicted in cuneiform on this clay tablet. How did they find them?

Sumerian triples clay tablet.

Let’s use Scratch code to find integer Sumerian triples (a, b, c). We’ll do this by considering every integer point (a, b) on the Scratch stage and checking whether c is also an integer. Then let’s plot all integers ordered pairs (a, b).

This would be extremely difficult to do without code, as there are 17,280 integers pairs (a, b) on the Scratch stage. If you could check one pair every minute, it would take you 120 days.

However, coding offers a cognitive simplicity.

Scratch code can complete this process in about 1 minute.

See https://scratch.mit.edu/projects/588754331/editor.

What patterns do you notice in the plot? Do you see lines? Do you see curves opening to the left and to the right? What do they represent?

If you are curious how many Sumerian triples fit on the Scratch stage, you may simply add a counter to the code to keep track.

If we use Python, we may plot Sumerian triples (a, b, c) in 3D.

Why is the result a cone?

What other mathematics might we bring to life with the help of the cognitive simplicities that coding offers?

_______________

  • Barba, L.A. (2016). Computational Thinking: I do not think it means what you think it means. Blog post, retrieved 06/01/18: http://lorenabarba.com/blog/computational-thinking-i-do-not-think-it-means-what-you-think-it-means.
  • diSessa, A. A. (2000). Changing minds: computers, learning, and literacy. Cambridge, MA: MIT Press.
  • diSessa, A. A. (2018). Computational Literacy and “The Big Picture” Concerning Computers in Mathematics Education. Mathematical Thinking and Learning 20(1), 3-31.

6. Coding needs deeper mathematics 

Using coding to represent shallow mathematics ideas does not offer much benefit.

EXAMPLE 1

For example, in the case of inequalities, we may write code that simulates a Q & A.

See https://scratch.mit.edu/projects/747003183/editor

The mathematics of the Q & A code is shallow. It is simply about Yes or No. Correct or incorrect. 

Unlike the mathematics used in the code for plotting inequalities in 2D, this Q & A code does not involve conceptual relationships.

See https://scratch.mit.edu/projects/665007043/editor

The mathematics of the Q & A code has a low floor. But it also has a very low ceiling. 

EXAMPLE 2

Similarly, we can write code to simulate a Q & A that asks for sides a and b of a right triangle and calculates the length of c, the hypotenuse.

See https://scratch.mit.edu/projects/749902662/editor

However, the mathematics of this Q & A code is also shallow. It is simply about using a formula.

Instead, we may use code to find and plot integer Sumerian triples, to dynamically model and investigate deeper mathematics relationships.

Sumerian triples in 2D & 3D.

A NEW LITERACY

Coding may be seen as a new literacy.

Andy diSessa (2000, 2018) says that a literacy needs a literature.  A literature of “deep and powerful ideas”.

Coding is most effective for deep and powerful ideas of mathematics, to model conceptual relationships, and to bring them to life.

_____________

  • diSessa, A. A. (2000). Changing minds: computers, learning, and literacy. Cambridge, MA: MIT Press.
  • diSessa, A. A. (2018). Computational Literacy and “The Big Picture” Concerning Computers in Mathematics Education. Mathematical Thinking and Learning 20(1), 3-31.

7. You don’t have to be a coding expert 

Learn along with your students. 

Don’t be afraid to say, “That’s a good question. I don’t have the answer. Maybe we can find it together.”

Make understanding code a puzzle for students to solve.

Here’s some code that does something interesting mathematically.

Go to https://scratch.mit.edu/projects/474587945/editor

How may you edit the code to do this?

Can you do this?

Starting with with code that works — code that brings some important mathematics to life — motivates and empowers students to investigate and to understand.

One teacher noted:

“It can be challenging but a safe way to learn. Some of them could go beyond what we were showing them. I feel they really surpassed me.” 


8: Less can be more 

Implementing a few coding activities that bring mathematics to life, and doing this well, is the ideal way to get started.

Variables & spirals. See https://scratch.mit.edu/projects/474587945/editor
Inequalities in 2D. See See https://scratch.mit.edu/projects/665007043/editor
Sumerian triples in 2D & 3D.

Start small. 

Focus on big mathematics ideas. 

Learn to code along with your students.

A few well-designed mathematics experiences can have lasting impact on students’ and teachers’ dispositions, living fruitfully in future experiences — as Dewey (1938) has suggested — by raising expectation and anticipation of what mathematics is and what it can offer (Gadanidis, Borba, Hughes & Lacerda, 2016).

_______________

  • Dewey, John (1938). Experience & Education. New York, NY: Kappa Delta Pi.
  • Gadanidis, G., Borba, M., Hughes, J. and Lacerda, H. (2016). Designing aesthetic experiences for young mathematicians: A model for mathematics education reform. International Journal for Research in Mathematics Education 6(2), 225-244.

9. Tell a good math story 

One way to judge the quality of students’ mathematics experience is to consider how they would answer the question “What did you do in math today?”

As you plan a mathematics activity, imagine how it prepares students to answer this question.

Will they be able to share with family and friends an experience — a story — that would offer mathematical surprise and conceptual insight?

Brian Boyd (2009) says that story is a biological necessity.

Watson and Mason (2007) see mathematics as “an endless source of surprise.”

Creating, sharing and learning through stories and surprises are deeply human dispositions.

What wonderful mathematics stories — what mathematical surprises and conceptual insights — might you help your students experience?

And how might you use coding to enhance this experience?

Do you need more ideas? You may find these online resources helpful.

____________

  • Boyd, B. (2009). On the Origin of Stories: Evolution, Cognition, and Fiction. Cambridge, MA: Belknap Press of Harvard University Press.
  • Watson, A. & Mason, J. (2007) Surprise and inspiration. Mathematics Teaching 200, 4-7.